Of course. But only one dialog will be enabled, if You do not override DoModal() to enable another Dialogs. You should allways think, which Window must be parent for Your Dialog (deafult CDialog() constructor uses window from which You start the dialog).
At this point, this first dialog appear being my main window. From this dialog I have some buttons that once pushed, link with others Dialogs windows where I need to get or show some information. So, I do not know how I can open a new Dialog Window within my main Dialog window.
Derive Your dialog from new class, for example CMyDialog, which has only one function DoModal() overrided. The best way, copy this function from CDialog source code. In this code You will find next lines:
How can I get CDialog:oModal() source code to override the mine?
A simple comment is that the bEnableParent variable is declared, inicializated but not used. Whay should I do with it?
Another thing that I havent mentioned is that I am programming for the Windows CE 3.0 and the function AfxUnhookWindowCreate() doesnt appear. Do you know if there is any other equivalent?
Please if you had a complete source code example about this topic, could send it to me?
Thanks.
The source is in File dlgcore.cpp (You must have MFC - libraries installed to have this file).
Original function DoModal() from dlgcore.cpp:
int CDialog:oModal()
{
// can be constructed with a resource template or InitModalIndirect
ASSERT(m_lpszTemplateName != NULL || m_hDialogTemplate != NULL ||
m_lpDialogTemplate != NULL);
// unlock/free resources as necessary
if (m_lpszTemplateName != NULL || m_hDialogTemplate != NULL)
UnlockResource(hDialogTemplate);
if (m_lpszTemplateName != NULL)
FreeResource(hDialogTemplate);
return m_nModalResult;
}
bEnableParent was in original source code. You can use it for disabling/enabling Your windows or comment it out.
AfxUnhookWindowCreate() You can try to comment out, if You can't use it on Your plattform.
It is not too easy at all. I have used it for an application, but I'm afraid, if I send You code I used, You will have more Questions. Please, You can see it:
int CShowDlg:oModal()
{
// can be constructed with a resource template or InitModalIndirect
ASSERT(m_lpszTemplateName != NULL || m_hDialogTemplate != NULL ||
m_lpDialogTemplate != NULL);
// return -1 in case of failure to load the dialog template resource
if (lpDialogTemplate == NULL) {
afxCurrentInstanceHandle=hInstSave;
AfxSetResourceHandle(hInstSave);
return -1;
}
HWND hWndParent = PreModal();
AfxUnhookWindowCreate();
CWnd* pParentWnd = CWnd::FromHandle(hWndParent);
// BOOL bEnableParent = FALSE;
//Disable only main Window
if(AfxGetMainWnd()) {
if:IsWindowEnabled( AfxGetMainWnd()->m_hWnd)) {
//Disable Main Window
::EnableWindow( AfxGetMainWnd()->m_hWnd, FALSE);
}
}
//Enable Parent
if (hWndParent != NULL /*&& ::IsWindowEnabled(hWndParent)*/)
{
Could you tell me who can I change the font, the background color of Label, CEdit,.... ?
How can differ in propoerties of this kind two differents Labels? I can not find each particular properties to change it. Maybe I am working on Windows CE.
In Visual Basic is easier the way of changing this properties.
This site uses cookies to help personalise content, tailor your experience and to keep you logged in if you register.
By continuing to use this site, you are consenting to our use of cookies.