Want to protect your cyber security and still get fast solutions? Ask a secure question today.Go Premium

x
  • Status: Solved
  • Priority: Medium
  • Security: Public
  • Views: 411
  • Last Modified:

VC++: keeping the application window in foreground

I want to to keep the dialog box in foreground like the Windows NT Task Manager Window.
0
m3
Asked:
m3
  • 4
  • 3
1 Solution
 
m3Author Commented:
Edited text of question
0
 
MikeP090797Commented:
Use:
SetWindowPos(hWnd, HWND_TOPMOST, 0,0,0,0, SWP_NOMOVE | SWP_NOSIZE
0
 
m3Author Commented:
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.
0
Independent Software Vendors: We Want Your Opinion

We value your feedback.

Take our survey and automatically be enter to win anyone of the following:
Yeti Cooler, Amazon eGift Card, and Movie eGift Card!

 
MikeP090797Commented:
If you are using MFC, the m_hWnd member contains the window handle.
0
 
m3Author Commented:
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.

0
 
MikeP090797Commented:
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
0
 
m3Author Commented:
Finally, it works.
Thanks.
0

Featured Post

Free Tool: Site Down Detector

Helpful to verify reports of your own downtime, or to double check a downed website you are trying to access.

One of a set of tools we are providing to everyone as a way of saying thank you for being a part of the community.

  • 4
  • 3
Tackle projects and never again get stuck behind a technical roadblock.
Join Now