[AccessD] A2003:See if an EXE Is running

Max Wanadoo max.wanadoo at gmail.com
Fri Jan 9 03:55:08 CST 2009


Darren,
I *think* this is what you are after:

http://msdn.microsoft.com/en-us/library/ms633499.aspx

Here is an example using Excel:

Function testme()
  MsgBox modDetectExcel
End Function

Private Function modDetectExcel() As String
' Procedure dectects a running Word and registers it.
  If gbMcmModuleLogging = True Then Call
mcmModuleLogging("MCM_Applications", "modDetectExcel", True)
  On Error GoTo errhandler
  Const WM_USER As Long = 1024
  Dim hWnd As Long
  ' If Word is running this API call returns its handle.
  hWnd = FindWindow("XLMAIN", 0)
  If hWnd = 0 Then    ' 0 means Word not running.
    modDetectExcel = "Excel is NOT running"
    Exit Function
  Else
    ' Word is running so use the SendMessage API
    ' function to enter it in the Running Object Table.
    SendMessage hWnd, WM_USER + 18, 0, 0
    modDetectExcel = "Excel is running"
  End If
exithere:
  If gbMcmModuleLogging = True Then Call
mcmModuleLogging("MCM_Applications", "modDetectExcel", False)
  Exit Function
errhandler:
  Select Case Err.Number
  Case Else
    MsgBox "modDetectExcel Error: " & Err.Number & vbCrLf & Err.Description
  End Select
  Resume exithere
End Function

I don't know how you find out what the actual names of objects are though.
MSDN might help. I think Word is "WORDMAIN"

Max


On Thu, Jan 8, 2009 at 11:47 PM, Darren D <darren at activebilling.com.au>wrote:

> Hi team
>
>
>
> I need some code to see if XYZ.exe or ABC.EXE is 'running' or not (EG
> notepad.exe)
>
> I have found some stuff in VB but am not able to get it to work.
>
> I was just wondering if anyone has done this in Access and is able to share
> :-)
> I basically want to see if an app is 'running' then simply report True or
> False
> back to my access app.
>
> I don't want to open or close this app - just see if it's 'running'
>
> Many thanks in advance
>
>
>
> DD
>
>
>
> --
> AccessD mailing list
> AccessD at databaseadvisors.com
> http://databaseadvisors.com/mailman/listinfo/accessd
> Website: http://www.databaseadvisors.com
>



More information about the AccessD mailing list