Make an application window active thru VB


DevX Home    Today's Headlines   Articles Archive   Tip Bank   Forums   

Results 1 to 3 of 3

Thread: Make an application window active thru VB

  1. #1
    Moses Pakkianathan .M Guest

    Make an application window active thru VB


    Thru VB I want to identify an open windows (like Explorer or SQL etc..) &
    make it active. Scenario is, I want to throw few sendkeys to a particular
    application, but before doing it want to see if it is open & if open then
    gotto make that application active.

    I used Findwindow to find the window & then used showwindow to make it active.
    But in Findwindow I shud know the class or handle or the titlebar caption.
    Handle & Titlebar caption changes, so my application will not be able to
    find the desired windows handle or caption with out clicking on it.

    Is there any way of making an window active without any endusers input. Say
    if I want to make explorer active, my program shud do it by itself without
    anybody clicking on the window to pass on the caption property.

    Is it possible thru registry.

    Kindly help me on that.

    Rgds, Moses.M



  2. #2
    Juergen Thuemmler Guest

    Re: Make an application window active thru VB

    > I used Findwindow to find the window & then used showwindow to make it active.
    > But in Findwindow I shud know the class or handle or the titlebar caption.
    > Handle & Titlebar caption changes, so my application will not be able to
    > find the desired windows handle or caption with out clicking on it.


    Getting the window class:
    www.allapi.net -> VB Tools -> ANALYZER
    Getting the handle:
    www.allapi.net -> VB Tools -> DSHANDLE -> "GetHandle()"
    Activating the window:
    www.allapi.net -> VB Tools -> DSHANDLE -> "SetForegrndWindow()"

    Juergen.




  3. #3
    Mark Alexander Bertenshaw Guest

    Re: Make an application window active thru VB


    "Moses Pakkianathan .M" <mos_pak@hotmail.com> wrote:
    >
    >Thru VB I want to identify an open windows (like Explorer or SQL etc..)

    &
    >make it active. Scenario is, I want to throw few sendkeys to a particular
    >application, but before doing it want to see if it is open & if open then
    >gotto make that application active.
    >
    >I used Findwindow to find the window & then used showwindow to make it active.
    >But in Findwindow I shud know the class or handle or the titlebar caption.
    >Handle & Titlebar caption changes, so my application will not be able to
    >find the desired windows handle or caption with out clicking on it.
    >
    >Is there any way of making an window active without any endusers input.

    Say
    >if I want to make explorer active, my program shud do it by itself without
    >anybody clicking on the window to pass on the caption property.
    >
    >Is it possible thru registry.
    >
    >Kindly help me on that.
    >
    >Rgds, Moses.M


    Moses -

    I still can't see why you can't use FindWindow/FindWindowEx. In your example
    above, you have specified that you are interested in Explorer and SQL (whatever
    that is). All windows have captions and classes. It is incumbent on you
    to discover the caption (by looking at it), and using a tool such as Spy++
    to find the class of the window. I can tell you Explorer - it's "ExploreWClass"
    (on Windows NT 4).

    --
    Mark Alexander Bertenshaw
    Programmer/Analyst
    Chordiant Software, Inc.
    Brentford
    UK

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  
HTML5 Development Center
 
 
FAQ
Latest Articles
Java
.NET
XML
Database
Enterprise
Questions? Contact us.
C++
Web Development
Wireless
Latest Tips
Open Source


   Development Centers

   -- Android Development Center
   -- Cloud Development Project Center
   -- HTML5 Development Center
   -- Windows Mobile Development Center