Results 1 to 3 of 3
  1. #1
    Star Lounger
    Join Date
    Apr 2006
    Location
    California
    Posts
    69
    Thanks
    0
    Thanked 0 Times in 0 Posts

    Is Calc.exe Running (Access 2003 SP2)

    I'm providing a button to open Calc.exe. In testing I see that repeated clicking opens multiple copies of the calculator. I probably didn't search on the right topics, but I could find anything on how to test whether the calculator is already running before starting a new copy. And if it is alredy runing, how do I make it the active window?

  2. #2
    Plutonium Lounger
    Join Date
    Mar 2002
    Posts
    84,353
    Thanks
    0
    Thanked 29 Times in 29 Posts

    Re: Is Calc.exe Running (Access 2003 SP2)

    Put the following declaration at the top of a module (below Option Compare Database and Option Explicit, if present, but above all Subs and Functions):
    <code>
    Declare Function FindWindow Lib "user32" Alias "FindWindowA" ( _
    ByVal lpClassName as Any, _
    ByVal lpWindowName as Any) As Long
    </code>
    Use code like this:
    <code>
    Private Sub cmdCalculator_Click()
    If FindWindow(vbNullString, "Calculator") = 0 Then
    Shell "Calc.exe", vbNormalFocus
    Else
    AppActivate "Calculator"
    End If
    End Sub</code>

  3. #3
    Star Lounger
    Join Date
    Apr 2006
    Location
    California
    Posts
    69
    Thanks
    0
    Thanked 0 Times in 0 Posts

    Re: Is Calc.exe Running (Access 2003 SP2)

    Hans,
    Appreciate very much the quick response.

    Thank you,
    Marty

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •