|
-
Nov 29th, 2002, 08:05 AM
#1
Thread Starter
Addicted Member
single instance of dialog
how to display non modal dialog only one time?
I mean if it is alraady open the not to create the dialog.
-
Nov 29th, 2002, 03:27 PM
#2
Junior Member
Are You using VC?
You just have to set Your Dlg-ptr to NULL (e.g. in the ctor) and then check, if it is valid:
Code:
if (!m_pDlg)
{
m_pDlg = new Dlg1;
m_pDlg->Create(IDD_DIALOG1, this);
}
m_pDlg->ShowWindow(SW_SHOW);
(Don't forget to delete the ptr. in the dtor!)
Is that what You want?
Mikey
-
Dec 1st, 2002, 05:43 PM
#3
And if you're using pure API (which would be better!) here's the equivalent code:
Code:
HWND g_hDlg = NULL;
//...
if(!g_hDlg) {
g_hDlg = CreateDialog(hInstance, MAKEINTRESOURCE(IDD_YOURDIALOG), hwnd, DlgProc);
}
All the buzzt
 CornedBee
"Writing specifications is like writing a novel. Writing code is like writing poetry."
- Anonymous, published by Raymond Chen
Don't PM me with your problems, I scan most of the forums daily. If you do PM me, I will not answer your question.
-
Dec 5th, 2002, 12:55 AM
#4
Thread Starter
Addicted Member
-
Dec 5th, 2002, 03:54 AM
#5
Thread Starter
Addicted Member
if (!m_pDlg)
{
m_pDlg = new Dlg1;
m_pDlg->Create(IDD_DIALOG1, this);
}
m_pDlg->ShowWindow(SW_SHOW);
if (!&m_pDlg)
{
m_pDlg = new Dlg1;
m_pDlg->Create(IDD_DIALOG1, this);
}
m_pDlg->ShowWindow(SW_SHOW);
Both of these codes give error in if statement.
it works without pointer
if (!m_pDlg)
{
m_pDlg.Create(IDD_DIALOG1, this);
}
m_pDlg.ShowWindow(SW_SHOW);
but how to work using pointer?
Posting Permissions
- You may not post new threads
- You may not post replies
- You may not post attachments
- You may not edit your posts
-
Forum Rules
|
Click Here to Expand Forum to Full Width
|