我用全局的钩子函数处理了截获到的系统消息,现在我想在处理完后通知引用该dll的主程序,请问我该用什么办法呢?
解决方案 »
- 服务器端程序:如何将apache和C语言写的程序连接起来
- 如何响应键盘上的分号键以及如何实现受手轮式的按钮
- 如何向DateTimePicker控件赋值 不好意思没分了
- 一段短程序,vc.net编译竟然不过,c++ builder就没问题,求助
- 从树中分离节点的问题?
- 请教一个窗体图标问题
- 请问ADO中智能指针作为参数传递行不行?
- 想成为COM高手请来讨论几个问题,高分相送
- “0x10218294”指令引用的“0xce023eel”内存,该内存不能为“written”,这是个什么错误?50分
- 急!!!如何在一个单文档程序的工具栏中加一个ListBox,而且还要在这个Listbox中加入一棵树,并且要对这棵树的每一个节点进行遍历,操作,选定......
- 请问,全局钩子的参数是怎么样的?
- 关于Popupwindow
2.如果你是指加载hook的进程,那在具有share属性的segment里加入一HWND变量,在加载hook时保存此句柄,并在HookProc里向此句柄发自定义的消息即可。
然后用SendMessage(HWND ,MESSAGE,WPARAM,LPARAM);
向该接收窗口的exe发送message,在exe中,做一个message 响应函数负责接收!
The SendMessage function sends the specified message to a window or windows. It calls the window procedure for the specified window and does not return until the window procedure has processed the message. To send a message and return immediately, use the SendMessageCallback or SendNotifyMessage function. To post a message to a thread's message queue and return immediately, use the PostMessage or PostThreadMessage function.
SyntaxLRESULT SendMessage( HWND hWnd,
UINT Msg,
WPARAM wParam,
LPARAM lParam
);
ParametershWnd
[in] Handle to the window whose window procedure will receive the message. If this parameter is HWND_BROADCAST, the message is sent to all top-level windows in the system, including disabled or invisible unowned windows, overlapped windows, and pop-up windows; but the message is not sent to child windows.
Msg
[in] Specifies the message to be sent.
wParam
[in] Specifies additional message-specific information.
lParam
[in] Specifies additional message-specific information.
Return ValueThe return value specifies the result of the message processing; it depends on the message sent.
ResApplications that need to communicate using HWND_BROADCAST should use the RegisterWindowMessage function to obtain a unique message for inter-application communication.The system only does marshalling for system messages (those in the range 0 to WM_USER). To send other messages (those above WM_USER) to another process, you must do custom marshalling. If the specified window was created by the calling thread, the window procedure is called immediately as a subroutine. If the specified window was created by a different thread, the system switches to that thread and calls the appropriate window procedure. Messages sent between threads are processed only when the receiving thread executes message retrieval code. The sending thread is blocked until the receiving thread processes the message. However, the sending thread will process incoming nonqueued messages while waiting for its message to be processed. To prevent this, use SendMessageTimeout with SMTO_BLOCK set. For more information on nonqueued messages, see Nonqueued Messages. Windows 95/98/Me: SendMessageW is supported by the Microsoft® Layer for Unicode (MSLU). To use this, you must add certain files to your application, as outlined in Microsoft Layer for Unicode on Windows 95/98/Me Systems.
such as
void GetHwnd(HANDLE hwnd)
{
g_handle=hwnd;
}
you use the function in the *.exe and in the dll you can write SendMessage(g_hwnd,.....)
OK?