-
Open Windows Calculator
This will open the Windows Calculator from ThinBasic.:D
Code:
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
-
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:
Code:
Uses "OS"
String utility_path = OS_GetSpecialFolder(%CSIDL_SYSTEM)+"calc.exe"
OS_ShellExecute("open", utility_path, "", "", %OS_WNDSTYLE_NORMAL)
Petr
-
1 Attachment(s)
Here is a ScriptBasic Ubuntu Linux 64 example of popping up a calculator.
Code:
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.
Code:
procid = SYSTEM("gcalctool")