flat assembler
Message board for the users of flat assembler.
Index
> Windows > maybe stupid question about closing window |
Author |
|
revolution 21 Jul 2010, 07:15
You need to post a WM_QUIT message to the window.
Or, if you want to ensure the quit message is not ignored, use TerminateProcess. |
|||
21 Jul 2010, 07:15 |
|
HarryTuttle 21 Jul 2010, 07:55
the trouble is that i have only Instance Handle (from ShellExecute) and i don't know:
How To Find a Window Handle from an Instance Handle? MSDN: use a GetWinHandle() function to return a Window handle based on an Instance handle but there is no such a function inside of win32dlls... _____________ TerminateProcess wants handle to the process. I have no hProcess. what is relation between Process handle, Instance Handle, Windows handle and Process Id ? _____________ what is the easiest way to do what I want ? _________________ Microsoft: brings power of yesterday to computers of today. |
|||
21 Jul 2010, 07:55 |
|
revolution 21 Jul 2010, 08:18
After FindWindow you can use GetWindowThreadProcessId, then OpenProcess and TerminateProcess.
But if you already have the window handle from FindWindow then just post a WM_QUIT. But isn't the Instance Handle from "open" the process handle? Have you tried to use it as a process handle? |
|||
21 Jul 2010, 08:18 |
|
HarryTuttle 21 Jul 2010, 08:43
I tried to use hInstance to TerminateProcess without success and
have no idea how use FindWindow: i don't know windows classname when i use "chrome.exe" as a second param the result of calling FindWindow function is NULL -thayt means the function fails _________________ Microsoft: brings power of yesterday to computers of today. |
|||
21 Jul 2010, 08:43 |
|
revolution 21 Jul 2010, 09:55
You have to use the window title not the executable name. Just leave the class as null.
|
|||
21 Jul 2010, 09:55 |
|
HarryTuttle 21 Jul 2010, 11:18
but..
what should I do when the browser haven't title bar with windows title ? _________________ Microsoft: brings power of yesterday to computers of today. |
|||
21 Jul 2010, 11:18 |
|
revolution 21 Jul 2010, 11:26
Every window has a title. Just that it might not be displayed. FindWindow still finds all titles regardless of whether they are displayed. Although conceivably the title could be blank making the job harder.
Instead, if you know the executable name you can just enumerate the running processes and terminate. Not a friendly way to do it but it would work reliably unless you have a rootkit hiding things. |
|||
21 Jul 2010, 11:26 |
|
HarryTuttle 21 Jul 2010, 11:32
THX 4 HELP
the title in my case is IPPP - Google Chrome _________________ Microsoft: brings power of yesterday to computers of today. |
|||
21 Jul 2010, 11:32 |
|
< Last Thread | Next Thread > |
Forum Rules:
|
Copyright © 1999-2024, Tomasz Grysztar. Also on GitHub, YouTube.
Website powered by rwasa.