Re: Where to find an executable name for obj = xxx.application

Tech Tip: Click here to run a free scan for Windows Errors and optimize PC performance



Dave,
This worked like a charm! Thank you for the help!


"Dave Patrick" wrote:

> Function IsExecuting(sProc)
> set list = getobject("winmgmts:").execquery(_
> "select * from win32_process where name='" & sProc & "'")
> If list.count > 0 Then IsExecuting = True
> End Function
>
>
> 'example use:
>
> 'If Not IsExecuting("notepad.exe") Then
> ' do something
> 'End If
>
> --
> Regards,
>
> Dave Patrick ....Please no email replies - reply in newsgroup.
> Microsoft Certified Professional
> Microsoft MVP [Windows]
> http://www.microsoft.com/protect
>
> "Gunner" wrote:
> | I'm hoping someone can help. I've been having a problem locating an
> | executables "name". I'm trying to check and see if our data collection
> system
> | program is running from within my access 2000 DB. If it isn't I want to
> start
> | it. I know the following code works because I use it to check that outlook
> is
> | running and if it's not, it will automatically start that application. I
> | think the problem is finding the proper name of the executable I want to
> | start. Here is a sample of my code for the application I'm having trouble
> | with. The data collection program is stored on the network but is executed
> | from our tooling computer and must be running at all times. Someone keeps
> | accidentally turning it off. When that happens our data collection system
> | stops working. I think the problem is with the name in front of the
> | ___.application function. I looked in the task manager and the name of
> the
> | program there is DCDAO.exe. I've plugged DCDAO in but it didn't work. The
> | same for DATACOLL from the executable datacoll.exe listed below when I
> shell.
> | Is there any place else I can look to find the information I need? Any
> help
> | would be appreciated.
> |
> | *****************
> | Function IsE2Running() As Boolean
> | 'checks to assure E2 data collection is running at Insert Removal program
> | termination. If it isn't running it should start E2 data collection.
> | Dim objE2 As Object
> | On Error Resume Next
> | Set objE2 = GetObject(, "XXX.Application") 'I think problem lies here
> with
> | proper program name
> | If objE2 Is Nothing Then
> | MsgBox "nothing" 'This is the current message I get
> | IsE2Running = False
> | Else
> | MsgBox "something"
> | IsE2Running = True 'Don't get this TRUE when application is running
> | Set objE2 = Nothing
> | End If
> | End Function
> | ************
> |
> | Private Sub TransComplete_Click()
> | 'Exit database when transaction complete button is activated
> | 'Check to assure E2 Data Collection is running on Insert Removal Screen
> exit.
> | If IsE2Running = False Then
> | MsgBox " E2 IS NOT RUNNING"
> | 'Shell ("G:\BLSWIN32\SOURCE\datacoll.exe")
> | Else
> | MsgBox " E2 is not Running" ' Even when application is running I
> get
> | this!!!!!
> | Endif
> | ********************
> |
> | Thanks in Advance!
> | Gunner
> |
> |
> |
>
>
>
.


Quantcast