Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations strongm on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Modeless dialog

Status
Not open for further replies.

nimberg

Programmer
Sep 14, 2000
8
IL
i need to use a Modeless dialog box to show an importent
message!
i use the folling code
CWnd Dig;
CWnd *pWnd = new CWnd;
pWnd->CreateEx(WS_EX_CLIENTEDGE,_T("STATIC"),"Prosses is..",
WS_CHILD |WS_POPUP|WS_CAPTION | WS_VISIBLE,310,
310,160,100,m_hWnd,(HMENU)1234);
and i cant move the dialog box at all and i need to be able to do so (how ?
...) !
i need it to be without no batuns....
and i need to know how to use the distroywindow to kill it
wen i need to !
plz.....help me :)


[sig][/sig]
 
I think you should use the CDialog class instead of the CWnd one. To create a modeless dialog box, I did that :
CDialog optionDlg;

optionDlg.Create(resource_id,hWnd);

But you need to have a resource ID. This works in my application.
 
If this is a student project, I might be accused of giving you too much of the solution, but since I have gotten some help here, I make this contribution. Similar to the previous response, if you have declared CMyDialog as derived from CDialog, and you have created a dialog resource, calling it, in this case IDD_MYRESOURCE, your code might look somthing like this:

CMyDialog* pDlg;

void CMainWindow::OnShowDlg()
{
if(pDlg != NULL)
{
pDlg->SetFocus();
return;
}
pDlg = new MyDialog;
pDlg->Create(IDD_MYRESOURCE, this);
}

void CMyDialog::OnCancel()
{
DestroyWindow();
}
Since you say your dialog will not have any buttons, instead of the OnCancel() function, I suppose you could call pDlg->EndDialog(int n), although I have not tried this. By the way, this example comes, in large part, from Windows with MFC, by Prosise, a very valuable text for those learning MFC and VC++. [sig][/sig]
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top