WndProc接收不到信息,请大家帮忙参考下
我有个USB按键,要捕获到按键信息,有个VB程序,按键按下时VB能接收到信息,现在用BCB我做了没有接收到信息,请大家帮帮忙。
VB程序是这样的
Public Const WM_USER = &H400
Public Const WM_SNAP_KEYDOWN = WM_USER + &H3523
Function WindowProc(ByVal hw As Long, ByVal uMsg As Long, _
ByVal wParam As Long, ByVal lParam As Long) As Long
If uMsg = WM_SNAP_KEYDOWN Then
Call ProcessSnapShot
End If
Dim lpPrevWndProc As Long
'查询原来默认的窗口过程指针
lpPrevWndProc = GetWindowLong(hw, GWL_USERDATA)
'调用原来的窗口过程
WindowProc = CallWindowProc(lpPrevWndProc, hw, uMsg, wParam, lParam)
End Function
BCB程序:
.h里面:
#define WM_SNAP_KEYDOWN (WM_USER + 0x3523)
void __fastcall WndProc(TMessage & msg);
.cpp里面:
void __fastcall TfMain::WndProc(TMessage & msg)
{
if( msg.Msg == WM_SNAP_KEYDOWN )
ShowMessage("ooo");
TForm::WndProc(msg);
}
总是接收不到,不知问题出在哪里
[解决办法]
那个VB程序中还有什么代码?