little WinAPI problem
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 ) )
er.. Maybe I misunderstand something, but that's the intent of a dialog box. You are forced to deal with it.
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.
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.
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
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 fileID_DLG_FUNC DIALOGEX 0, 0, 194, 314STYLE WS_POPUPFONT 8, "MS Shell Dlg", 400, 0, 0x1BEGIN GROUPBOX "Function", ID_FUNCGRP, 5, 5, 180, 60 EDITTEXT ID_FUNCTXT, 15, 20, 160, 15 DEFPUSHBUTTON "Insert Function", ID_INSERTFUNC, 15, 40, 160, 15END//.cppfuncWnd = 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 );}
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.
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."
Quote:Original post by jwezorekQuote: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!
This topic is closed to new replies.
Advertisement
Popular Topics
Advertisement