Solved

Activating Applications

Posted on 2002-07-24
2
270 Views
Last Modified: 2013-12-03
I'm trying to get my application to activate itself, to produce the same effect as clicking on its button in the taskbar.

However, I've tried all of the following APIs, and none of them seem to achieve this effect:

SetActiveWindow
SetForegroundWindow
SetWindowPos
BringWindowToTop
SetFocus

How is this supposed to be done?
0
Comment
Question by:scce
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
2 Comments
 
LVL 8

Accepted Solution

by:
fl0yd earned 100 total points
ID: 7176240
Did you try

::ShowWindow( hWnd, SW_RESTORE );
::SetForegroundWindow( hWnd );

? This probably won't work on win2k for security reasons. The call to SetForegroundWindow will be replaced by the sequence SetActiveWindow/FlashWindowEx. I haven't tried it myself, but the MSDN states a long list of conditions that need to be met in order for SetForegroundWindow to work as expected.
0
 

Author Comment

by:scce
ID: 7178769
Hi fl0yd,

Thanks for the comment and the pointer to the msdn article, it explained everything.  You were right, when I used SetForegroundWindow I was just getting a taskbar flash (using XP).

I was actually trying to activate the app in response to a call from its Help File via a custom DLL.  So, now I get the DLL (under the foreground thread from the Help File) to activate it before I send the notification message.

Easy!  Thanks again.
0

Featured Post

Free Tool: Site Down Detector

Helpful to verify reports of your own downtime, or to double check a downed website you are trying to access.

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

In this article, I will show how to use the Ribbon IDs Tool Window to assign the built-in Office icons to a ribbon button.  This tool will help us to find the OfficeImageId that corresponds to our desired built-in Office icon. The tool is part of…
Whether you've completed a degree in computer sciences or you're a self-taught programmer, writing your first lines of code in the real world is always a challenge. Here are some of the most common pitfalls for new programmers.
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…
Michael from AdRem Software outlines event notifications and Automatic Corrective Actions in network monitoring. Automatic Corrective Actions are scripts, which can automatically run upon discovery of a certain undesirable condition in your network.…

726 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