Wrox Programmer Forums

Need to download code?

View our list of code downloads.

Go Back   Wrox Programmer Forums > Visual Basic > VB 6 Visual Basic 6 > Pro VB 6
Password Reminder
Register
Register | FAQ | Members List | Calendar | Search | Today's Posts | Mark Forums Read
Pro VB 6 For advanced Visual Basic coders working in version 6 (not .NET). Beginning-level questions will be redirected to other forums, including Beginning VB 6.
Welcome to the p2p.wrox.com Forums.

You are currently viewing the Pro VB 6 section of the Wrox Programmer to Programmer discussions. This is a community of tens of thousands of software programmers and website developers including Wrox book authors and readers. As a guest, you can read any forum posting. By joining today you can post your own programming questions, respond to other developersí questions, and eliminate the ads that are displayed to guests. Registration is fast, simple and absolutely free .
DRM-free e-books 300x50
Reply
 
Thread Tools Display Modes
  #1 (permalink)  
Old April 18th, 2006, 11:28 PM
Authorized User
Points: 325, Level: 6
Points: 325, Level: 6 Points: 325, Level: 6 Points: 325, Level: 6
Activity: 0%
Activity: 0% Activity: 0% Activity: 0%
 
Join Date: Aug 2003
Location: Altamonte Springs, FL
Posts: 72
Thanks: 0
Thanked 0 Times in 0 Posts
Default Windows API - Can I find the Active Application??

Hi:

I know about GetActiveWindow in the Windows API.
Unfortunately, that will only return the window handle if the active window is within the application calling GetActiveWindow.

I need to be able to get the handle to the active window if it's NOT part of my application.

Can I do that in VB?
If so, how?

__________________
http://www.softlinksys.com
Professional Software Developer since 1994.
Reply With Quote
  #2 (permalink)  
Old April 21st, 2006, 03:07 PM
Friend of Wrox
 
Join Date: Nov 2004
Location: Port Orchard, WA, USA.
Posts: 1,621
Thanks: 1
Thanked 3 Times in 3 Posts
Default

Perhaps GetWindow, with the command being GW_HWNDFIRST
Code:
Const GW_HWNDFIRST = 0

Public Declare Function GetWindow _
               Lib "user32" _
               Alias "GetWindow" (ByVal hwnd As Long, _
                                  ByVal wCmd As Long) As Long
                                  Help says, of this const:
The retrieved handle identifies the window of the same type that is highest in the Z order. If the specified window is a topmost window, the handle identifies the topmost window that is highest in the Z order. If the specified window is a top-level window, the handle identifies the top-level window that is highest in the Z order. If the specified window is a child window, the handle identifies the sibling window that is highest in the Z order.
Reply With Quote
The Following User Says Thank You to BrianWren For This Useful Post:
morerohit (August 23rd, 2013)
  #3 (permalink)  
Old August 23rd, 2013, 06:09 AM
Registered User
Points: 6, Level: 1
Points: 6, Level: 1 Points: 6, Level: 1 Points: 6, Level: 1
Activity: 0%
Activity: 0% Activity: 0% Activity: 0%
 
Join Date: Aug 2013
Posts: 2
Thanks: 1
Thanked 0 Times in 0 Posts
Default Need Help

Hey Brian,

I understand this is a very old blog but I'm stuck with the same problem and unable to get the application name of active window. Please give an example of getwindow library.

You quick response will be highly appreciated.

Rohit
Reply With Quote
  #4 (permalink)  
Old August 23rd, 2013, 06:10 AM
Registered User
Points: 6, Level: 1
Points: 6, Level: 1 Points: 6, Level: 1 Points: 6, Level: 1
Activity: 0%
Activity: 0% Activity: 0% Activity: 0%
 
Join Date: Aug 2013
Posts: 2
Thanks: 1
Thanked 0 Times in 0 Posts
Default Need Help

Hey Brian,

I understand this is a very old blog but I'm stuck with the same problem and unable to get the application name of active window. Please give an example of getwindow library.

You quick response will be highly appreciated.

Rohit


Quote:
Originally Posted by BrianWren View Post
Perhaps GetWindow, with the command being GW_HWNDFIRST
Code:
Const GW_HWNDFIRST = 0

Public Declare Function GetWindow _
               Lib "user32" _
               Alias "GetWindow" (ByVal hwnd As Long, _
                                  ByVal wCmd As Long) As Long
                                  Help says, of this const:
The retrieved handle identifies the window of the same type that is highest in the Z order. If the specified window is a topmost window, the handle identifies the topmost window that is highest in the Z order. If the specified window is a top-level window, the handle identifies the top-level window that is highest in the Z order. If the specified window is a child window, the handle identifies the sibling window that is highest in the Z order.
Reply With Quote
Reply


Thread Tools
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is Off
HTML code is Off
Trackbacks are Off
Pingbacks are On
Refbacks are Off

Similar Threads
Thread Thread Starter Forum Replies Last Post
Excel Startup with Windows API rohit_ghosh Excel VBA 1 July 29th, 2008 04:20 PM
want to know book abt windows api bhavin12300 Visual Studio 2005 0 April 7th, 2008 07:37 AM
cross thread exception with windows live API YoungLuke C# 2008 aka C# 3.0 1 March 23rd, 2008 01:43 PM
Porting C++ winsock API application to ATL wambozi Visual C++ 1 September 11th, 2006 10:16 AM
How use Windows API in asp yogeshkale Classic ASP Components 0 March 8th, 2006 01:17 AM



All times are GMT -4. The time now is 07:39 AM.


Powered by vBulletin®
Copyright ©2000 - 2017, Jelsoft Enterprises Ltd.
© 2013 John Wiley & Sons, Inc.