Solved

How to activate MDI program on TOP MOST (MFC)?

Posted on 2009-03-31
2
364 Views
Last Modified: 2013-12-03
I have MDI program, MFC, with one exe file, ex: mypro.exe

When I click mypro.exe, it run, and I program it to run one time only. (that is, when click second time or more to myprog.exe, it do not run because it's running already!)

But I want: when click second time or more, if IT not ON TOP MOST, It will become ON TOP MOST!

How to do that!

Thanks!
0
Comment
Question by:laptop1vn
2 Comments
 
LVL 19

Accepted Solution

by:
alb66 earned 500 total points
ID: 24030367
0
 
LVL 39

Expert Comment

by:itsmeandnobodyelse
ID: 24031571
>>>> when click second time or more, if IT not ON TOP MOST, It will become ON TOP MOST!

Before terminating your second instance you could send a WM_ACTIVATE message to the top level window of your first instance. You could get the hwnd of the first instance either by enumerating the processes or the top level windows. Or if you have a p2p connection to your first instance anyhow (depends on how you found out that a previous instance exists) you could use that p2p to trigger your predecessor to make itself topmost (normally a SetFocus or handling the WM_ACTIVATE should be sufficient to get it top-most).
0

Featured Post

Free Tool: IP Lookup

Get more info about an IP address or domain name, such as organization, abuse contacts and geolocation.

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.

Question has a verified solution.

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

Suggested Solutions

Title # Comments Views Activity
noX challenge 17 129
firstChar challenge 13 121
Need a complete list of ASP.NET page load events 3 59
reboot server with scheduled time and week base 4 34
Introduction: Ownerdraw of the grid button.  A singleton class implentation and usage. Continuing from the fifth article about sudoku.   Open the project in visual studio. Go to the class view – CGridButton should be visible as a class.  R…
For most people, the WrapPanel seems like a magic when they switch from WinForms to WPF. Most of us will think that the code that is used to write a control like that would be difficult. However, most of the work is done by the WPF engine, and the W…
This video will show you how to get GIT to work in Eclipse.   It will walk you through how to install the EGit plugin in eclipse and how to checkout an existing repository.
This is Part 3 in a 3-part series on Experts Exchange to discuss error handling in VBA code written for Excel. Part 1 of this series discussed basic error handling code using VBA. http://www.experts-exchange.com/videos/1478/Excel-Error-Handlin…

856 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