Click here to Skip to main content
16,007,472 members
Home / Discussions / C / C++ / MFC
   

C / C++ / MFC

 
GeneralRe: Why does creating a static window from a console app cause havok? Pin
David Crow19-Jul-05 6:10
David Crow19-Jul-05 6:10 
GeneralRe: Why does creating a static window from a console app cause havok? Pin
IGx8919-Jul-05 7:03
IGx8919-Jul-05 7:03 
GeneralRe: Why does creating a static window from a console app cause havok? Pin
David Crow19-Jul-05 7:32
David Crow19-Jul-05 7:32 
GeneralRe: Why does creating a static window from a console app cause havok? Pin
Trollslayer19-Jul-05 6:11
mentorTrollslayer19-Jul-05 6:11 
GeneralRe: Why does creating a static window from a console app cause havok? Pin
IGx8919-Jul-05 7:05
IGx8919-Jul-05 7:05 
GeneralRe: Why does creating a static window from a console app cause havok? Pin
Trollslayer19-Jul-05 7:35
mentorTrollslayer19-Jul-05 7:35 
GeneralRe: Why does creating a static window from a console app cause havok? Pin
David Crow19-Jul-05 7:49
David Crow19-Jul-05 7:49 
GeneralRe: Why does creating a static window from a console app cause havok? Pin
James Brown19-Jul-05 7:56
James Brown19-Jul-05 7:56 
I don't believe that resource-ids are the problem:

The control/resource-id is specified as the 10th parameter to CreateWindowEx.
The STATIC you are seeing is the name of the window-class to create a window from - in this case, a static-control - so no problem there.
Changing the text to _STATIC_ results in an invalid class-name and CreateWindowEx fails (returns NULL) so no window is created.

I think the problem with the program is that a console-program does not run a message-pump, so it cannot receive or process windows messages. So all messages destined for the STATIC control do not get processed and the program/Windows hangs indefinitely.

Solution: create separate thread to handle the GUI and create a message-pump (GetMessage/DispatchMessage) to handle GUI messages.

or better yet, use a GUI program that's what they're meant for.

James


http://www.catch22.net

GeneralRe: Why does creating a static window from a console app cause havok? Pin
IGx8919-Jul-05 9:34
IGx8919-Jul-05 9:34 
Generalfread crash Pin
sfeldi19-Jul-05 4:40
sfeldi19-Jul-05 4:40 
GeneralRe: fread crash Pin
David Crow19-Jul-05 5:28
David Crow19-Jul-05 5:28 
GeneralRe: fread crash Pin
Chris Losinger19-Jul-05 6:48
professionalChris Losinger19-Jul-05 6:48 
GeneralRe: fread crash Pin
David Crow19-Jul-05 7:17
David Crow19-Jul-05 7:17 
GeneralRe: fread crash Pin
Chris Losinger19-Jul-05 7:30
professionalChris Losinger19-Jul-05 7:30 
GeneralRe: fread crash Pin
David Crow19-Jul-05 7:40
David Crow19-Jul-05 7:40 
GeneralRe: fread crash Pin
Chris Losinger19-Jul-05 8:03
professionalChris Losinger19-Jul-05 8:03 
GeneralRe: fread crash Pin
David Crow19-Jul-05 8:52
David Crow19-Jul-05 8:52 
GeneralRe: fread crash Pin
Chris Losinger19-Jul-05 9:27
professionalChris Losinger19-Jul-05 9:27 
GeneralRe: fread crash Pin
sfeldi19-Jul-05 20:39
sfeldi19-Jul-05 20:39 
GeneralRe: fread crash Pin
sfeldi19-Jul-05 21:09
sfeldi19-Jul-05 21:09 
GeneralRe: fread crash Pin
Chris Losinger20-Jul-05 1:11
professionalChris Losinger20-Jul-05 1:11 
GeneralRe: fread crash Pin
sfeldi19-Jul-05 20:38
sfeldi19-Jul-05 20:38 
QuestionTextOut being clipped in Windows 2000? Pin
MacWarrior19-Jul-05 3:10
MacWarrior19-Jul-05 3:10 
AnswerRe: TextOut being clipped in Windows 2000? Pin
David Crow19-Jul-05 3:21
David Crow19-Jul-05 3:21 
GeneralReading REG_SZ from Win registry Pin
rudoq3219-Jul-05 3:09
rudoq3219-Jul-05 3:09 

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.