Want to win a PS4? Go Premium and enter to win our High-Tech Treats giveaway. Enter to Win

x
?
Solved

Activating Applications

Posted on 2002-07-24
2
Medium Priority
?
279 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 400 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

Fill in the form and get your FREE NFR key NOW!

Veeam® is happy to provide a FREE NFR server license to certified engineers, trainers, and bloggers.  It allows for the non‑production use of Veeam Agent for Microsoft Windows. This license is valid for five workstations and two servers.

Question has a verified solution.

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

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…
A theme is a collection of property settings that allow you to define the look of pages and controls, and then apply the look consistently across pages in an application. Themes can be made up of a set of elements: skins, style sheets, images, and o…
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…
In a question here at Experts Exchange (https://www.experts-exchange.com/questions/29062564/Adobe-acrobat-reader-DC.html), a member asked how to create a signature in Adobe Acrobat Reader DC (the free Reader product, not the paid, full Acrobat produ…

618 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