windows program in background and simulate keyboard
-
1. When I create a windows program and don't have it in focus it seems to end proccessing. This is where I place my code:
while (GetMessage(&msg, NULL, 0, 0)) { if (!TranslateAccelerator(msg.hwnd, hAccelTable, &msg)) { TranslateMessage(&msg); DispatchMessage(&msg); } //my code here }
Is there anyway I can make sure that my program is being run all the time, even if it's not in focus? 2. My second question is about simulating the keyboard, I know about PostMessage(). However, with this function I must post a key press to a certain window, what I want to do is to simulate a keypress to windows. ;P //Ylis -
1. When I create a windows program and don't have it in focus it seems to end proccessing. This is where I place my code:
while (GetMessage(&msg, NULL, 0, 0)) { if (!TranslateAccelerator(msg.hwnd, hAccelTable, &msg)) { TranslateMessage(&msg); DispatchMessage(&msg); } //my code here }
Is there anyway I can make sure that my program is being run all the time, even if it's not in focus? 2. My second question is about simulating the keyboard, I know about PostMessage(). However, with this function I must post a key press to a certain window, what I want to do is to simulate a keypress to windows. ;P //YlisThe hidden application will receive system messages but not the windows messages... Key press are windows messages and u will get it only if that window is in focus. I am sure, i guesss for your problem you need to implement a keyboard hook.
"When death smiles at you, only thing you can do is smile back at it" - Russel Crowe (Gladiator)
-
The hidden application will receive system messages but not the windows messages... Key press are windows messages and u will get it only if that window is in focus. I am sure, i guesss for your problem you need to implement a keyboard hook.
"When death smiles at you, only thing you can do is smile back at it" - Russel Crowe (Gladiator)
-
The hidden application will receive system messages but not the windows messages... Key press are windows messages and u will get it only if that window is in focus. I am sure, i guesss for your problem you need to implement a keyboard hook.
"When death smiles at you, only thing you can do is smile back at it" - Russel Crowe (Gladiator)
To simulate keyboard messages, I guess
SendInput()
would be a more appropriate option. - Nirav * Don't wish it was easier, wish you were better! *