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

Best way to hide the main window of a process?

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 1445

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

Similar topics

5
by: Steve | last post by:
Visual Studio 2003 C# Windows: I have a tree view control as my main menu control down the left side of my application. This has 2 Parent Nodes on it (Jobs and Employees). beneath these 2 main...
7
by: tgh003 | last post by:
I would be interested to hear how others are managing their javascript (.js) files from the original code vs the obfuscated version they publish to their site/webapp. I currently manage 2 files,...
11
by: objectref | last post by:
Hi to all, is there a way to get the window handle of the main window of an application or process ? For example, if someone opens Microsoft Word, he gets a window so he/she can write text....
6
by: James Li | last post by:
I need to run multiple .bat files(in specific order, sychronously) from my C# windows app. I also want to hide the DOS command window so that users don't see them. Basically my program lanches...
3
by: Thom | last post by:
I am relativly new to vb.net ..... heck I'm new to VB in any version. So I apologize if this is overly dumb. I am trying to start and stop a particular file using the process.start() and...
4
by: Never Best | last post by:
I have an application. I want it so when the user minimizs the window it goes into the system tray, and while in the system tray I don't want it in the "Alt-Tab" list. (When the program starts it...
2
by: gene kelley | last post by:
I have a dialog form, frmDetails, that is opened from the main form: frmDetails.ShowDialog() The only way I have provided to close this dialog is via the "X" button. If frmDetails is just...
6
by: seb | last post by:
Hi, I am using pygtk for the first times. I am wondering what would be the best "pattern" to interface pygtk with a thread. The thread is collecting informations (over the network for...
5
by: xrado | last post by:
when i say window.hide(), window dont hide imidetly i want to hide it for a few seconds, do something and then show it back how can i do this? i have this example: import pygtk,time...
0
by: DolphinDB | last post by:
Tired of spending countless mintues downsampling your data? Look no further! In this article, you’ll learn how to efficiently downsample 6.48 billion high-frequency records to 61 million...
0
by: ryjfgjl | last post by:
ExcelToDatabase: batch import excel into database automatically...
0
isladogs
by: isladogs | last post by:
The next Access Europe meeting will be on Wednesday 6 Mar 2024 starting at 18:00 UK time (6PM UTC) and finishing at about 19:15 (7.15PM). In this month's session, we are pleased to welcome back...
0
by: Vimpel783 | last post by:
Hello! Guys, I found this code on the Internet, but I need to modify it a little. It works well, the problem is this: Data is sent from only one cell, in this case B5, but it is necessary that data...
0
by: jfyes | last post by:
As a hardware engineer, after seeing that CEIWEI recently released a new tool for Modbus RTU Over TCP/UDP filtering and monitoring, I actively went to its official website to take a look. It turned...
0
by: ArrayDB | last post by:
The error message I've encountered is; ERROR:root:Error generating model response: exception: access violation writing 0x0000000000005140, which seems to be indicative of an access violation...
1
by: PapaRatzi | last post by:
Hello, I am teaching myself MS Access forms design and Visual Basic. I've created a table to capture a list of Top 30 singles and forms to capture new entries. The final step is a form (unbound)...
1
by: CloudSolutions | last post by:
Introduction: For many beginners and individual users, requiring a credit card and email registration may pose a barrier when starting to use cloud servers. However, some cloud server providers now...
0
by: Faith0G | last post by:
I am starting a new it consulting business and it's been a while since I setup a new website. Is wordpress still the best web based software for hosting a 5 page website? The webpages will be...

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.