Click here to Skip to main content
16,011,120 members
Home / Discussions / C / C++ / MFC
   

C / C++ / MFC

 
GeneralRegistering EXE Pin
Dev Rupanagudi24-Apr-01 7:47
Dev Rupanagudi24-Apr-01 7:47 
GeneralXML Parser and Writer class requested Pin
24-Apr-01 6:09
suss24-Apr-01 6:09 
GeneralRe: XML Parser and Writer class requested Pin
Jamie Nordmeyer24-Apr-01 7:24
Jamie Nordmeyer24-Apr-01 7:24 
GeneralERROR_CALL_NOT_IMPLEMENTED Pin
Michael Anderson24-Apr-01 6:06
Michael Anderson24-Apr-01 6:06 
GeneralRe: ERROR_CALL_NOT_IMPLEMENTED Pin
Tomasz Sowinski24-Apr-01 7:42
Tomasz Sowinski24-Apr-01 7:42 
GeneralRe: ERROR_CALL_NOT_IMPLEMENTED Pin
Michael Anderson24-Apr-01 11:02
Michael Anderson24-Apr-01 11:02 
GeneralRe: ERROR_CALL_NOT_IMPLEMENTED Pin
Tomasz Sowinski25-Apr-01 0:49
Tomasz Sowinski25-Apr-01 0:49 
GeneralSending WM_CLOSE message to a Window Pin
confalonieri24-Apr-01 5:22
confalonieri24-Apr-01 5:22 
Hi.

I'd like to close an application by sending to its main window the WM_CLOSE message.

What I do is getting the ID of the process I want to stop, and then I use EnumWindows()
function to get all top-level windows in the screen and in the callback function
EnumWindowCallBack(), I compare the process ID with the ID of each top-level window.
When the ID is the same, I send to the window the WM_CLOSE message thanks to ::PostMessage().

But, unfortunately, it doesn't work all the times. It seems that the windows I get in
the callback function EnumWindowCallBack() are not the main windows of the applications
I want to stop... For example, with calc.exe, the window is closed after having posted
the WM_CLOSE message twice but the process calc.exe is still running without a window...

Has anyone already met this problem ?

Is there a way to be sure to get the right window of an application (and not a child window
that doesn't handle the WM_CLOSE message) ?

Thanks.


GeneralRe: Sending WM_CLOSE message to a Window Pin
Tomasz Sowinski24-Apr-01 5:38
Tomasz Sowinski24-Apr-01 5:38 
Generalstop document vew from appearing upon start up. Pin
hearties24-Apr-01 4:13
hearties24-Apr-01 4:13 
GeneralRe: stop document vew from appearing upon start up. Pin
Tomasz Sowinski24-Apr-01 5:09
Tomasz Sowinski24-Apr-01 5:09 
GeneralRe: stop document vew from appearing upon start up. Pin
Josh Knox24-Apr-01 5:34
Josh Knox24-Apr-01 5:34 
GeneralCOM: Getting PID of virtual folders Pin
Henrik24-Apr-01 3:34
Henrik24-Apr-01 3:34 
GeneralCreting a menu bar like in Internet Explorer Pin
24-Apr-01 3:31
suss24-Apr-01 3:31 
GeneralRe: Creting a menu bar like in Internet Explorer Pin
24-Apr-01 5:36
suss24-Apr-01 5:36 
QuestionHow can I set CFileDialog icons... Pin
23-Apr-01 23:33
suss23-Apr-01 23:33 
GeneralBuilding an Class Wizard looking Dialog Pin
23-Apr-01 20:16
suss23-Apr-01 20:16 
GeneralRe: Building an Class Wizard looking Dialog Pin
Manfred Ramosch23-Apr-01 22:03
Manfred Ramosch23-Apr-01 22:03 
QuestionWhy are my list box members null? Pin
23-Apr-01 16:51
suss23-Apr-01 16:51 
AnswerRe: Why are my list box members null? Pin
Michael Dunn23-Apr-01 20:09
sitebuilderMichael Dunn23-Apr-01 20:09 
GeneralReza Pin
23-Apr-01 16:36
suss23-Apr-01 16:36 
GeneralRe: Check Master Chris Maunder's code. Pin
Masaaki Onishi23-Apr-01 17:55
Masaaki Onishi23-Apr-01 17:55 
GeneralIShellFolder pointers, how to copy them safely... (COM) Pin
Henrik23-Apr-01 13:43
Henrik23-Apr-01 13:43 
GeneralRe: IShellFolder pointers, how to copy them safely... (COM) Pin
Michael Dunn23-Apr-01 15:49
sitebuilderMichael Dunn23-Apr-01 15:49 
GeneralVB Add-In Programming Pin
Jamie Nordmeyer23-Apr-01 10:53
Jamie Nordmeyer23-Apr-01 10:53 

General General    News News    Suggestion Suggestion    Question Question    Bug Bug    Answer Answer    Joke Joke    Praise Praise    Rant Rant    Admin Admin   

Use Ctrl+Left/Right to switch messages, Ctrl+Up/Down to switch threads, Ctrl+Shift+Left/Right to switch pages.