I can't find a similar command in Word97 VBA. Do I need to use the
FindWindow API? I'd rather not do this if there is some built-in
command.
Thanks in advance,
Mike
I can't use the classname either because this is a VB app and there
are more than one of them running, so again I would have to use
enumeration.
Any help would be greatly, greatly appreciated.
Thanks,
Mike
Regards
Dave
<Michael Stephenson> wrote in message
news:3aae5b12....@news.mindspring.com...
This is a roundabout way, but I used the following function to determine if
the Worldox executable was running.
You should be able to alter it easily for your purpose.
**** Code Begins Here ****
'********************************************************
'*The Blackstone Group *
'*The Publishing Group *
'*Created by George W. Kenny - gwk...@yahoo.com *
'*Date of Creation: December 2000 *
'*Modified by: George W. Kenny *
'*Date of Last Modification: December 2000 *
'********************************************************
'DESC: Module that holds my procedures that corrects Worldox's incorrect
programming regarding
' saving and exiting - gwk
Option Explicit
'Functions for Worldox Open function
Public Declare Function EnumProcesses Lib "psapi.dll" (ByRef lpidProcess As
Long, ByVal lngSize As Long, _
ByRef lngSizeNeeded As Long) As Long
Public Declare Function OpenProcess Lib "Kernel32.dll" (ByVal
dwDesiredAccessas As Long, ByVal bInheritHandle As Long, _
ByVal dwProcId As Long) As Long
Public Declare Function EnumProcessModules Lib "psapi.dll" (ByVal
lng_hProcess As Long, ByRef lphModule As Long, _
ByVal lngSize As Long, ByRef lngSizeNeeded As Long) As Long
Public Declare Function GetModuleFileNameExA Lib "psapi.dll" (ByVal
lng_hProcess As Long, ByVal hModule As Long, _
ByVal strModuleName As String, ByVal lng_n_Size As Long) As Long
Public Declare Function CloseHandle Lib "Kernel32.dll" (ByVal Handle As
Long) As Long
Function WorldoxOpen()
'DESC: Procedure returns all the processes currently running and checks to
see if WDNT.EXE (Worldox) is up
Const PROCESS_QUERY_INFORMATION = 1024
Const PROCESS_VM_READ = 16
Const MAX_PATH = 260
Dim lngSize As Long
Dim lngSizeNeeded As Long
Dim lngNumElem As Long
Dim lngProcessIDs() As Long
Dim lngSizeNeeded2 As Long
Dim lngModules(1 To 200) As Long
Dim lngRet As Long
Dim strModuleName As String
Dim lng_n_Size As Long
Dim lng_hProcess As Long
Dim lngCounter As Long
WorldoxOpen = False
lngSize = 8
lngSizeNeeded = 96
'Define necessary array size
Do While lngSize <= lngSizeNeeded
lngSize = lngSize * 2
ReDim lngProcessIDs(lngSize / 4) As Long
lngRet = EnumProcesses(lngProcessIDs(1), lngSize, lngSizeNeeded)
Loop
lngNumElem = lngSizeNeeded / 4
'Cycle through each process
For lngCounter = 1 To lngNumElem
'Get the handle
lng_hProcess = OpenProcess(PROCESS_QUERY_INFORMATION Or
PROCESS_VM_READ, 0, lngProcessIDs(lngCounter))
'Return the name of the process if valid
If lng_hProcess <> 0 Then
lngRet = EnumProcessModules(lng_hProcess, lngModules(1), 200,
lngSizeNeeded2)
If lngRet <> 0 Then
strModuleName = Space(MAX_PATH)
lng_n_Size = 500
lngRet = GetModuleFileNameExA(lng_hProcess, lngModules(1),
strModuleName, lng_n_Size)
'Test if Worldox is open
If LCase(Left(strModuleName, lngRet)) =
"c:\worldox\wdnt.exe" Then
WorldoxOpen = True
End If
End If
End If
'Close the handle to the process
lngRet = CloseHandle(lng_hProcess)
Next
End Function
Dave Rado <dr...@onetel.net.uk> wrote in message
news:O2MCLSBrAHA.1840@tkmsftngp03...