473,624 Members | 2,561 Online
Bytes | Software Development & Data Engineering Community
+ Post

Home Posts Topics Members FAQ

inconsistant behavior in Process.MainWin dowHandle

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 when i run a reasonably large ( 80-90) number of
tests one after the other the Main Window handle API displays
inconsistant behavior.

About 70% of the time my application returns a valid Main WIndow handle
and the rest of the time the value seems to be null. Now, the
inconsistancy here is that the tests that fail due to this issue are
different every time.

Are there any issues that i should be aware of ?
http://msdn2.microsoft.com/en-us/lib...dowhandle.aspx

I am aware that MainWindowHandl e will return Null of the process under
test is a Non - UI process but i am testing on a application similar to
word.

Any information will be of help. Thanks!

Jul 25 '06 #1
1 2510
codejunkie,

Are you calling WaitForInput idle like the documentation states? If you
are running 80-90 instances of an application, depending on the app, you
could be bogging down the system. It could be that the main window handle
has not been created yet, and you are getting the value before it is
available.

Hope this helps.
--
- Nicholas Paldino [.NET/C# MVP]
- mv*@spam.guard. caspershouse.co m

"codejunkie " <go****@gmail.c omwrote in message
news:11******** *************@i 42g2000cwa.goog legroups.com...
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 when i run a reasonably large ( 80-90) number of
tests one after the other the Main Window handle API displays
inconsistant behavior.

About 70% of the time my application returns a valid Main WIndow handle
and the rest of the time the value seems to be null. Now, the
inconsistancy here is that the tests that fail due to this issue are
different every time.

Are there any issues that i should be aware of ?
http://msdn2.microsoft.com/en-us/lib...dowhandle.aspx

I am aware that MainWindowHandl e will return Null of the process under
test is a Non - UI process but i am testing on a application similar to
word.

Any information will be of help. Thanks!

Jul 25 '06 #2

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

Similar topics

1
10907
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 window. I can get the handle for the window using MainWindowHandle how do I maximize the window ? Thanks, Sanjay
4
3905
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 and MainWindowHandle without PInvoke? Thanks
12
2912
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 starting is that it has a welcome window first which gets displayed and then the real windows after a while,in other words it means that the process name is the same, but the handle I need to retrive is the one from the final window and not the...
2
4474
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 window for each process returned. I once read that vb6 app mainWindowHandle is the handle of the hidden window that runs the application.
0
2602
by: Michiel | last post by:
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();
2
6321
by: DraguVaso | last post by:
Hi, I need to do osme handlings with an Internet Explorer Window. The problem is: when the user has one ore more Internet Explorers opened, this is (sometimes) indicated in the Task Manager as one process and not 2 or more. When trying to get all the IE-windowd with the "For Each p In Process.GetProcessesByName("IEXPLORE")"-function, I only get 1 process returned, which has as "p.MainWindowTitle" the MainWindowTitle of one of the open...
1
1962
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 for some reason. ShowWindow(prTarget.MainWindowHandle, SW.HIDE) ' This doesn't always work SendMessage(prTarget.MainWindowHandle, WM.SYSCOMMAND, SC.MAXIMIZE, 0) SendMessage(prTarget.MainWindowHandle, WM.SYSCOMMAND, SC.MINIMIZE, 0)...
8
34274
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 working, what I do wrong ? 10x,
2
4604
by: SiPex | last post by:
I'm trying to make a program that can hide a process that is running, and then restore it for you. I can successfully Hide the window using private const int SW_HIDE = 0; private const int SW_RESTORE = 9; private static extern int ShowWindow(int hwnd, int nCmdShow); private void btnLogonServerHide_Click(object sender, EventArgs e)
0
8231
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, people are often confused as to whether an ONU can Work As a Router. In this blog post, we’ll explore What is ONU, What Is Router, ONU & Router’s main usage, and What is the difference between ONU and Router. Let’s take a closer look ! Part I. Meaning of...
0
8168
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 effortlessly switch the default language on Windows 10 without reinstalling. I'll walk you through it. First, let's disable language synchronization. With a Microsoft account, language settings sync across devices. To prevent any complications,...
0
8614
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 tapestry of website design and digital marketing. It's not merely about having a website; it's about crafting an immersive digital experience that captivates audiences and drives business growth. The Art of Business Website Design Your website is...
0
8471
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 protocol has its own unique characteristics and advantages, but as a user who is planning to build a smart home system, I am a bit confused by the choice of these technologies. I'm particularly interested in Zigbee because I've heard it does some...
0
7153
agi2029
by: agi2029 | last post by:
Let's talk about the concept of autonomous AI software engineers and no-code agents. These AIs are designed to manage the entire lifecycle of a software development project—planning, coding, testing, and deployment—without human intervention. Imagine an AI that can take a project description, break it down, write the code, debug it, and then launch it, all on its own.... Now, this would greatly impact the work of software developers. The idea...
1
6107
isladogs
by: isladogs | last post by:
The next Access Europe User Group meeting will be on Wednesday 1 May 2024 starting at 18:00 UK time (6PM UTC+1) and finishing by 19:30 (7.30PM). In this session, we are pleased to welcome a new presenter, Adolph Dupré who will be discussing some powerful techniques for using class modules. He will explain when you may want to use classes instead of User Defined Types (UDT). For example, to manage the data in unbound forms. Adolph will...
0
4075
by: TSSRALBI | last post by:
Hello I'm a network technician in training and I need your help. I am currently learning how to create and manage the different types of VPNs and I have a question about LAN-to-LAN VPNs. The last exercise I practiced was to create a LAN-to-LAN VPN between two Pfsense firewalls, by using IPSEC protocols. I succeeded, with both firewalls in the same network. But I'm wondering if it's possible to do the same thing, with 2 Pfsense firewalls...
1
2603
by: 6302768590 | last post by:
Hai team i want code for transfer the data from one system to another through IP address by using C# our system has to for every 5mins then we have to update the data what the data is updated we have to send another system
1
1780
muto222
by: muto222 | last post by:
How can i add a mobile payment intergratation into php mysql website.

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.