Solved

VC++: keeping the application window in foreground

Posted on 1998-08-06
7
390 Views
Last Modified: 2010-05-18
I want to to keep the dialog box in foreground like the Windows NT Task Manager Window.
0
Comment
Question by:m3
  • 4
  • 3
7 Comments
 

Author Comment

by:m3
ID: 1169562
Edited text of question
0
 
LVL 8

Accepted Solution

by:
MikeP090797 earned 50 total points
ID: 1169563
Use:
SetWindowPos(hWnd, HWND_TOPMOST, 0,0,0,0, SWP_NOMOVE | SWP_NOSIZE
0
 

Author Comment

by:m3
ID: 1169564
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!

 
LVL 8

Expert Comment

by:MikeP090797
ID: 1169565
If you are using MFC, the m_hWnd member contains the window handle.
0
 

Author Comment

by:m3
ID: 1169566
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
 
LVL 8

Expert Comment

by:MikeP090797
ID: 1169567
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
 

Author Comment

by:m3
ID: 1169568
Finally, it works.
Thanks.
0

Featured Post

On Demand Webinar - Networking for the Cloud Era

This webinar discusses:
-Common barriers companies experience when moving to the cloud
-How SD-WAN changes the way we look at networks
-Best practices customers should employ moving forward with cloud migration
-What happens behind the scenes of SteelConnect’s one-click button

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Suggested Solutions

Title # Comments Views Activity
C++ Language error 28 279
Best book to learn C++ 4 87
Eclipse IDE - Cannot copy/paste from console output 8 310
Header of docx file 17 129
Article by: SunnyDark
This article's goal is to present you with an easy to use XML wrapper for C++ and also present some interesting techniques that you might use with MS C++. The reason I built this class is to ease the pain of using XML files with C++, since there is…
Introduction This article is a continuation of the C/C++ Visual Studio Express debugger series. Part 1 provided a quick start guide in using the debugger. Part 2 focused on additional topics in breakpoints. As your assignments become a little more …
The goal of the video will be to teach the user the concept of local variables and scope. An example of a locally defined variable will be given as well as an explanation of what scope is in C++. The local variable and concept of scope will be relat…
The goal of the video will be to teach the user the difference and consequence of passing data by value vs passing data by reference in C++. An example of passing data by value as well as an example of passing data by reference will be be given. Bot…

763 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question