Solved

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

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

PeopleSoft Has Never Been Easier

PeopleSoft Adoption Made Smooth & Simple!

On-The-Job Training Is made Intuitive & Easy With WalkMe's On-Screen Guidance Tool.  Claim Your Free WalkMe Account Now

Question has a verified solution.

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

Suggested Solutions

Enums (shorthand for ‘enumerations’) are not often used by programmers but they can be quite valuable when they are.  What are they? An Enum is just a type of variable like a string or an Integer, but in this case one that you create that contains…
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…
Get people started with the process of using Access VBA to control Outlook using automation, Microsoft Access can control other applications. An example is the ability to programmatically talk to Microsoft Outlook. Using automation, an Access applic…
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…

737 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