Results 1 to 4 of 4

Thread: Open Windows Calculator

  1. #1

    Open Windows Calculator

    This will open the Windows Calculator from ThinBasic.

    Uses "OS"
    CallBack Function XXXXXXXX() as long
        Select Case CbMsg
            Case %WM_INITDIALOG
            Case %WM_SIZE
            Case %WM_COMMAND
                Select Case CbCtl
    Case %open_calc  
                       Dim utility_path As String = "C:\Windows\System32\calc.exe"
                       OS_ShellExecute("open", utility_path, "", "", %OS_WNDSTYLE_NORMAL)
       End Select

  2. #2
    Super Moderator Petr Schreiber's Avatar
    Join Date
    Aug 2005
    Brno - Czech Republic
    Rep Power
    Hi Steinie,

    thanks for the code snippet. Regarding the path - although it might seem impossible, some users (me on my desktop) do not have Windows installed on C drive.
    How to solve such a situation? How to detect Windows path?

    This is where OS module can help with OS_GetSpecialFolder.

    The code snippet than changes to:
    Uses "OS"
    String utility_path = OS_GetSpecialFolder(%CSIDL_SYSTEM)+"calc.exe"
    OS_ShellExecute("open", utility_path, "", "", %OS_WNDSTYLE_NORMAL)

    Learn 3D graphics with ThinBASIC, learn TBGL!
    Windows 10 64bit - Intel Core i5-3350P @ 3.1GHz - 16 GB RAM - NVIDIA GeForce GTX 1050 Ti 4GB

  3. #3
    Here is a ScriptBasic Ubuntu Linux 64 example of popping up a calculator.

    rtncode = EXECUTE("gcalctool",-1,procid)

    -1 - Wait until external program finishes. (or the number of seconds before timing out)

    procid - If the external program errors, the process ID is returned in this variable

    rtncode - exit code of the external program

    Another ScriptBasic option is to execute the external program asynchronously in it's own process.

    procid = SYSTEM("gcalctool")
    Attached Images Attached Images
    Last edited by John Spikowski; 01-09-2011 at 11:44.
    ScriptBasic Project Manager
    Project Site

Similar Threads

  1. calculator bug?
    By sandyrepope in forum UI (User Interface)
    Replies: 1
    Last Post: 22-12-2007, 09:52
  2. toggle between open windows
    By sandyrepope in forum thinAir General
    Replies: 6
    Last Post: 22-02-2007, 13:05

Members who have read this thread: 0

There are no members to list at the moment.

Tags for this Thread

Posting Permissions

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