Click here to Skip to main content
15,894,460 members
Home / Discussions / C / C++ / MFC
   

C / C++ / MFC

 
QuestionUse of Multiple Check boxes in MFC Pin
jawadali47712-Sep-12 20:12
jawadali47712-Sep-12 20:12 
SuggestionRe: Use of Multiple Check boxes in MFC Pin
sanjaylk12-Sep-12 20:35
sanjaylk12-Sep-12 20:35 
GeneralRe: Use of Multiple Check boxes in MFC Pin
jawadali47712-Sep-12 21:20
jawadali47712-Sep-12 21:20 
GeneralRe: Use of Multiple Check boxes in MFC Pin
David Crow13-Sep-12 3:31
David Crow13-Sep-12 3:31 
QuestionTool tips on Status bar created on a dialog Pin
Craig Hewitt12-Sep-12 19:00
professionalCraig Hewitt12-Sep-12 19:00 
AnswerRe: Tool tips on Status bar created on a dialog Pin
Jochen Arndt12-Sep-12 21:30
professionalJochen Arndt12-Sep-12 21:30 
Questionend winword.exe by c++ Pin
kesten112-Sep-12 7:22
kesten112-Sep-12 7:22 
AnswerRe: end winword.exe by c++ Pin
pasztorpisti12-Sep-12 7:31
pasztorpisti12-Sep-12 7:31 
Somehow you should find the process. I think the easiest way to find it by window. You can use FindWindow() to find the window of the process by either window text (title) or by window class. I recommend the window class because the title is usually variable, you can find out the window class of a window by using spy++. So lets say you know the window classname and you can find the window handle of the window of the process. Then you can use GetWindowThreadProcessId() to get the id of the process and the thread that created the window. You need the process id. Use OpenProcess() with the processid to create a handle to the specified process. You can use the process handle with TerminateProcess(). There are two other more polite ways to do the stuff: When you get the HWND of the program with FindWindow() you can send messages to the window of the process. By using PostMessage to post a WM_CLOSE to this HWND you get basically the same effect as by clicking on the X-close button of the window. The problem with this is that many programs react to this by popping up a "Do you really want to exit?" messagebox and the user can still cancel the program exit. Another solution that is between the WM_CLOSE and the TerminateProcess() solutions is calling DestroyWindow() on the HWND of the program (that destroys the window and before this sends WM_DESTROY message to it). The problem with this is that many programs don't handle this well, for example some buggy programs use PostQuitMessage() from their WM_CLOSE instead of their WM_DESTROY handler and they don't put proper cleanup code to their WM_DESTROY. The less reliable is DestroyWindow() that might be used if we spoke of one fixed version of a program that proved to work with this, but if WM_CLOSE is enough than I would go with that, otherwise with TerminateProcess().
GeneralRe: end winword.exe by c++ Pin
kesten112-Sep-12 7:55
kesten112-Sep-12 7:55 
GeneralRe: end winword.exe by c++ Pin
pasztorpisti12-Sep-12 8:10
pasztorpisti12-Sep-12 8:10 
QuestionRe: end winword.exe by c++ Pin
David Crow12-Sep-12 10:19
David Crow12-Sep-12 10:19 
QuestionCDHTMLDialog Control HTML Body Size! Pin
Kevin Arnold12-Sep-12 3:37
Kevin Arnold12-Sep-12 3:37 
AnswerRe: CDHTMLDialog Control HTML Body Size! Pin
Kevin Arnold13-Sep-12 18:03
Kevin Arnold13-Sep-12 18:03 
Questionusing static library for C code in Visual studio 2005 Pin
sunny_vc12-Sep-12 1:12
sunny_vc12-Sep-12 1:12 
AnswerRe: using static library for C code in Visual studio 2005 Pin
pasztorpisti12-Sep-12 2:03
pasztorpisti12-Sep-12 2:03 
AnswerRe: using static library for C code in Visual studio 2005 Pin
Malli_S12-Sep-12 2:04
Malli_S12-Sep-12 2:04 
GeneralRe: using static library for C code in Visual studio 2005 Pin
sunny_vc12-Sep-12 2:12
sunny_vc12-Sep-12 2:12 
AnswerRe: using static library for C code in Visual studio 2005 Pin
Malli_S12-Sep-12 2:16
Malli_S12-Sep-12 2:16 
GeneralRe: using static library for C code in Visual studio 2005 Pin
Chris Losinger12-Sep-12 2:15
professionalChris Losinger12-Sep-12 2:15 
GeneralRe: using static library for C code in Visual studio 2005 Pin
Malli_S12-Sep-12 2:17
Malli_S12-Sep-12 2:17 
GeneralRe: using static library for C code in Visual studio 2005 Pin
Chris Losinger12-Sep-12 2:19
professionalChris Losinger12-Sep-12 2:19 
GeneralRe: using static library for C code in Visual studio 2005 Pin
Malli_S12-Sep-12 2:23
Malli_S12-Sep-12 2:23 
GeneralRe: using static library for C code in Visual studio 2005 Pin
sunny_vc12-Sep-12 2:42
sunny_vc12-Sep-12 2:42 
AnswerRe: using static library for C code in Visual studio 2005 Pin
jschell12-Sep-12 8:04
jschell12-Sep-12 8:04 
GeneralRe: using static library for C code in Visual studio 2005 Pin
Malli_S12-Sep-12 20:01
Malli_S12-Sep-12 20:01 

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.