Solved

Activating a window from another process in NT 4.0

Posted on 1997-10-29
2
218 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

Is Your Active Directory as Secure as You Think?

More than 75% of all records are compromised because of the loss or theft of a privileged credential. Experts have been exploring Active Directory infrastructure to identify key threats and establish best practices for keeping data safe. Attend this month’s webinar to learn more.

Question has a verified solution.

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

Suggested Solutions

As more and more people are shifting to the latest .Net frameworks, the windows presentation framework is gaining importance by the day. Many people are now turning to WPF controls to provide a rich user experience. I have been using WPF controls fo…
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 Micro Tutorial demonstrates using Microsoft Excel pivot tables, how to reverse engineer competitors' marketing strategies through backlinks.
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…

895 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