Solved

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

Posted on 2004-09-16
4
177 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

Gigs: Get Your Project Delivered by an Expert

Select from freelancers specializing in everything from database administration to programming, who have proven themselves as experts in their field. Hire the best, collaborate easily, pay securely and get projects done right.

Question has a verified solution.

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

Suggested Solutions

Title # Comments Views Activity
MsgBox 2 54
Looking for VB6 code to read SQL table export it to ascii 8 38
Hide vba in gp 7 93
Export Data to Different .csv Files 26 103
When trying to find the cause of a problem in VBA or VB6 it's often valuable to know what procedures were executed prior to the error. You can use the Call Stack for that but it is often inadequate because it may show procedures you aren't intereste…
Article by: Martin
Here are a few simple, working, games that you can use as-is or as the basis for your own games. Tic-Tac-Toe This is one of the simplest of all games.   The game allows for a choice of who goes first and keeps track of the number of wins for…
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…
This lesson covers basic error handling code in Microsoft Excel using VBA. This is the first lesson in a 3-part series that uses code to loop through an Excel spreadsheet in VBA and then fix errors, taking advantage of error handling code. This l…

816 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

8 Experts available now in Live!

Get 1:1 Help Now