| CodeGuru Home | VC++ / MFC / C++ | .NET / C# | Visual Basic | Newsletters | VB Forums | Developer.com |
|
|||||||
| Visual C++ Programming Ask questions about Windows programming with Visual C++ and help others by answering their questions. |
![]() |
|
|
Thread Tools | Search this Thread | Rate Thread | Display Modes |
|
#1
|
|||
|
|||
|
Create hidden SDI application
Hi,
I need to create a single document instance(SDI) application to initialize hidden. but when I remove show window and update window lines, the application initialize main window visible. How can I do it ?!? CSingleDocTemplate* pDocument = new CSingleDocTemplate(IDR_MAINFRAME, RUNTIME_CLASS(MyDocument), RUNTIME_CLASS(MyMainFrame), RUNTIME_CLASS(MyView)); MyView = CFormView MyMainFrame = CMainFrame MyDocument = CDocument Thanks in advance, |
|
#2
|
|||
|
|||
|
Re: Create hidden SDI application
Note: this is with VS2005 and MFC9; YMMV.
In your main app class, in InitInstance() modify as so: Near the beginning (you really only need to do this once as it will remain in the registry thereafter): Code:
SetRegistryKey(_T("Local AppWizard-Generated Applications"));
LoadStdProfileSettings(4); // Load standard INI file options (including MRU)
CRect r;
int flg,shc;
LoadWindowPlacement(r,flg,shc);
StoreWindowPlacement(r,flg,SW_HIDE);
InitContextMenuManager();
Code:
if (!ProcessShellCommand(cmdInfo)) return FALSE; // The one and only window has been initialized, so show and update it m_pMainWnd->ShowWindow(SW_HIDE); m_pMainWnd->UpdateWindow(); // call DragAcceptFiles only if there's a suffix // In an SDI app, this should occur after ProcessShellCommand Code:
void CMainFrame::ActivateFrame(int nCmdShow)
{
// TODO: Add your specialized code here and/or call the base class
CFrameWndEx::ActivateFrame(SW_HIDE);
}
|
|
#3
|
|||
|
|||
|
Re: Create hidden SDI application
thanks,
work perfectly |
![]() |
| Bookmarks |
|
||||||
| Thread Tools | Search this Thread |
| Display Modes | Rate This Thread |
|
|