Hey
so as i mentioned here http://www.daniweb.com/forums/post840142.html i need to check if a process is responding by using sendmessage
however i have no idea how to get the hwnd because i start the process using system::diagnostics::process

process->StartInfo->WorkingDirectory=sinfo->workingDirectory;
	   process->StartInfo->Arguments=" -exec "+sinfo->init+" -port "+sinfo->port+" "+sinfo->options;
	   process->StartInfo->FileName = sinfo->exe;
	   process->StartInfo->UseShellExecute=true;

so this program starts in a console, so does it not have a handle?

its a really weird program... a halo server, the program takes over the console window.... so is it possible to send it a message?

how do i get the hwnd from pid?
process->Mainwindowtitle and mainwindowhandle dont return anything

yea im confusing myself... understand?

Recommended Answers

All 4 Replies

how do i get the thread id?

use CreateProcess() instead of ShellExecute(). CreateProcess() will return a structure that contains the information you need.

I'm not a .NET programmer but according to the documentation:

IntPtr hwnd = process->Handle;

Which compiles successfully as a CLR console program.

Be a part of the DaniWeb community

We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, networking, learning, and sharing knowledge.