/src/mk2/THelpers.cls

http://phatbar.googlecode.com/ · Visual Basic for Applications · 83 lines · 49 code · 34 blank · 0 comment · 0 complexity · e808baecba022d3f7cc5d8844033131c MD5 · raw file

  1. VERSION 1.0 CLASS
  2. BEGIN
  3. MultiUse = -1 'True
  4. Persistable = 0 'NotPersistable
  5. DataBindingBehavior = 0 'vbNone
  6. DataSourceBehavior = 0 'vbNone
  7. MTSTransactionMode = 0 'NotAnMTSObject
  8. END
  9. Attribute VB_Name = "THelpers"
  10. Attribute VB_GlobalNameSpace = False
  11. Attribute VB_Creatable = True
  12. Attribute VB_PredeclaredId = False
  13. Attribute VB_Exposed = False
  14. Option Explicit
  15. Private Declare Function LockWorkStation Lib "user32.dll" () As Long
  16. Public Function pi() As Double
  17. pi = 4 * Atn(1)
  18. End Function
  19. Public Function sqrt(ByVal Number As Double) As Double
  20. sqrt = Sqr(Number)
  21. End Function
  22. Public Function who_am_i() As String
  23. who_am_i = g_GetUserName()
  24. End Function
  25. Public Function computer_name() As String
  26. computer_name = g_GetComputerName()
  27. End Function
  28. Public Function is_computer_on() As Boolean
  29. is_computer_on = True
  30. End Function
  31. Public Function is_computer_on_fire() As Boolean
  32. is_computer_on_fire = False
  33. End Function
  34. Public Sub shutdown_dialog()
  35. SHShutdownDialog gWindow.hWnd
  36. End Sub
  37. Public Sub logoff_dialog()
  38. LogoffWindowsDialog gWindow.hWnd
  39. End Sub
  40. Public 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
  41. If File <> "" Then _
  42. shell_execute = (ShellExecute(gWindow.hWnd, Verb, File, Args, Dir, WindowStyle) > 31)
  43. End Function
  44. Public Sub lock_computer()
  45. LockWorkStation
  46. End Sub
  47. Public Function quote(ByVal str As String) As String
  48. quote = g_Quote(str)
  49. End Function