473,395 Members | 1,571 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,395 software developers and data experts.

Detecting a process's main window's hidden state

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 processes dies, the app restarts it. One of the options
I've written hides the main window of the monitored process (since
there are 99 processes, I'm trying to keep the screen clutter to a
minimum). Basicly, I start the app, then minimize, maximize, show, or
hide it based on the option chosen. My problem comes with the actual
app I'm monitoring. It doesn't like the ShowWindow function, and it
doesn't respect the StartInfo.WindowStyle property. I have taken to
starting the app minimized, then using one of the following based on
the option given: (note, SW, WM, ans SC are enums with the appropriate
values, and prTarget is a System.Diagnostics.Process)

ShowWindow(prTarget.MainWindowHandle, SW.HIDE)
SendMessage(prTarget.MainWindowHandle, WM.SYSCOMMAND, SC.MAXIMIZE, 0)
SendMessage(prTarget.MainWindowHandle, WM.SYSCOMMAND, SC.MINIMIZE, 0)
SendMessage(prTarget.MainWindowHandle, WM.SYSCOMMAND, SC.RESTORE, 0)

Again, this works for every other application I've tried (testing by
monitoring notepad, charmap, calc, etc. on my computer). Prerviously,
I had been using ShowWindow calls to maximize, minimize, and restore,
but this caused wierd behavior with the production app. So my
questions are:

1. Is there a better way to hide the process?
2. Is there a way to get the current hidden, maximized, minimized,
restored state of the window from the process or MainWindowHandle?

Nov 21 '05 #1
0 1426

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

Similar topics

12
by: serge calderara | last post by:
Dear all, I have an application which is suppose to start another executable process. As soon as that process is running, I need to retrive its handle. The problem of the particular process I am...
3
by: Saurabh Sharma | last post by:
Hi I found a particular process that is running on my machine. I have th eprocess ID for that how to set Focus to that Process Regards Saurabh
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...
1
by: AS | last post by:
Hi, I am opening an exe from my C# windows application, through system.diagnostics.process.start() - process.StartInfo.FileName = "c:\\windows\\system32\\vkey.exe"; ]...
4
by: Paul | last post by:
Hi, I am trying to start a process hidden. My code: wordprocess = new System.Diagnostics.Process(); ; wordprocess.StartInfo = new System.Diagnostics.ProcessStartInfo(wcmd, args);...
5
by: kh | last post by:
My app filters windows messages because of some custom window functionality I have implemented. Does my window receive a message when the user selects Alt-Tab? If so which message? Many thanks ...
10
by: Stephany Young | last post by:
When one uses the System.Diagnostics.Process.Start method to launch a common or garden Console application, one can set the WindowStyle property of the StartInfo object to ProcessWindowStyle.Hidden...
5
by: uvklein | last post by:
Hi there, I'm writing an application with forms. my main window can be hidden (minimize to a tray icon) like...Microsoft Outlook for example. this application can run only one instance (again...
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: emmanuelkatto | last post by:
Hi All, I am Emmanuel katto from Uganda. I want to ask what challenges you've faced while migrating a website to cloud. Please let me know. Thanks! Emmanuel
0
BarryA
by: BarryA | last post by:
What are the essential steps and strategies outlined in the Data Structures and Algorithms (DSA) roadmap for aspiring data scientists? How can individuals effectively utilize this roadmap to progress...
1
by: nemocccc | last post by:
hello, everyone, I want to develop a software for my android phone for daily needs, any suggestions?
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
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
by: Hystou | last post by:
Overview: Windows 11 and 10 have less user interface control over operating system update behaviour than previous versions of Windows. In Windows 11 and 10, there is no way to turn off the Windows...
0
tracyyun
by: tracyyun | last post by:
Dear forum friends, With the development of smart home technology, a variety of wireless communication protocols have appeared on the market, such as Zigbee, Z-Wave, Wi-Fi, Bluetooth, etc. Each...

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.