SendMessage(退格)无法正常工作!

时间:2011-02-23 00:05:12

标签: .net vb.net

Private Const WM_KEYDOWN = &H100
Private Const WM_KEYUP = &H101
Private Const VK_BACKSPACE = &H8

Private Overloads Shared Function SendMessage(ByVal hWnd As IntPtr, _
ByVal msg As Integer, ByVal wp As IntPtr, ByVal lp As IntPtr) As IntPtr
End Function

我发这样的信息:

SendMessage(windHandle, WM_KEYDOWN, CType(VK_BACKSPACE, IntPtr), CType(&HC0510001, IntPtr))
SendMessage(windHandle, WM_KEYUP, CType(VK_BACKSPACE, IntPtr), CType(&HC0510001, IntPtr))

我也在这之前尝试过keybd_event:

Call keybd_event(&H8, MapVirtualKey(&H8, 0), 0, 0)
Call keybd_event(&H8, MapVirtualKey(&H8, 0), KEYEVENTF_KEYUP, 0)

有人可以帮忙吗? 谢谢!

1 个答案:

答案 0 :(得分:0)

解决了......这是我的错!由于一些疯狂的旧代码布尔值,我的函数没有激发!

所以如果有人需要这个,上面的sendmessage适用于退格!

抱歉,伙计们:)