Jump to content
  • Advertisement

Archived

This topic is now archived and is closed to further replies.

Jacob84

Win32 developing question on VS .NET

This topic is 5526 days old which is more than the 365 day threshold we allow for new replies. Please post a new topic.

If you intended to correct an error in the post then please contact us.

Recommended Posts

Hi everybody :D ... Just another question ''bout Win32 API developing with Visual Studio .NET. I will put an example, very simple I think, wich can be generated auto with the Win32 app wizard. It makes a window, with a menu, File , help & Info (ADDED, The last was mine :D). Then I build a dialog, very simple too, a window with and edit box and two buttons. Then I link the menu item(Info) with the dialog -> case IDM_INFO: DialogBox(hInst, (LPCTSTR)IDD_DIALOG1, hWnd, (DLGPROC)Info); The only problem is, that on the main app window, appears my dialog, but without window!!!, just two buttons and the edit over the main window!!!... I hope you understand... Thanks for reading, even if the question is stupid Jacob.

Share this post


Link to post
Share on other sites
Advertisement
May we see the function named ''Info''?
Your code suggests the problem is in there (more specifically ignoring the WM_PAINT message).

Share this post


Link to post
Share on other sites
Of course!...thanks for this fast answer...

Here is the code form the About Dialog, that is generated auto by the wizard->


// This is how it''s called->

case IDM_ABOUT:
DialogBox(hInst, (LPCTSTR)IDD_ABOUTBOX, hWnd, (DLGPROC)About);
//==================================

LRESULT CALLBACK About(HWND hDlg, UINT message, WPARAM wParam, LPARAM lParam)
{
switch (message)
{
case WM_INITDIALOG:
return TRUE;

case WM_COMMAND:
if (LOWORD(wParam) == IDOK || LOWORD(wParam) == IDCANCEL)
{
EndDialog(hDlg, LOWORD(wParam));
return TRUE;
}
break;
}
return FALSE;
}


As you can see, no WM_PAINT code is included, and it works ok... Let''s see now the function Info, but it''s almost "clean"


LRESULT CALLBACK Info(HWND hDlg, UINT message, WPARAM wParam, LPARAM lParam)
{
switch(message)
{
case WM_COMMAND:
EndDialog(hDlg,LOWORD(wParam));
return TRUE;
break;
}


Thanks a lot...

Share this post


Link to post
Share on other sites
I''m not sure about how dialog procs work, but it seems your message handler is missing the ''default'' case.

Try to call this in your message switch as default case:

LRESULT DefDlgProc(HWND hDlg,UINT Msg,WPARAM wParam,LPARAM lParam);

Look up on MSDN for more info

Share this post


Link to post
Share on other sites
Thanks Nik02:

It''s curious, with DefDlgProc, app exits automatically, but with DefWindowProc it appears correctly, but it''s impossible to move :D.

It''s a step... I will look on MSDN,

Thanks!!!

Share this post


Link to post
Share on other sites

  • Advertisement
×

Important Information

By using GameDev.net, you agree to our community Guidelines, Terms of Use, and Privacy Policy.

We are the game development community.

Whether you are an indie, hobbyist, AAA developer, or just trying to learn, GameDev.net is the place for you to learn, share, and connect with the games industry. Learn more About Us or sign up!

Sign me up!