Re: Setting one modeless dialog on top of the other
I agree, it is redundant, but I'm trying to understand the problem.
To me, sibling windows should be able to go ontop of each other.
Here's the call from one window:
void CMainFrame::OnOpenProgram()
{
BOOL fSuccess;
SetCurrentDirectory(theApp.szHomeDirectory);
_tcscpy(szExtension, _T("\\*.PRG"));
SetupDLF(&vdlf, DLG_OPENDLG | DLG_NOOPEN | DLG_NOCHDIR, &vhFile,
szExtension, _T("Open Dialog Box"), _T("Open PRG"), szHelp);
switch(DlgFile(m_hWnd, &vdlf))
{
case TDF_ERRMEM:
case TDF_INVALID:
case TDF_NOOPEN:
fSuccess = FALSE;
break;
default:
fSuccess = TRUE;
break;
}
if (fSuccess)
load_prg(vdlf.szFileName, FALSE, m_hWnd);
}
load_prg has:
CProgramWnd * pProgramWnd = new CProgramWnd();
pProgramWnd->Create((CMDIFrameWnd *)AfxGetMainWnd(),
hwndOwner, ProgExecuteCommand, filename, fQuiet);
pProgramWnd->Initialize(execute,verbose);
pProgramWnd->SetFocus();
The other is opened (you might recognize this, as you're helping me
with this too):
CPrgEditorDialog* dlg = new CPrgEditorDialog;
dlg->ptrToMain = m_hWnd;
dlg->ShowWindow(SW_SHOW);
Both of these are launched from the same menu.
On Jul 30, 4:58 pm, "AliR \(VC++ MVP\)" <A...@online.nospam> wrote:
Are you calling SetForegroundWindow from within a WM_SETFOCUS handler?
I say that would be a little redundant.
Can you post any of the releavent code?
AliR.
I say it errors due to the msdn article which states:
CWnd::SetForegroundWindow
BOOL SetForegroundWindow( );
Return Value:
Nonzero if the function is successful; otherwise 0.
so I ran this in the setfocus():
this->SetForegroundWindow(); //returns 0 (which means error)
DWORD blah = GetLastError(); //returns 0 (which means no error?)
Which makes me really confused. Any ideas?- Hide quoted text -
- Show quoted text -