Hi all, I'm trying to use AHKDLL to replace a few OS hotkeys for my C++ program, and prior to that I was testing if PostMessage works with standalone AHK sending message to the C++ side. The problem is that, it just doesn't work, no message being received by the C++ side at all. Here are my codes:
C++ receiver:
Code: Select all
int main()
{
cout << "PID = " << GetCurrentProcessId() << endl;
MSG msg = { 0 };
while (GetMessage(&msg, NULL, 0, 0) != 0)
{
cout << "Received a message, wParam = " << msg.wParam << endl;
}
}
AHK sender:
Code: Select all
^n::
PostMessage, WM_APP, 1, 2, , ahk_pid [put the random PID given in cout of the receiver here]
return
I'm not sure if it due to some limitation of Windows, or a problem of my configuration. If this approach will not work, a better way to achieve so would be greatly appreciated! The only job of the AHK side is to let the C++ side know when a hotkey has been pressed.
Note that the C++ side is a console program which does not offer a GUI.
Thank you in advance!