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

Detecting whether a process's main window is hidden

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 1357

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

Similar topics

13
by: dave yan | last post by:
hi, i have some forms which use javascript for data validation, e.g., checking to make sure all required fields are completed, checking that data falls within valid ranges for certain fields,...
2
by: Dom Nicholas | last post by:
Hi, My question is this : how do I detect from another window which didn't create a new window whether it exists ? For example, is there a window-id's container of some sort that hangs around...
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...
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...
1
by: Mex | last post by:
Hi Im using a Process component to run external application (FineOCR.exe) In StarInfo i set theProcess.StartInfo.WindowStyle = System.Diagnostics.ProcessWindowStyle.Hidden; When the process...
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: 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:
In our work, we often receive Excel tables with data in the same format. If we want to analyze these data, it can be difficult to analyze them because the data is spread across multiple Excel files...
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
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
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.