473,386 Members | 1,828 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,386 software developers and data experts.

Process.MainWindowHandle question

Hello,

When I execute the following code

Process* oProc;
IntPtr ipMain;
HWND hWnd;
oProc=Process::GetProcessById(m_IProcId);
ipMain=oProc->MainWindowHandle;
hWnd=(HWND)ipMain.ToPointer();

if(bEnable){ ShowWindow(hWnd, SW_SHOWNORMAL) }
else { ShowWindow(hWnd, SW_HIDE) }

Inside a thread that runs alongside the desired process (m_IProcId) it works
_fine_ the first time, that is when I call the SW_HIDE. When I then want to
reactivate this window when the thread ends, I get the _correct_ processId,
the process is still running (wmplayer.exe), but it says the window handle
(hWnd) is invalid ? How is this possible ?

Thanks in advance !
Nov 17 '05 #1
0 2591

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

1
by: Sanjay Seshasainam | last post by:
How can I maximize a process window I am using the Process class in System.Diagnostics. I can identify the specific process I want using the window title after that I want to maximize the...
4
by: | last post by:
Hi, In the Process class there is a CloseMainWindow, why is there not a BringMainWindowToForeground or similar method? What would be the best way to do this if we jsut have the process info...
2
by: Moty Michaely | last post by:
Hello all, I am enumerating vb6 process from c# application by name. I need to send message to all processes that has the specified name but for this purpose I need the handle of the main...
0
by: bamapookie | last post by:
I've written an app that starts and monitors a number of processes. If one of those processes dies, the app restarts it. One of the options I've written hides the main window of the monitored...
0
by: bamapookie | last post by:
I've written an app that starts and monitors a number of processes. If one of those processes dies, the app restarts it. One of the options I've written hides the main window of the monitored...
0
by: bamapookie | last post by:
I'm sorry if this was posted several times. I did not see my previous post appear after I posted it. I've written an app that starts and monitors a number of processes. If one of those...
1
by: bamapookie | last post by:
What is the best way to check and change the window state of a process given either a System.Diagnostics.Process or a MainWindowHandle? I was using the following commands, but hide is not working...
8
by: Shachar | last post by:
Hi All, I need to start a new process calc for example and when ever the user click on the button the application should setfocus to the calc application. I use this code but it is NOT...
1
by: codejunkie | last post by:
Hi, I am running a suite of tests of a WIN 32 application. Every test launches the same application, checks if the Application has a Main Window handle and then proceeds. However i am noticing...
0
by: taylorcarr | last post by:
A Canon printer is a smart device known for being advanced, efficient, and reliable. It is designed for home, office, and hybrid workspace use and can also be used for a variety of purposes. However,...
0
by: Charles Arthur | last post by:
How do i turn on java script on a villaon, callus and itel keypad mobile phone
0
by: ryjfgjl | last post by:
If we have dozens or hundreds of excel to import into the database, if we use the excel import function provided by database editors such as navicat, it will be extremely tedious and time-consuming...
1
by: Sonnysonu | last post by:
This is the data of csv file 1 2 3 1 2 3 1 2 3 1 2 3 2 3 2 3 3 the lengths should be different i have to store the data by column-wise with in the specific length. suppose the i have to...
0
by: Hystou | last post by:
There are some requirements for setting up RAID: 1. The motherboard and BIOS support RAID configuration. 2. The motherboard has 2 or more available SATA protocol SSD/HDD slots (including MSATA, M.2...
0
marktang
by: marktang | last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However,...
0
by: Hystou | last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can...
0
Oralloy
by: Oralloy | last post by:
Hello folks, I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>". The problem is that using the GNU compilers,...
0
jinu1996
by: jinu1996 | last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.