Still celebrating National IT Professionals Day with 3 months of free Premium Membership. Use Code ITDAY17

x
?
Solved

Retreive hWnd without FindWindow?

Posted on 2007-04-09
6
Medium Priority
?
738 Views
Last Modified: 2013-11-27
I swear I was using a built-in VBA function last week to find out if an application was already running before launching it with the shell function.
The problem is I've lost that work and I can't remember what the function was called.

It's not FindWindow

And as I recall it was a simple built-in VBA function that returned the hWnd of a window as long, by any portion of the application's caption.

That is, it would return a hWnd for the application "Mainframe Session 3 - Microsoft Internet Explorer" if you did function("mainframe session 3")

All I really need to do is find out if an application is already running based on the title bar text, if it is make it active, if it isn't launch it and make it active.
0
Comment
Question by:efedora
[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
  • 3
  • 3
6 Comments
 
LVL 38

Accepted Solution

by:
Jim P. earned 1000 total points
ID: 18876160
This it?
-----------------------------------------
Declare Function FindWindow Lib "user32" Alias "FindWindowA" ( _
        ByVal lpClassName As Any, _
        ByVal lpWindowName As Any) As Long
0
 
LVL 1

Author Comment

by:efedora
ID: 18876207
no it was a function you can call directly in vba.

using findwindow in a module doesn't appear to work with only part of a caption
0
 
LVL 38

Expert Comment

by:Jim P.
ID: 18876224
It won't -- you have to have an exact match.
0
VIDEO: THE CONCERTO CLOUD FOR HEALTHCARE

Modern healthcare requires a modern cloud. View this brief video to understand how the Concerto Cloud for Healthcare can help your organization.

 
LVL 1

Author Comment

by:efedora
ID: 18876234
ok.
so I know I can activate an app with a partial title string using AppActivate(), is there a comparable function to retreive a handle or title string from a partial title string?

0
 
LVL 1

Author Comment

by:efedora
ID: 18876452
oh well i guess it can't be done more simply. i am just going to use findwindow. thanks
0
 
LVL 38

Expert Comment

by:Jim P.
ID: 18876574
Glad to be of assistance. May all your days get brighter and brighter.
0

Featured Post

10 Questions to Ask when Buying Backup Software

Choosing the right backup solution for your organization can be a daunting task. To make the selection process easier, ask solution providers these 10 key questions.

Question has a verified solution.

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

Access developers frequently have requirements to interact with Excel (import from or output to) in their applications.  You might be able to accomplish this with the TransferSpreadsheet and OutputTo methods, but in this series of articles I will di…
This article describes a method of delivering Word templates for use in merging Access data to Word documents, that requires no computer knowledge on the part of the recipient -- the templates are saved in table fields, and are extracted and install…
Access reports are powerful and flexible. Learn how to create a query and then a grouped report using the wizard. Modify the report design after the wizard is done to make it look better. There will be another video to explain how to put the final p…
With Secure Portal Encryption, the recipient is sent a link to their email address directing them to the email laundry delivery page. From there, the recipient will be required to enter a user name and password to enter the page. Once the recipient …

722 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