Solved

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

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

How your wiki can always stay up-to-date

Quip doubles as a “living” wiki and a project management tool that evolves with your organization. As you finish projects in Quip, the work remains, easily accessible to all team members, new and old.
- Increase transparency
- Onboard new hires faster
- Access from mobile/offline

Join & Write a Comment

The debugging module of the VB 6 IDE can be accessed by way of the Debug menu item. That menu item can normally be found in the IDE's main menu line as shown in this picture.   There is also a companion Debug Toolbar that looks like the followin…
If you need to start windows update installation remotely or as a scheduled task you will find this very helpful.
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…

747 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

14 Experts available now in Live!

Get 1:1 Help Now