Advertisement

VisualC bug?! (DialogBox)

Started by January 06, 2001 10:16 AM
5 comments, last by Sludge 24 years ago
It seems that I can''t create normal dialogboxes anymore. Bugs appear like you can''t drag the window, can''t click on the close button and when calling the MessageBox() function inside the Dialogbox, both windows will be disabled, and can''t be activated. Anyone has experienced these problems? Sludge Software www.sludgesoft.com Developing a secret of mana style role-playing-game
Sludge Softwarewww.sludgesoft.comDeveloping a secret of mana style role-playing-game
I doubt it''s a bug. It''s either your installation of MSVC is messed up, or you''ve just messed up some code.

Post the code (snippets of it, please) and we''ll see.
==========================================In a team, you either lead, follow or GET OUT OF THE WAY.
Advertisement
Ok, here is the source (all of it ;-))

  #include <windows.h>#include "resource.h"int WINAPI MsgHandler(HWND hwnd,UINT msg,WPARAM wparam,LPARAM lparam){   if (msg==WM_COMMAND) MessageBox(hwnd,"test","test",0);   return(DefWindowProc(hwnd,msg,wparam,lparam));};int WINAPI WinMain(HINSTANCE hInstance,HINSTANCE hPrevInstance,LPSTR lpCmdLine,int nShowCmd){   DialogBox(hInstance,MAKEINTRESOURCE(IDD_MAIN),NULL,MsgHandler);   return(0);};  


Sludge Software
www.sludgesoft.com
Developing a secret of mana style role-playing-game
Sludge Softwarewww.sludgesoft.comDeveloping a secret of mana style role-playing-game
And where''s the message pump??? If you start spawning message boxes from your message handlers your message queue will stall without one...

Jans.
That particular instance doesn''t need a message pump. But the way you have your message handler set up is wrong. First, it needs to return a BOOL. Second, don''t call DefWindowProc, return FALSE. Return TRUE if you handled a message though. Third, you have to handle WM_CLOSE and such so the dialog WILL close when told to.

Visit my site!
Hmm, strange, in another program I written some time ago, that code would work.
I changed it now, and it works. Thanks.

Sludge Software
www.sludgesoft.com
Developing a secret of mana style role-playing-game
Sludge Softwarewww.sludgesoft.comDeveloping a secret of mana style role-playing-game
Advertisement
That code would only work if you were creating a regular window.

This topic is closed to new replies.

Advertisement