导入并使用SendInput [英] import and use SendInput

查看:101
本文介绍了导入并使用SendInput的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

嘿伙计。

我想导入并使用sendinput命令来模拟mql4中的击键。顺便说一句,我可以在c#中使用SendInput吗?/是否有更简单的命令?



如果我这样做:

#include< winuser32.mqh> ;

#importuser32.dll



int OnStart()

{

uint WINAPI SendInput(0,0,0));

返回(INIT_SUCCEEDED);

}



hey guys.
i would like to import and use the sendinput command to simulate a keystroke in mql4. btw can i use SendInput in c# ?/ are there easier commands ?

if i do this:
#include <winuser32.mqh>
#import "user32.dll"

int OnStart()
{
uint WINAPI SendInput(0, 0, 0));
return(INIT_SUCCEEDED);
}

'testing.mq4'	testing.mq4	1	1
'WinUser32.mqh'	WinUser32.mqh	1	1
'{' - unbalanced right parenthesis	testing.mq4	6	4
'SendInput' - semicolon expected	testing.mq4	7	16
'0' - name expected	testing.mq4	7	29
'0' - name expected	testing.mq4	7	32

推荐答案

无需申报功能再次。它在 windows.h 中声明。



错误可能来自未知关键字 winapi (它必须是大写 WINAPI ),因此编译器将 uint winapi 视为 uint 名称为 winapi 的变量,之后需要分号。但删除声明时无关紧要。
There is no need to declare the function again. It is declared in windows.h.

The error is probably sourced by the unknown keyword winapi (it must be uppercase WINAPI) so the compiler treats uint winapi as an uint variable with the name winapi and expects a semicolon afterwards. But this does not matter when removing the declaration.


这篇关于导入并使用SendInput的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆