MsgBox "The drive letters available on this system are: " & vbCrLf & Msg, vbOKOnly + vbInformation, "LearnAPI"
End Sub
Private Sub cGetDriveType()
Dim Drive$, DriveType$, X&
Drive = UCase(Left(App.Path, 3))
X = GetDriveType(Drive)
Select Case X
Case 2: DriveType = "removable drive."
Case 3: DriveType = "fixed drive."
Case 4: DriveType = "remote drive."
Case 5: DriveType = "CDROM drive."
Case 6: DriveType = "ramdisk."
End Select
MsgBox "Drive " & Drive & " is a " & DriveType, vbOKOnly + vbInformation, "LearnAPI"
End Sub
Private Sub cboAPIFunction_Click()
Select Case cboAPIFunction.Text
Case "CharLower": lblDiscription.Caption = "Converts text to lowercase. Same as the Visual Basic LCase function."
Case "CharUpper": lblDiscription.Caption = "Converts text to uppercase. Same as the Visual Basic UCase function."
Case "ChooseColor": lblDiscription.Caption = "Display the Colour common dialog box using API calls."
Case "ExitWindowsEx": lblDiscription.Caption = "Exit Windows. Exit all applications and save your work before trying this command."
Case "FindExecutable": lblDiscription.Caption = "Find which application is associated with a file extension."
Case "FlashWindow": lblDiscription.Caption = "Makes the application title flash. Press Run to start and stop the flashing."
Case "GetComputerName": lblDiscription.Caption = "Displays the computer name."
Case "GetCursorPos": lblDiscription.Caption = "Finds the mouse coordinates."
Case "GetDiskFreeSpace": lblDiscription.Caption = "Returns the amount of free space available on the current drive."
Case "GetDoubleClickTime": lblDiscription.Caption = "The double-click time is the maximum number of milliseconds that may occur between the first and second click of a double-click. See also SetDoubleClickTime."
Case "GetDriveType": lblDiscription.Caption = "Returns the current drive type."
Case "GetFileAttributes": lblDiscription.Caption = "Displays the attributes of a file."
Case "GetLogicalDriveStrings": lblDiscription.Caption = "Returns the available drive letters of your computer."
Case "GetOpenFileName": lblDiscription.Caption = "Displays the Open Dialog Box using the Windows API."
Case "GetSystemDirectory": lblDiscription.Caption = "Returns the Windows System directory."
Case "GetSystemInfo": lblDiscription.Caption = "Displays the number of processors and the processor type."
Case "GetTempPath": lblDiscription.Caption = "Returns the path to the temporary directory."
Case "GetTickCount": lblDiscription.Caption = "Displays how long Windows has been running."
Case "GetUserName": lblDiscription.Caption = "Displays the user who is currently logged onto Windows."
Case "GetVersionEx": lblDiscription.Caption = "Returns the Windows version, build and service pack versions."
Case "GetVolumeInformation": lblDiscription.Caption = "Displays the volume information of the current drive."
Case "GetWindowsDirectory": lblDiscription.Caption = "Returns the path to the Windows directory."
Case "GlobalMemoryStatus": lblDiscription.Caption = "Displays the current memory status."
Case "IDECheck": lblDiscription.Caption = "This is not an API function, but I thought it could be useful. It tells you whether or not you are running within the Visual Basic IDE. You could disable shareware nag screens based on this result."
Case "InternetAutoDial": lblDiscription.Caption = "Automatically dial the Internet. Please note that this function requires Windows 95/98. If you are running Windows 95, you must have Internet Explorer 3.x or later installed."
Case "InternetAutoDialHangup": lblDiscription.Caption = "Hangup the Internet. Please note that this function requires Windows 95/98. If you are running Windows 95, you must have Internet Explorer 3.x or later installed."
Case "MessageBeep": lblDiscription.Caption = "Beep. Same as the Visual Basic beep command."
Case "PlaySound": lblDiscription.Caption = "Play a wav file."
Case "SetDoubleClickTime": lblDiscription.Caption = "The double-click time is the maximum number of milliseconds that may occur between the first and second clicks of a double-click. Default is 500. See also GetDoubleClickTime."
Case "SetWindowPos": lblDiscription.Caption = "Make LearnAPI stay on top of all other windows."
Case "Sleep": lblDiscription.Caption = "Create a delay with the Sleep command."
Case "SwapMouseButton": lblDiscription.Caption = "Swap the left and right mouse buttons."
Case "WinExec": lblDiscription.Caption = "Start Windows Explorer."
Case "-DelBinary": lblDiscription.Caption = "Del a binary value from the registry."
Case "-GetBinary": lblDiscription.Caption = "Retrieve a binary value from the registry."
Case "-SetBinary": lblDiscription.Caption = "Save a binary value to the registry."
End Select
End Sub
Private Sub cmdRun_Click()
Select Case cboAPIFunction.Text
Case "CharLower": Call cCharLower
Case "CharUpper": Call cCharUpper
Case "ChooseColor": Call cChooseColor
Case "ExitWindowsEx": Call cExitWindowsEx
Case "FindExecutable": Call cFindExecutable
Case "FlashWindow": Call cFlashWindow
Case "GetComputerName": Call cGetComputerName
Case "GetCursorPos": Call cGetCursorPos
Case "GetDiskFreeSpace": Call cGetDiskFreeSpace
Case "GetDoubleClickTime": Call cGetDoubleClickTime
Case "GetDriveType": Call cGetDriveType
Case "GetFileAttributes": Call cGetFileAttributes
Case "GetLogicalDriveStrings": Call cGetLogicalDriveStrings
Case "GetOpenFileName": Call cGetOpenFileName
Case "GetSystemDirectory": Call cGetSystemDirectory
Case "GetSystemInfo": Call cGetSystemInfo
Case "GetTempPath": Call cGetTempPath
Case "GetTickCount": Call cGetTickCount
Case "GetUserName": Call cGetUserName
Case "GetVersionEx": Call cGetVersionEx
Case "GetVolumeInformation": Call cGetVolumeInformation
Case "GetWindowsDirectory": Call cGetWindowsDirectory
Case "GlobalMemoryStatus": Call cGlobalMemoryStatus
Case "IDECheck": Call cIDECheck
Case "InternetAutoDial": Call cInternetAutodial
Case "InternetAutoDialHangup": Call cInternetAutodialHangup
Case "MessageBeep": Call cMessageBeep
Case "PlaySound": Call cPlaySound
Case "SetDoubleClickTime": Call cSetDoubleClickTime
Case "SetWindowPos": Call cSetWindowPos
Case "Sleep": Call cSleep
Case "SwapMouseButton": Call cSwapMouseButton
Case "WinExec": Call cWinExec
Case "-DelBinary": Call dfDelBinary
Case "-GetBinary": Call dfGetBinary
Case "-SetBinary": Call dfSetBinary
End Select
End Sub
Private Function fGetOpenFileName(Filter As String)
'I have made this into a function so that I can use
'it from other functions.
Dim OpenFile As OPENFILENAME, Temp$
Dim Success As Long, FileTitleLength%
OpenFile.lStructSize = Len(OpenFile)
OpenFile.hwndOwner = frmMain.hwnd
OpenFile.hInstance = App.hInstance
OpenFile.lpstrFilter = Filter
OpenFile.nFilterIndex = 1
OpenFile.lpstrFile = String(257, 0)
OpenFile.nMaxFile = Len(OpenFile.lpstrFile) - 1
OpenFile.lpstrFileTitle = OpenFile.lpstrFile
OpenFile.nMaxFileTitle = OpenFile.nMaxFile
OpenFile.lpstrTitle = "LearnAPI - Open Dialog Box"
MsgBox "The next msgbox will appear in 2 seconds.", vbOKOnly + vbInformation, "LearnAPI"
Sleep 2000
MsgBox "The sleep function can be used as a delay command.", vbOKOnly + vbInformation, "LearnAPI"
End Sub
Private Sub dfDelBinary()
Dim Result
Result = MsgBox("Are you sure you want to delete: HKEY_CURRENT_USER\Software\Longonot Software\BinaryValue?", vbYesNo + vbInformation, "LearnAPI - Code provided by Danny Falkov")
Value = getstring(HKEY_CURRENT_USER, "Software\Longonot Software", "BinaryValue")
If Value = "" Then Value = "No value found!"
MsgBox Value, vbOKOnly + vbInformation, "LearnAPI - Code provided by Danny Falkov"
End Sub
Private Sub dfSetBinary()
Dim Value$
Value = InputBox("Please enter a value between 0 and 255 to be saved as a binary value in the registry. The value will be stored in the following key: HKEY_CURRENT_USER\Software\Longonot Software\BinaryValue", "LearnAPI - Code provided by Danny Falkov")
MsgBox "The Windows Directory is: " & WinDir, vbOKOnly + vbInformation 'Display result
End Sub
Private Sub tmrFlashWindow_Timer()
FlashWindow frmMain.hwnd, True
End Sub
Private Sub cGetDoubleClickTime()
Dim Result$
Result = GetDoubleClickTime
MsgBox "The double-click time is: " & Result & " milliseconds.", vbOKOnly + vbInformation, "LearnAPI"
End Sub
Private Sub cSetDoubleClickTime()
Dim InputStr$, InputNum&
InputStr = InputBox("Please enter a value for the double-click time. The default is 500. Setting this value to low will prevent users being able to double click fast enough!", "LearnAPI", "500")
If InputStr = "" Then Exit Sub
'The next line converts string to a long
'If the string is not a number, InputNum = 0
'InputNum must be > 0 to set double-click time
InputNum = Val(InputStr)
SetDoubleClickTime (InputNum)
MsgBox "The double-click time has been changed. Use the GetDoubleClickTime function to view your change.", vbOKOnly + vbInformation, "LearnAPI"