释放键盘键 [英] Releasing Keyboard Key

查看:92
本文介绍了释放键盘键的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

嘿,



有谁知道如何使用Keybd_event功能:



Hey,

Does anyone know how can I use the Keybd_event function:

Declare Function keybd_event Lib "user32" Alias "keybd_event" ( _
ByVal bVk As Byte, ByVal bScan As Byte, _
ByVal dwFlags As Long, ByVal dwExtraInfo As Long) As Long





当我使用它时我收到错误:



拨打PInvoke function'test!test.Form1 :: keybd_event'使堆栈失衡。这很可能是因为托管PInvoke签名与非托管目标签名不匹配。检查PInvoke签名的调用约定和参数是否与目标非托管签名匹配。



任何帮助?



When I use it I get the error:

A call to PInvoke function 'test!test.Form1::keybd_event' has unbalanced the stack. This is likely because the managed PInvoke signature does not match the unmanaged target signature. Check that the calling convention and parameters of the PInvoke signature match the target unmanaged signature.

Any Help?

推荐答案

这是一个很好的例子:



http ://pinvoke.net/default.aspx/user32/keybd_event.html [ ^ ]



PInvoke.net [ ^ ]在进行Windows API调用时是一个很好的资源。
Here is a good example:

http://pinvoke.net/default.aspx/user32/keybd_event.html[^]

PInvoke.net[^] is a great resource when doing windows API calls.


建议不要使用函数 keybd_event ,因为它已被 SendInput 取代。请参阅:

http ://msdn.microsoft.com/en-us/library/windows/desktop/ms646304%28v=vs.85%29.aspx [ ^ ],

< a href =http://msdn.microsoft.com/en-us/library/windows/desktop/ms646310(v=vs.85).aspx> http://msdn.microsoft.com/en-us/ library / windows / desktop / ms646310(v = vs.85).aspx [ ^ ]。



这是P / Invoke的信息使用它: http://www.pinvoke.net/default.aspx/user32.sendinput [ ^ ]。



-SA
Using the function keybd_event is not recommended, as it has been superseded with SendInput. Please see:
http://msdn.microsoft.com/en-us/library/windows/desktop/ms646304%28v=vs.85%29.aspx[^],
http://msdn.microsoft.com/en-us/library/windows/desktop/ms646310(v=vs.85).aspx[^].

This is the information of P/Invoke use of it: http://www.pinvoke.net/default.aspx/user32.sendinput[^].

—SA


这篇关于释放键盘键的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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