How to create a Dialog based Application with MainDlg hidden on startup 
Author Message
 How to create a Dialog based Application with MainDlg hidden on startup

No Content.

Best regards!



Wed, 16 Feb 2005 05:47:02 GMT  
 How to create a Dialog based Application with MainDlg hidden on startup
Are you talking about a dialog based application?  If so, how will you get
the Modal dialog back?  That's really none of my business, so here's how I'd
do it in a Dialog base app:

Create a USER message and call it using PostMessage in the dialog's
OnInitDialog function.  Then in the message handler, hide the window...  You
have to "post" the message so that the dialog initializes before it is
hidden.  If not, it will just be redisplayed when it finishes
initializing...  The code will look as follows:

In the Header of the Dialog Class:

 // Generated message map functions
 //{{AFX_MSG(CMyTestDlg)
 virtual BOOL OnInitDialog();
 afx_msg void OnPaint();
 afx_msg HCURSOR OnQueryDragIcon();
 //}}AFX_MSG
    afx_msg void OnHideWindow();  // ADD THIS LINE
 DECLARE_MESSAGE_MAP()

In the CPP File:

BEGIN_MESSAGE_MAP(CMyTestDlg, CDialog)
 //{{AFX_MSG_MAP(CMyTestDlg)
 ON_WM_PAINT()
 ON_WM_QUERYDRAGICON()
 //}}AFX_MSG_MAP
    ON_MESSAGE(WM_USER+1, OnHideWindow)  // ADD THIS LINE
END_MESSAGE_MAP()

/////////////////////////////////////////////////////////////////////
/////////////////////////////////////////////////////////////////////

 BOOL CMyTestDlg::OnInitDialog()
{
 CDialog::OnInitDialog();

 // Set the icon for this dialog.  The framework does this automatically
 //  when the application's main window is not a dialog
 SetIcon(m_hIcon, TRUE);   // Set big icon
 SetIcon(m_hIcon, FALSE);  // Set small icon

 // TODO: Add extra initialization here
    PostMessage(WM_USER+1);   // ADD THIS LINE

 return TRUE;  // return TRUE  unless you set the focus to a control

Quote:
}

/////////////////////////////////////////////////////////////////////
/////////////////////////////////////////////////////////////////////
// ADD THIS METHOD
void CMyTestDlg::OnHideWindow()
{
    ShowWindow(SW_HIDE);

Quote:
}

Hope this helps and good luck,
Chris


Quote:
> No Content.

> Best regards!



Wed, 16 Feb 2005 06:23:51 GMT  
 How to create a Dialog based Application with MainDlg hidden on startup
Heheh. So you want to start a modal dialog hidden, eh?
Take a look at the article below :-

http://www.codeproject.com/dialog/dlgboxtricks.asp

It has a section titled "Starting a modal dialog hidden"

Regards,
Nish



Wed, 16 Feb 2005 09:56:18 GMT  
 How to create a Dialog based Application with MainDlg hidden on startup
Thanks alot.


Wed, 16 Feb 2005 12:59:42 GMT  
 How to create a Dialog based Application with MainDlg hidden on startup
See here:

www.mooremvp.freeserve.co.uk/Win32/framed_tip026.htm

--
Bob Moore [WinSDK MVP]
http://www.mooremvp.freeserve.co.uk/
(this is a non-commercial site and does not accept advertising)
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
Do not reply via email unless specifically requested to do so.
Unsolicited email is NOT welcome and will go unanswered.
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~



Wed, 16 Feb 2005 15:03:13 GMT  
 How to create a Dialog based Application with MainDlg hidden on startup
Thanks alot, I've solved the problem.

I Create the Dialog myself instead of DoModal. And add a message loop after
dialog created.

CPP Codes:
////////////////////////////////////////////////////////////////////////////
////

BOOL CMyApp::InitInstance()
{
    ......
    m_pMainWnd = new CMyDlg;

    MSG msg;
    while (GetMessage(&msg, 0, 0, 0)) {
        TranslateMessage(&msg);
        DispatchMessage(&msg);
    }

    ......

Quote:
}



Fri, 18 Feb 2005 13:30:30 GMT  
 
 [ 6 post ] 

 Relevant Pages 

1. Hide dialog based app on startup

2. Hiding a dialog based app on startup

3. Dialog application and hiding on startup

4. Minimizing a dialog-based application on startup...?

5. Hide a dialog-based application on launching

6. Initially showing a dialog base application hidden - how?

7. Need help creating a dialog base application for 1.52

8. creating toolbar on a dialog based application.

9. Struggling Newbie:, Creating a dialog-based application from AppWizard

10. How to create an array of edit boxes in a dialog based application

11. How to create a RESIZABLE DIALOG-Based Application

12. Creating an View from dialog-based application.

 

 
Powered by phpBB® Forum Software