Solved

Sending a message to a process

Posted on 2000-04-19
3
185 Views
Last Modified: 2013-12-03
I like to send a message to a process main window.
I can get the process id with Process32First etc but then I'd like to send that process a message, for that I need the handle of the main window.
So my question is: How do I get a handle to the main window from the process id?

0
Comment
Question by:LucHoltkamp
3 Comments
 
LVL 5

Accepted Solution

by:
Wyn earned 50 total points
Comment Utility
Try Thread32First() first and EnumThreadWindows()...

Regards
W.Yinan
0
 
LVL 6

Expert Comment

by:MichaelS
Comment Utility
If you know that process than you probably know the class of main window. If so you can use FindWindow() API.
0
 
LVL 3

Author Comment

by:LucHoltkamp
Comment Utility
Thanks for the reaction!
The problem with FindWindow is that MFC registrates the window class, and it's the same for all windows MFC creates....
So you can only select on Window title and that's not very reliable (the name changes in a SDI/MDI app).
Unfortunatly, it takes a lot of code to find the window, but it works and that is what counts...
0

Featured Post

Free Trending Threat Insights Every Day

Enhance your security with threat intelligence from the web. Get trending threat insights on hackers, exploits, and suspicious IP addresses delivered to your inbox with our free Cyber Daily.

Join & Write a Comment

This tutorial is about how to put some of your C++ program's functionality into a standard DLL, and how to make working with the EXE and the DLL simple and seamless.   We'll be using Microsoft Visual Studio 2008 and we will cut out the noise; that i…
If you have ever found yourself doing a repetitive action with the mouse and keyboard, and if you have even a little programming experience, there is a good chance that you can use a text editor to whip together a sort of macro to automate the proce…
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…

743 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

15 Experts available now in Live!

Get 1:1 Help Now