Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations Chriss Miller on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Shell Command 1

Status
Not open for further replies.

Drainie

Programmer
Jul 31, 2002
16
GB
I have two MS Access 2003 MDB applications. I wanted to be able to start the second application from within the first so I added a command button to a form to execute the SHELL command.

This works satisfactorily except when the second application is already active. Under those circumstances, I get a second instance of the second application.

Is there any way I can test if the second application is already active?
 
Hi
I am using WinXP, and this seems to work:

Code:
Public Declare Function SetParent Lib "user32" _
   (ByVal hWndChild As Long, ByVal hWndNewParent As Long) As Long

Public Declare Function FindWindow Lib "user32" Alias "FindWindowA" _
(ByVal lpClassName As String, ByVal lpWindowName As String) As Long

Sub WinHandleX()
Dim WinHandle As Long
'Example
WinHandle = FindWindow(vbNullString, "Untitled - Notepad")
'Debug.Print WinHandle '0 if not found
End Sub

Though it seems to me that it may be possible for you to use a Global Variable. [ponder]
 
Remou

Many thanks, this solution works just as I wanted to!

Doug (Drainie)
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top