Code:'does a file exist? Private Declare Function SHFileExists Lib "shell32" Alias "#45" (ByVal szPath As String) As Long Private Sub Form_Load() MsgBox "Does the file exist?" + Str$(SHFileExists("c:\autoexec.bat")) End SubCode:'format a drive Const SHFD_CAPACITY_DEFAULT = 0 ' default drive capacity Const SHFD_CAPACITY_360 = 3 ' 360KB, applies to 5.25" drives only Const SHFD_CAPACITY_720 = 5 ' 720KB, applies to 3.5" drives only Const SHFD_FORMAT_QUICK = 0 ' quick format Const SHFD_FORMAT_FULL = 1 ' full format Const SHFD_FORMAT_SYSONLY = 2 ' copies system files only (Win95 Only!) Private Declare Function SHFormatDrive Lib "shell32" (ByVal hwndOwner As Long, ByVal iDrive As Long, ByVal iCapacity As Long, ByVal iFormatType As Long) As Long Private Sub Form_Load() 'iDrive = The drive number to format. Drive A=0, B=1 (if present, otherwise C=1), and so on. SHFormatDrive Me.hwnd, 0, SHFD_CAPACITY_DEFAULT, SHFD_FORMAT_QUICK End SubCode:'change windows password Private Declare Function PwdChangePassword Lib "mpr" Alias "PwdChangePasswordA" (ByVal lpcRegkeyname As String, ByVal hwnd As Long, ByVal uiReserved1 As Long, ByVal uiReserved2 As Long) As Long Private Sub Form_Load() PwdChangePassword "SCRSAVE", Me.hwnd, 0, 0 End SubCode:'flash a window more than once Const FLASHW_STOP = 0 'Stop flashing. The system restores the window to its original state. Const FLASHW_CAPTION = &H1 'Flash the window caption. Const FLASHW_TRAY = &H2 'Flash the taskbar button. Const FLASHW_ALL = (FLASHW_CAPTION Or FLASHW_TRAY) 'Flash both the window caption and taskbar button. This is equivalent to setting the FLASHW_CAPTION Or FLASHW_TRAY flags. Const FLASHW_TIMER = &H4 'Flash continuously, until the FLASHW_STOP flag is set. Const FLASHW_TIMERNOFG = &HC 'Flash continuously until the window comes to the foreground. Private Type FLASHWINFO cbSize As Long hwnd As Long dwFlags As Long uCount As Long dwTimeout As Long End Type Private Declare Function FlashWindowEx Lib "user32" (pfwi As FLASHWINFO) As Boolean Private Sub Form_Load() Dim FlashInfo As FLASHWINFO 'Specifies the size of the structure. FlashInfo.cbSize = Len(FlashInfo) 'Specifies the flash status FlashInfo.dwFlags = FLASHW_ALL Or FLASHW_TIMER 'Specifies the rate, in milliseconds, at which the window will be flashed. If dwTimeout is zero, the function uses the default cursor blink rate. FlashInfo.dwTimeout = 0 'Handle to the window to be flashed. The window can be either opened or minimized. FlashInfo.hwnd = Me.hwnd 'Specifies the number of times to flash the window. FlashInfo.uCount = 0 FlashWindowEx FlashInfo End Sub Private Sub Form_Paint() Me.CurrentX = 0 Me.CurrentY = 0 Me.Print "Click me !" End Sub
those are the only good ones I found, if anybody has any other ones they would like to share, post them, Please!




Reply With Quote