Solved

Activating a window from another process in NT 4.0

Posted on 1997-10-29
2
205 Views
Last Modified: 2013-12-03
How can I send WM_ACTIVATE window message to another processes' main window to tell it to activate itself in Windows NT 4.0.  I have the process information returned to me from CreateProcess() including the thread ID when I startup the other application.  Nothing I've tried seems to work.
0
Comment
Question by:ghessler
2 Comments
 
LVL 3

Accepted Solution

by:
vinniew earned 100 total points
ID: 1408023
You need to first enumerate all the windows in the desktop with EnumWindows and EnumWindowsProc API calls.  Then, if your application exists more than once, you'll have to associate a window handle with a thread ID (code available at www.ntinternals.com).  Then, when you're sure about the HWND, you can use the SendMessage API and do what you need to do.  

If you want to do this more easily, you could put a global data segment in both programs with something like:

#pragma data_seg("myapplication")
HWND gds_hWindowHandle;
#pragma

Then, in the initialization of the program you created, you could just do a:

gds_hWindowHandle = GetSafeHwnd();


The original program would be in a loop checking for a non-null value of gds_hWindowHandle, and would get it when its filled in.


If you have troubles, post more;

Vinnie

0
 

Author Comment

by:ghessler
ID: 1408024
The enum windows solution worked.  The global handle solution would work if I had control of both applications, but I don't.

Thanks,

Gary
0

Featured Post

Do You Know the 4 Main Threat Actor Types?

Do you know the main threat actor types? Most attackers fall into one of four categories, each with their own favored tactics, techniques, and procedures.

Join & Write a Comment

With most software applications trying to cater to multiple user needs nowadays, the focus is to make them as configurable as possible. For e.g., when creating Silverlight applications which will connect to WCF services, the service end point usuall…
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 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…
Access reports are powerful and flexible. Learn how to create a query and then a grouped report using the wizard. Modify the report design after the wizard is done to make it look better. There will be another video to explain how to put the final p…

746 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

12 Experts available now in Live!

Get 1:1 Help Now