Solved

VC++: keeping the application window in foreground

Posted on 1998-08-06
7
377 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
Comment Utility
Edited text of question
0
 
LVL 8

Accepted Solution

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

Author Comment

by:m3
Comment Utility
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
Highfive Gives IT Their Time Back

Highfive is so simple that setting up every meeting room takes just minutes and every employee will be able to start or join a call from any room with ease. Never be called into a meeting just to get it started again. This is how video conferencing should work!

 
LVL 8

Expert Comment

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

Author Comment

by:m3
Comment Utility
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
Comment Utility
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
Comment Utility
Finally, it works.
Thanks.
0

Featured Post

How to run any project with ease

Manage projects of all sizes how you want. Great for personal to-do lists, project milestones, team priorities and launch plans.
- Combine task lists, docs, spreadsheets, and chat in one
- View and edit from mobile/offline
- Cut down on emails

Join & Write a Comment

When writing generic code, using template meta-programming techniques, it is sometimes useful to know if a type is convertible to another type. A good example of when this might be is if you are writing diagnostic instrumentation for code to generat…
Templates For Beginners Or How To Encourage The Compiler To Work For You Introduction This tutorial is targeted at the reader who is, perhaps, familiar with the basics of C++ but would prefer a little slower introduction to the more ad…
The goal of the tutorial is to teach the user how to use functions in C++. The video will cover how to define functions, how to call functions and how to create functions prototypes. Microsoft Visual C++ 2010 Express will be used as a text editor an…
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…

728 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

Need Help in Real-Time?

Connect with top rated Experts

11 Experts available now in Live!

Get 1:1 Help Now