/src/mk2/THelpers.cls
Visual Basic for Applications | 83 lines | 49 code | 34 blank | 0 comment | 0 complexity | e808baecba022d3f7cc5d8844033131c MD5 | raw file
1VERSION 1.0 CLASS 2BEGIN 3 MultiUse = -1 'True 4 Persistable = 0 'NotPersistable 5 DataBindingBehavior = 0 'vbNone 6 DataSourceBehavior = 0 'vbNone 7 MTSTransactionMode = 0 'NotAnMTSObject 8END 9Attribute VB_Name = "THelpers" 10Attribute VB_GlobalNameSpace = False 11Attribute VB_Creatable = True 12Attribute VB_PredeclaredId = False 13Attribute VB_Exposed = False 14Option Explicit 15 16Private Declare Function LockWorkStation Lib "user32.dll" () As Long 17 18Public Function pi() As Double 19 20 pi = 4 * Atn(1) 21 22End Function 23 24Public Function sqrt(ByVal Number As Double) As Double 25 26 sqrt = Sqr(Number) 27 28End Function 29 30Public Function who_am_i() As String 31 32 who_am_i = g_GetUserName() 33 34End Function 35 36Public Function computer_name() As String 37 38 computer_name = g_GetComputerName() 39 40End Function 41 42Public Function is_computer_on() As Boolean 43 44 is_computer_on = True 45 46End Function 47 48Public Function is_computer_on_fire() As Boolean 49 50 is_computer_on_fire = False 51 52End Function 53 54Public Sub shutdown_dialog() 55 56 SHShutdownDialog gWindow.hWnd 57 58End Sub 59 60Public Sub logoff_dialog() 61 62 LogoffWindowsDialog gWindow.hWnd 63 64End Sub 65 66Public Function shell_execute(Optional ByVal Verb As String = "open", Optional ByVal File As String, Optional ByVal Args As String, Optional ByVal Dir As String, Optional ByVal WindowStyle As Long = SW_SHOW) As Boolean 67 68 If File <> "" Then _ 69 shell_execute = (ShellExecute(gWindow.hWnd, Verb, File, Args, Dir, WindowStyle) > 31) 70 71End Function 72 73Public Sub lock_computer() 74 75 LockWorkStation 76 77End Sub 78 79Public Function quote(ByVal str As String) As String 80 81 quote = g_Quote(str) 82 83End Function