Solved

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

Posted on 2009-03-31
2
353 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

Maximize Your Threat Intelligence Reporting

Reporting is one of the most important and least talked about aspects of a world-class threat intelligence program. Here’s how to do it right.

Join & Write a Comment

After several hours of googling I could not gather any information on this topic. There are several ways of controlling the USB port connected to any storage device. The best example of that is by changing the registry value of "HKEY_LOCAL_MACHINE\S…
For a while now I'v been searching for a circular progress control, much like the one you get when first starting your Silverlight application. I found a couple that were written in WPF and there were a few written in Silverlight, but all appeared o…
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…

706 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

14 Experts available now in Live!

Get 1:1 Help Now