Link to home
Start Free TrialLog in
Avatar of m3
m3

asked on

VC++: keeping the application window in foreground

I want to to keep the dialog box in foreground like the Windows NT Task Manager Window.
Avatar of m3
m3

ASKER

Edited text of question
ASKER CERTIFIED SOLUTION
Avatar of MikeP090797
MikeP090797

Link to home
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
Start Free Trial
Avatar of m3

ASKER

I still doesn't know how I can get the first parameter which is the handle to my window. I tried GetWindow but it still struggling with it.
If you are using MFC, the m_hWnd member contains the window handle.
Avatar of m3

ASKER

How I couldn't get  this parameter in InitInstance, may be because my window is related a my view Class and I don't know how I can export it to App class.
I tried to implemented directly in my view class but because the View Class drives from CWnd it understands that I'm using Cwnd:SetWindowPos which is a different function.

Add :: before SetWindowPos
::SetWindowPos

CWnd::SetWindowPos is exactly the same function as the ::SetWindowPos, but you don't have to specify the window handle, it takes it automaticly from m_hWnd. IF your window is a dialog, do it in the OnInitDialog member
Avatar of m3

ASKER

Finally, it works.
Thanks.