• Status: Solved
  • Priority: Medium
  • Security: Public
  • Views: 425
  • 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
The 14th Annual Expert Award Winners

The results are in! Meet the top members of our 2017 Expert Awards. Congratulations to all who qualified!

 
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
Question has a verified solution.

Are you are experiencing a similar issue? Get a personalized answer when you ask a related question.

Have a better answer? Share it in a comment.

Join & Write a Comment

Featured Post

Free Tool: Port Scanner

Check which ports are open to the outside world. Helps make sure that your firewall rules are working as intended.

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