Getting window Handel
Hello, I did do a search, but I searched badly.
BTW this is in C not C++
This is what I want to do.
I have a program
its Task name (using ctrl alt delet) is.
its proccess name is.
Are any of those its handel? Im not sure how to get a windows handle or even use it if I do. Does anyone know how?
My overall goal! so u dont think im some guy sending viruses or who knows what.
Is to create a macro program to prevent injury to my wrist in the future!
I was using keybd_event but that is annoying having to keep the swgclient as ontop :( So im hoping to switch to a sendkeys LIKE command.
easy man as long as u know the window caption, just use the api call FindWindow(class,caption); i havent used it 4 a while but i think u can set the class propertie as null. this will then return the hWnd value (i have used this for getting the sytrays handle and blitted junk 2 it ^^) of course the call requires the include file windows.h but hey uv prbly already got this included ^^ hope it helps
If you don't know the caption or class of the window to put in the FindWindow function, you should use an api spy program to obtain it. Spy++ is a good one that comes with VC++.
Hello, and thnx for the info, it seems to be running fine.
Now part 2:
What is the best ways to send keys to a specific program, like a macro program would work.
Without using hooks...
If you can ensure the program you want the keystrokes to go to will have focus, then use SendInput, else use SendMessage to the window you want.
I agree however i would go with send message, very flexible
I got spy++ from
This program RULES...
Are handels static?
No, they can change per process and each time the program with the handle runs. Use FindWindow to get a handle for your process.