Solved

Sending a message to a process

Posted on 2000-04-19
3
190 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
[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
3 Comments
 
LVL 5

Accepted Solution

by:
Wyn earned 50 total points
ID: 2730773
Try Thread32First() first and EnumThreadWindows()...

Regards
W.Yinan
0
 
LVL 6

Expert Comment

by:MichaelS
ID: 2733550
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
ID: 2734706
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

[Webinar] Learn How Hackers Steal Your Credentials

Do You Know How Hackers Steal Your Credentials? Join us and Skyport Systems to learn how hackers steal your credentials and why Active Directory must be secure to stop them. Thursday, July 13, 2017 10:00 A.M. PDT

Question has a verified solution.

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

This article shows a few slightly more advanced techniques for Windows 7 gadget programming, including how to save and restore user settings for your gadget and how to populate the "details" panel that is displayed in the Windows 7 gadget gallery.  …
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…
This is a high-level webinar that covers the history of enterprise open source database use. It addresses both the advantages companies see in using open source database technologies, as well as the fears and reservations they might have. In this…

728 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