Jump to content
  • Advertisement
Sign in to follow this  
Hassanbasil

little WinAPI problem

This topic is 3050 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

Hello, everyone! I'm trying to make a dialog box ( using a resource ) with CreateDialogA, i got it working properly except one little problem, my main ( parent ) window is not responding for "X" (close button), windows is not sending a message when X is clicked, i also cant access the menu bar, its "disabled", why is that? ( note that all these effects disappear when i destroy the dialog ( or don't create it at all ) )

Share this post


Link to post
Share on other sites
Advertisement
er.. Maybe I misunderstand something, but that's the intent of a dialog box. You are forced to deal with it.

Share this post


Link to post
Share on other sites
You're probably using the API call DialogBox(), right? DialogBox() box creates a modal dialog which means it disables its owner window.

If you don't want a modal, use CreateDialog() instead of DialogBox().

If you do want a modal but not quite as locked down as the modal state created by DialogBox(), you can implement a DoModalDialog() function yourself by calling CreateDialog() and then going into a message loop inside of your DoModalDialog() function.

Share this post


Link to post
Share on other sites
Hello, sorry for the late reply,

i'm making the dialog with CreateDialog, actually, it locks parent, but not other childs, all i want is a dialog that acts as a toolbar, like, it can be used without locking any other windows

EDIT: some code

//.rc file
ID_DLG_FUNC DIALOGEX 0, 0, 194, 314
STYLE WS_POPUP
FONT 8, "MS Shell Dlg", 400, 0, 0x1
BEGIN
GROUPBOX "Function", ID_FUNCGRP, 5, 5, 180, 60
EDITTEXT ID_FUNCTXT, 15, 20, 160, 15
DEFPUSHBUTTON "Insert Function", ID_INSERTFUNC, 15, 40, 160, 15
END

//.cpp
funcWnd = CreateDialogA( NULL, MAKEINTRESOURCEA ( ID_DLG_FUNC ), ParentWnd, (DLGPROC)FuncProc );
if ( !funcWnd )
{
MessageBoxA ( NULL, "Unable to create function window", _APPNAME_, MB_OK );
exit ( 0 );
}

//...
//...
LRESULT CALLBACK FuncProc ( HWND hWnd, UINT message, WPARAM wParam, LPARAM lParam )
{
return DefWindowProcA ( hWnd, message, wParam, lParam );
}

Share this post


Link to post
Share on other sites
If you want to make a window like a toolbar, then you can create a seperate window useing CreateWindowEx and using WS_EX_TOOLWINDOW as the dwExstyle parameter. You will probably need to register a new window class and possibly have a seperate window procedure for it.

Share this post


Link to post
Share on other sites
Quote:
Original post by Hassanbasil
Hello, sorry for the late reply,

i'm making the dialog with CreateDialog, actually, it locks parent, but not other childs, all i want is a dialog that acts as a toolbar, like, it can be used without locking any other windows

EDIT: some code
*** Source Snippet Removed ***


I think that you shouldn't be calling DefWindowProc from a dialog box procedure. In FuncProc(), try just returning FALSE instead, which I think tells windows, "I'm not handling this message, so do default handling of it."

Share this post


Link to post
Share on other sites
Quote:
Original post by jwezorek
Quote:
Original post by Hassanbasil
Hello, sorry for the late reply,

i'm making the dialog with CreateDialog, actually, it locks parent, but not other childs, all i want is a dialog that acts as a toolbar, like, it can be used without locking any other windows

EDIT: some code
*** Source Snippet Removed ***


I think that you shouldn't be calling DefWindowProc from a dialog box procedure. In FuncProc(), try just returning FALSE instead, which I think tells windows, "I'm not handling this message, so do default handling of it."


that is exactly what i was looking for, thanks man!

Share this post


Link to post
Share on other sites
Sign in to follow this  

  • 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!