Solved

How's it possible, API - 3 PID's 3 HWND no control

Posted on 2004-09-16
4
175 Views
Last Modified: 2010-05-02
I am trying to uninstall an application remotely and am running into road blocks everywhere I turn. The application responds correctly to the initial start of my program by me using "findWindow" to identify the first window and then I use "sendmessage" to send a "button click" the window disappears and the uninstall begins after that I get lost and am frustrated to no end, I've about finished pulling out the rest of my hair...

The next window that appears has a differend HWND and PID does the uninstall with a progress bar and then disappears from the screen but the HWND still exists, yet I can't seem to identify when this process stops or hides so that I can do a "findwindow" and answer the next prompted question. I've tried "waitforidelinput" and "IsWindowVisible" but neither work, how is this possible???

I think I need some type of WindowHook to answer and send messages to this program but I've never used one before and wouldn't know where to start coding it but I'm open to any and all ideas at this stage....

signed,

frustrated

0
Comment
Question by:ampapa
  • 2
  • 2
4 Comments
 
LVL 32

Expert Comment

by:Erick37
ID: 12081159
Just a thought, maybe use the EnumWindows callback to loop through all top level (and child) windows to find the one you are interested in.  Here are some demos:

How To Enumerate Windows Using the WIN32 API
http://support.microsoft.com/support/kb/articles/q183/0/09.asp

Enumerate Top Level Windows
http://www.thescarms.com/VBasic/EnumWindows.asp

Hope it helps!
0
 
LVL 8

Author Comment

by:ampapa
ID: 12083049
I've already found the Window HWND using the "FindWindow" function "lngreturn = FindWindow(vbNullString, "Remove Programs From Your Computer")".

Are you saying there is a difference between it and the "Enumerate Windows" function?
0
 
LVL 32

Accepted Solution

by:
Erick37 earned 500 total points
ID: 12085170
Maybe EnumWindows will not help.  If I understand correctly, you want to detect when a window hides and or terminates.  If the window no longer exists, then FindWindow will of course return 0.  If you have the hwnd to a hidden window, you may try checking the WS_VISIBLE style bit using GetWindowLong().

Private Const WS_VISIBLE = &H10000000
Private Const GWL_STYLE = (-16)
Private Declare Function GetWindowLong Lib "user32" Alias "GetWindowLongA" (ByVal hwnd As Long, ByVal nIndex As Long) As Long

'-----------------------------------------------------------

lResult = GetWindowLong(hwnd, GWL_STYLE)
If (lResult And WS_VISIBLE) Then
    '
    'Window is visible
    '
Else
    '
    ' Window Not Visible
    '
End If
0
 
LVL 8

Author Comment

by:ampapa
ID: 12089818
Sorry, Erick37 it didn't work.
0

Featured Post

Is Your Active Directory as Secure as You Think?

More than 75% of all records are compromised because of the loss or theft of a privileged credential. Experts have been exploring Active Directory infrastructure to identify key threats and establish best practices for keeping data safe. Attend this month’s webinar to learn more.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Suggested Solutions

You can of course define an array to hold data that is of a particular type like an array of Strings to hold customer names or an array of Doubles to hold customer sales, but what do you do if you want to coordinate that data? This article describes…
If you need to start windows update installation remotely or as a scheduled task you will find this very helpful.
As developers, we are not limited to the functions provided by the VBA language. In addition, we can call the functions that are part of the Windows operating system. These functions are part of the Windows API (Application Programming Interface). U…
Get people started with the utilization of class modules. Class modules can be a powerful tool in Microsoft Access. They allow you to create self-contained objects that encapsulate functionality. They can easily hide the complexity of a process from…

911 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question

Need Help in Real-Time?

Connect with top rated Experts

20 Experts available now in Live!

Get 1:1 Help Now