Howdy all and anyone who cares to read this. I was hoping you could help me with one small issue I am having. OK to cut a long story short...
I need to be able to search through all running process.id and then sendmessage(hwnd, blah,blah, MIN_WINDOW);
In other words I need find notepad by name in the running processes and then get the Handle. Then send message to that handle to minimize the window or Set the Window Position.
Now my problem is that when I get the Handle using:
string pname="notepad";
foreach (Process theprocess in Myprocess)
{
if (theprocess.ProcessName == pname)
{
textBox1.Text = theprocess.Id.ToString();
//_________________________________//
AS you can see that the textbox1.text will show that the handle value(process.id) is an int. Now when I pass it to the showwindows(hwnd.......). It's not the Hexadecimal value so it doesn’t exist...It seem that when it's pulled using the Process[] method it converts it to a short type of Int. Please is there away to collect the Process.Id and the pass it to Handle name as Hex...
int handle = 0x00D7A;
postmessage(handle, WM_SYSCOMMAND, SC_MINIMIZE, 0);
Now this would work if a window with that PID exist...Which It did AS I used WinSpy to get the value for notepad then check it and it worked...but soon as I pass the handle via the above collected method it only pass a short version of the handle. I need to convert it to HEX to pass it. Please can you point me in the right direction...?
Cheers
Sound