?
Solved

Activating a window from another process in NT 4.0

Posted on 1997-10-29
2
Medium Priority
?
264 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
[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 3

Accepted Solution

by:
vinniew earned 300 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

Free Tool: Port Scanner

Check which ports are open to the outside world. Helps make sure that your firewall rules are working as intended.

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

What my article will show is if you ever had to do processing to a listbox without being able to just select all the items in it. My software Visual Studio 2008 crystal report v11 My issue was I wanted to add crystal report to a form and show…
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…
This is my first video review of Microsoft Bookings, I will be doing a part two with a bit more information, but wanted to get this out to you folks.

777 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