?
Solved

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

Posted on 2004-09-16
4
Medium Priority
?
188 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
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
  • 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 2000 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

Free Tool: Site Down Detector

Helpful to verify reports of your own downtime, or to double check a downed website you are trying to access.

One of a set of tools we are providing to everyone as a way of saying thank you for being a part of the community.

Question has a verified solution.

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

I’ve seen a number of people looking for examples of how to access web services from VB6.  I’ve been using a test harness I built in VB6 (using many resources I found online) that I use for small projects to work out how to communicate with web serv…
Most everyone who has done any programming in VB6 knows that you can do something in code like Debug.Print MyVar and that when the program runs from the IDE, the value of MyVar will be displayed in the Immediate Window. Less well known is Debug.Asse…
Get people started with the process of using Access VBA to control Excel using automation, Microsoft Access can control other applications. An example is the ability to programmatically talk to Excel. Using automation, an Access application can laun…
Show developers how to use a criteria form to limit the data that appears on an Access report. It is a common requirement that users can specify the criteria for a report at runtime. The easiest way to accomplish this is using a criteria form that a…
Suggested Courses
Course of the Month14 days, 19 hours left to enroll

771 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