Wrox Programmer Forums
Go Back   Wrox Programmer Forums > Visual Basic > VB 6 Visual Basic 6 > Pro VB 6
|
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 software programmers and website developers including Wrox book authors and readers. New member registration was closed in 2019. New posts were shut off and the site was archived into this static format as of October 1, 2020. If you require technical support for a Wrox book please contact http://hub.wiley.com
 
Old April 18th, 2006, 11:28 PM
Authorized User
 
Join Date: Aug 2003
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.
 
Old April 21st, 2006, 03:07 PM
Friend of Wrox
 
Join Date: Nov 2004
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.
The Following User Says Thank You to BrianWren For This Useful Post:
morerohit (August 23rd, 2013)
 
Old August 23rd, 2013, 06:09 AM
Registered User
 
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
 
Old August 23rd, 2013, 06:10 AM
Registered User
 
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.





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 02:17 AM





Powered by vBulletin®
Copyright ©2000 - 2020, Jelsoft Enterprises Ltd.
Copyright (c) 2020 John Wiley & Sons, Inc.