Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 1
Default Testing to see if windows application iis running

Dear All

In my program I use (copied) code to start the good ol' trusty windows
calculator. How can I test to see whether the calculator is already running
and give the user a message box to that effect if it is or start it if it
isn't.

(Office XP, XP Pro)

If calc.exe is running then
msgbox "Calculator is already running"
exit sub
'Code to start the calculator
end if

Any suggestions

TIA
Mark (InWales)




  #2   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 1,236
Default Testing to see if windows application iis running

This Microsoft KB article describes how.
http://support.microsoft.com/kb/q187913/

It mentions a DLL. I think psapi.dll is now standard in Windows XP.

--
Rob van Gelder - http://www.vangelder.co.nz/excel


"Mark (InWales)" wrote in message
...
Dear All

In my program I use (copied) code to start the good ol' trusty windows
calculator. How can I test to see whether the calculator is already
running and give the user a message box to that effect if it is or start
it if it isn't.

(Office XP, XP Pro)

If calc.exe is running then
msgbox "Calculator is already running"
exit sub
'Code to start the calculator
end if

Any suggestions

TIA
Mark (InWales)






  #3   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 77
Default Testing to see if windows application iis running

Hi

This is vb script code, but it runs in vba and will tell you if calculator
is running or not. It does run a little slow, but works.


strComputer = "."
Set objWMIService = GetObject("winmgmts:" _
& "{impersonationLevel=impersonate}!\\" & strComputer & "\root\cimv2")

Set colProcesses = objWMIService.ExecQuery( "select * from win32_process" )

isrunning = False

For Each objProcess in colProcesses

If objProcess.GetOwner ( User, Domain ) = 0 Then


If objProcess.caption = "CALC.EXE" then
isrunning = true
exit for
End If


End If

Next

if isrunning = true then
msgbox "Calculator is running"
else
msgbox "Calculator is not running"
end if



HTH

Ken


  #4   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 1
Default Testing to see if windows application iis running

Thank you both for your input.

Mark


"Ken Macksey" wrote in message
...
Hi

This is vb script code, but it runs in vba and will tell you if calculator
is running or not. It does run a little slow, but works.


strComputer = "."
Set objWMIService = GetObject("winmgmts:" _
& "{impersonationLevel=impersonate}!\\" & strComputer & "\root\cimv2")

Set colProcesses = objWMIService.ExecQuery( "select * from
win32_process" )

isrunning = False

For Each objProcess in colProcesses

If objProcess.GetOwner ( User, Domain ) = 0 Then


If objProcess.caption = "CALC.EXE" then
isrunning = true
exit for
End If


End If

Next

if isrunning = true then
msgbox "Calculator is running"
else
msgbox "Calculator is not running"
end if



HTH

Ken




Reply
Thread Tools Search this Thread
Search this Thread:

Advanced Search
Display Modes

Posting Rules

Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are On


Similar Threads
Thread Thread Starter Forum Replies Last Post
Running a macro from windows application Aerojade Excel Discussion (Misc queries) 1 October 3rd 08 01:19 PM
How to keep userform always on the top of all windows application JAtz_DA_WAY Excel Discussion (Misc queries) 1 August 31st 05 01:29 AM
Automation Testing in an Excel application. HC Excel Discussion (Misc queries) 0 March 30th 05 02:05 AM
Application.InputBox with Default:=0 testing False bluhme Excel Programming 2 June 24th 04 12:35 PM
Load Testing Tool required for Excel Pivot table based OLAP Application Shanmugavel R P Excel Programming 2 March 1st 04 11:01 AM


All times are GMT +1. The time now is 08:01 PM.

Powered by vBulletin® Copyright ©2000 - 2024, Jelsoft Enterprises Ltd.
Copyright ©2004-2024 ExcelBanter.
The comments are property of their posters.
 

About Us

"It's about Microsoft Excel"