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 Chris Miller on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Modeless dialog behind main window 1

Status
Not open for further replies.

philrosenberg

Technical User
Dec 3, 2003
15
GB
Hi,
I'm fairly new to programming for windows and am having some trouble with modeless dialogs.
I've created and shown a modeless dialog, but when the main application is given the focus it moves in front of the dialog wheras I want the dialog to stay in front, also the dialog box has its own button on the status bar, which I don't want.

I am declaring the dialog as a public variable in the view class

public:
CTestDlg m_DlgTest;

then creating the dialog in the View constructor

CProgramView::CProgramView()
{
m_DlgTest.Create(IDD_TEST, this);
m_DlgTest.ShowWindow(SW_SHOW);
}

Any ideas anyone?

Any help would be greatly appreciated

Phil
 
Use the SetWindowPos method, with the second parameter set to HWND_TOPMOST

(MSDN: "Places the window above all non-topmost windows. The window maintains its topmost position even when it is deactivated.")

Prototype:

BOOL SetWindowPos(HWND hWnd, HWND hWndInsertAfter, int X, int Y, int cx, int cy, UINT uFlags );
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top