Solved

Sending a message to a process

Posted on 2000-04-19
3
186 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
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

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

Title # Comments Views Activity
Should CArray be used for a list of pointers in C++? 19 97
dialer.exe 4 58
Using MS Code on my Mac 6 66
SSRS troubles 4 23
For most people, the WrapPanel seems like a magic when they switch from WinForms to WPF. Most of us will think that the code that is used to write a control like that would be difficult. However, most of the work is done by the WPF engine, and the W…
A theme is a collection of property settings that allow you to define the look of pages and controls, and then apply the look consistently across pages in an application. Themes can be made up of a set of elements: skins, style sheets, images, and 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…

864 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

19 Experts available now in Live!

Get 1:1 Help Now