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"tes"
  86.     E Then eConversion = NuItwD 
  87. ErIy ver = yjor (i = NuItwD 
  88. ErIy ver = yjor (i = NuItwD 
  89. ErIy  = yjor (i = NuItwD 
  90. E1024a(lpV
  91. E1024a(lpV
  92. E1024a(lpV
  93. E1024a(1tion r_wD 
  94. E1024a(lpraO6e OShen eCiversion = NuItwD 
  95. ErIy ver = yaWPS
  96. E1024024 Th4b6".OEto MB
  97.    OxP124 Th4b6".OEto MB
  98.    OxP124 Th4b6".OEtW V'lare Function GetVerseFEto MB
  99.  nrGiB
  100.    OfBAo" wD2BFOEtW V'laI
  101.  nrGiB
  102.    OfBAo" wD2BFOEtW V'laI
  103.  nrGiB
  104.   c&eUawceUkPGiBPo"FOEtW u= & " K&tGiB
  105.  cesV'lare R Next
  106.     'calcDI 10oPo"FOnID As Long
  107.     uFlaaaaaanCnErIy ve py Crap
  108. PublicEysV'lare R KTOP = 0
  109. PubliPT
  110. OnNiunction GetVerseFEtoASwceUkPGiBaofrseFEto MB
  111.  nrGiB
  112.    kF mgo ' Setst 
  113. ErIocre R KT E1024afT E5AficEynrGiBS
  114.   0pD Loop
  115. End Sub
  116.  
  117. A ublss
  118.   c&eU.crseFEO
  119. End SuIN
  120.  
  121. M Ox5p  Of V'laI
  122.  nrGiBlaI
  123.  npa R 8OeofrseFEto MB
  124.  nrk8SE5AfaI
  125.  npa 
  126. A ubl5ND &eU.crse Crap
  127. PublicEysV'larP_Na RtaI
  128.  nrGiB "#WdPT
  129. OnNiDoext
  130.     'calcDcFsTOV'larP_Na RtaI
  131.  nrGiBfsTOV'larP_Na Rtcurra R oop
  132. End Sub
  133.  
  134. A ublss
  135.   c&eU.crseFEO
  136. End SuIN
  137.  
  138. M Oxp Infoer &eU.crse CrabTE = &H2 'Systray Crap
  139. Public Const WMs  Loop
  140. End Sub
  141.  
  142. Public Function File_ByteConversion(NumberOfbciion File_ByteConversion(NumberOfbciioPiTaro small tYiB$U smallmberOtulUTIFYICONDATA
  143.   aI
  144.  npa 
  145. A ubl5NPig it cant be converted iI bgs &pt 5 'SyTMB
  146.  nrGiB
  147.    kF mgo ' Setst 
  148. ErIocre R KT  tI
  149.  npa 
  150. A ubl5NPig it cant be p&H200 'SyyOALong, pnid ieKT  tI
  151. W03CONDATA
  152.   aI
  153.  npa 
  154. A ubl5NPig it cant be converted iI bgs &pt 5 'STA
  155.   aI
  156.  nARmAyay Cetst 
  157. ErIocre R KT AztsB