I'm trying to use a hotkey to change a layered window from being transparent to allowing mouse messages to come through.
In my main function I call
// make hotkey with WM_HOTKEY messages sent to hwnd's window procedure, id 1,
// no other keys to work, F5 as hotkey
// while checking for errors and it completes successfully. I also do the same
// (id of 2) for VK_F7 and it completes successfully.
RegisterHotKey (hwnd, 1, 0, VK_F5);
RegisterHotKey (hwnd, 2, 0, VK_F7);
In my window procedure, I have
case WM_HOTKEY:
MessageBox (hwnd, "Got here", "Attention", MB_OK);
// Other stuff I need to do here
I tried adding MOD_CONTROL
, but to no avail.
This did actually work before. The only difference now is that I realized that two windows would solve the problems I've been having. Last time I only had one, and now I have two window procedures in my application. I made sure it's all going to the right one and everything, but I shouldn'e be limited to just 1 window... The window itself displays, as I set the transparency to 100/255 so it screens the view a bit, and I can see that screen.
Changing the key itself does nothing, and the WM_HOTKEY messages are being posted to the queue. I'm going to try manually sending them to the window.
edit: ^ with SendMessage() isn't working, going to see if it's getting any messages, and same with the other window while I'm at it.
edit: okay I feel like an idiot for saying this, but I had RegisterHotKey
going to a null hwnd since I didn't actually create that window yet (I created the one not getting hotkey message first and originally had these right after that). The problem is that even though I can see this window, and if I comment it all out the view is different (no screen), it isn't receiving any messages.
edit: I changed the title to something more suitable with this extra info. If this is a generic thing anyone's experienced, I'd be glad to hear. For now, I'm assuming it's my wrapper and creating them manually.
major edit: I just tried using raw API instead of my wrapper and it had an error registering the second. I changed the class name and now the classes register and the windows get created. The message box that comes up for hotkeys shows too. I think I forgot to put the showwindow for them though, I'll say how that works in a second (edit: after I restart my computer yet again!!!). Before you ask, I didn't spend too long on my wrapper yet, and yes, it has error checking, but uses a similar system to set/get lasterror() and I didn't check the return values on them since the second one seemed to be created before.