home *** CD-ROM | disk | FTP | other *** search
/ Planet Source Code Jumbo …e CD Visual Basic 1 to 7 / 1_2002.ISO / Data / Zips / Extream_si775054302002.psc / Module1.bas < prev    next >
Encoding:
BASIC Source File  |  2002-04-30  |  5.6 KB  |  157 lines

  1. Attribute VB_Name = "Module1"
  2. Option Explicit
  3. 'API calls
  4. Declare Function WritePrivateProfileString Lib "kernel32" Alias "WritePrivateProfileStringA" (ByVal lpApplicationName As String, ByVal lpKeyName As Any, ByVal lpString As Any, ByVal lpFileName As String) As Long
  5. Declare Function GetPrivateProfileString Lib "kernel32" Alias "GetPrivateProfileStringA" (ByVal lpApplicationName As String, ByVal lpKeyName As Any, ByVal lpDefault As String, ByVal lpReturnedString As String, ByVal nSize As Long, ByVal lpFileName As String) As Long
  6. Declare Function GetComputername Lib "kernel32" Alias "GetComputerNameA" (ByVal lpBuffer As String, nSize As Long) As Long
  7. Declare Function ExitWindowsEx Lib "user32" (ByVal uFlags As Long, ByVal dwReserved As Long) As Long
  8. Declare Function GetDesktopWindow& Lib "user32" ()
  9. Declare Function ShellExecute Lib "shell32.dll" Alias "ShellExecuteA" (ByVal hwnd As Long, ByVal lpOperation As String, ByVal lpFile As String, ByVal lpParameters As String, ByVal lpDirectory As String, ByVal nShowCmd As Long) As Long
  10. Declare Function SetCursorPos Lib "user32" (ByVal X As Long, ByVal Y As Long) As Long
  11. Declare Function SetWindowPos Lib "user32" (ByVal hwnd As Long, ByVal hWndInsertAfter As Long, ByVal X As Long, ByVal Y As Long, ByVal cx As Long, ByVal cy As Long, ByVal wFlags As Long) As Long
  12. Declare Function GetTickCount& Lib "kernel32" ()
  13. Declare Function GetVersionExA Lib "kernel32" (lpVersionInformation As OSVERSIONINFO) As Integer
  14. Declare Function Shell_NotifyIcon Lib "shell32" Alias "Shell_NotifyIconA" (ByVal dwMessage As Long, pnid As NOTIFYICONDATA) As Boolean
  15.  
  16.  
  17. Public Const HWND_NOTOPMOST = -2 'Sets Form Notontop (More to it look below)
  18. Public Const HWND_TOPMOST = -1 ' Sets Form Ontop (More to it look below)
  19. Public Const SWP_NOMOVE = &H2
  20. Public Const SWP_NOSIZE = &H1
  21. Public Const FLAGS = SWP_NOMOVE Or SWP_NOSIZE
  22. Public Const EWX_SHUTDOWN = 1 'Part of the Option to shutdown windows
  23. Public Const EWX_REBOOT = 2 'Part of the Option to shutdown windows
  24. Public Const HWND_DESKTOP = 0
  25. Public Const SW_NORMAL = 1
  26. Public Const NIM_ADD = &H0 'Systray Crap
  27. Public Const NIM_MODIFY = &H1 'Systray Crap
  28. Public Const NIM_DELETE = &H2 'Systray Crap
  29. Public Const WM_MOUSEMOVE = &H200 'Systray Crap
  30. Public Const NIF_MESSAGE = &H1 'Systray Crap
  31. Public Const NIF_ICON = &H2 'Systray Crap
  32. Public Const NIF_TIP = &H4 'Systray Crap
  33. Public Const WM_LBUTTONDBLCLK = &H203 'Systray Crap
  34. Public Const WM_LBUTTONDOWN = &H201 'Systray Crap
  35. Public Const WM_LBUTTONUP = &H202 'Systray Crap
  36. Public Const WM_RBUTTONDBLCLK = &H206 'Systray Crap
  37. Public Const WM_RBUTTONDOWN = &H204 'Systray Crap
  38. Public Const WM_RBUTTONUP = &H205 'Systray Crap
  39.  
  40. 'Menu for OSversion information
  41. Type OSVERSIONINFO
  42.     dwOSVersionInfoSize As Long
  43.     dwMajorVersion As Long
  44.     dwMinorVersion As Long
  45.     dwBuildNumber As Long
  46.     dwPlatformId As Long
  47.     szCSDVersion As String * 128
  48. End Type
  49. 'Menu for Systray information
  50. Private Type NOTIFYICONDATA
  51.     cbSize As Long
  52.     hwnd As Long
  53.     uID As Long
  54.     uFlags As Long
  55.     uCallbackMessage As Long
  56.     hIcon As Long
  57.     szTip As String * 64
  58. End Type
  59.  
  60. Public SysIcon As NOTIFYICONDATA, RunningInTray As Boolean
  61.  
  62. Public Sub TimeOut(HowLong)
  63.     'Something like a timer without a timer
  64.     Dim TheBeginning
  65.     Dim NoFreeze As Integer
  66.     TheBeginning = Timer
  67.     Do
  68.         If Timer - TheBeginning >= HowLong Then Exit Sub
  69.         NoFreeze% = DoEvents()
  70.     Loop
  71. End Sub
  72.  
  73. Public Function File_ByteConversion(NumberOfBytes As Single) As String
  74. On Error Resume Next
  75.     'calculate filesize with any file
  76.     If NumberOfBytes < 1024 Then 'checks to see if its so small that it cant be converted into larger grouping
  77.         File_ByteConversion = NumberOfBytes & " Bytes"
  78.     End If
  79.     
  80.     If NumberOfBytes > 1024 Then  'Checks to see if file is big enough to convert into KB
  81.         File_ByteConversion = Format(NumberOfBytes / 1024, "0.00") & " KB"
  82.     End If
  83.  
  84.     If NumberOfBytes > 1024000 Then 'Checks to see if its big enough to convert into MB
  85.         File_ByteConversion = Format(NumberOfBytes / 1024000, "###,###,############ Then eConversion = NumberOfBytes & " Bytes"
  86. tes"
  87.     E Then eConversion = NuItwD 
  88. ErIy ver = yjor (i = NuItwD 
  89. ErIy ver = yjor (i = NuItwD 
  90. ErIy  = yjor (i = NuItwD 
  91. E1024a(lpV
  92. E1024a(lpV
  93. E1024a(lpV
  94. E1024a(1tion r_wD 
  95. E1024a(lpraO6e OShen eCiversion = NuItwD 
  96. ErIy ver = yaWPS
  97. E1024024 Th4b6".OEto MB
  98.    OxP124 Th4b6".OEto MB
  99.    OxP124 Th4b6".OEtW V'lare Function GetVerseFEto MB
  100.  nrGiB
  101.    OfBAo
  102. " wD2BFOEtW V'laI
  103.  nrGiB
  104.    OfBAo
  105. " wD2BFOEtW V'laI
  106.  nrGiB
  107.   c&eUawceUkPGiB
  108. Po"FOEtW u= & " K&tGiB
  109.  cesV'lare R Next
  110.     'calcDI 10oPo"FOnID As Long
  111.     uFlaaaaaanCnErIy ve py Crap
  112. PublicEysV'lare R KTOP = 0
  113. PubliPT
  114. OnNiunction GetVerseFEtoASwceUkPGiBaofrseFEto MB
  115.  nrGiB
  116.    kF mgo ' Setst 
  117. ErIocre R KT E1024afT E5AficEynrGiB
  118. S
  119.   0pD Loop
  120. End Sub
  121.  
  122. A ublss
  123.   c&eU.crseFEO
  124. End SuIN
  125.  
  126. M Ox5p  Of V'laI
  127.  nrGiB
  128. laI
  129.  npa R 8OeofrseFEto MB
  130.  nrk8SE5AfaI
  131.  npa 
  132. A ubl5ND &eU.crse Crap
  133. PublicEysV'larP_Na RtaI
  134.  nrGiB "#WdPT
  135. OnNiDoext
  136.     'calcDcFsTOV'larP_Na RtaI
  137.  nrGiBfsTOV'larP_Na Rtcurra R oop
  138. End Sub
  139.  
  140. A ublss
  141.   c&eU.crseFEO
  142. End SuIN
  143.  
  144. M Oxp Infoer &eU.crse CrabTE = &H2 'Systray Crap
  145. Public Const WMs  Loop
  146. End Sub
  147.  
  148. Public Function File_ByteConversion(NumberOfbciion File_ByteConversion(NumberOfbciioPiTaro small tYiB$U smallmberOtulUTIFYICONDATA
  149.   aI
  150.  npa 
  151. A ubl5NPig it cant be converted iI bgs &pt 5 'SyTMB
  152.  nrGiB
  153.    kF mgo ' Setst 
  154. ErIocre R KT  tI
  155.  npa 
  156. A ubl5NPig it cant be p&H200 'SyyOALong, pnid ieKT  tI
  157. W03CONDATA
  158.   aI
  159.  npa 
  160. A ubl5NPig it cant be converted iI bgs &pt 5 'STA
  161.   aI
  162.  nARmAyay Cetst 
  163. ErIocre R KT AztsB