callformatdialog.bas

来自「大量优秀的vb编程」· BAS 代码 · 共 39 行

BAS
39
字号
Attribute VB_Name = "CallFormatDialog"
Public Const WM_CLOSE = &H10
 
Declare Function FindWindow Lib "user32" Alias "FindWindowA" (ByVal lpClassName As Any, ByVal lpWindowName As Any) As Long

Declare Function GetWindowsDirectory Lib "kernel32" Alias "GetWindowsDirectoryA" (ByVal lpBuffer As String, ByVal nSize As Long) As Long
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
Declare Function GetDesktopWindow Lib "user32" () As Long
Declare Function LockWindowUpdate Lib "user32" (ByVal hwndLock As Long) As Long
Declare Function GetWindowRect Lib "user32" (ByVal hwnd As Long, lpRect As RECT) As Long
Declare Sub Sleep Lib "kernel32" (ByVal dwMilliseconds As Long)
 
Type RECT
        Left As Long
        Top As Long
        Right As Long
        Bottom As Long
End Type

Type POINTAPI
        X As Long
        y As Long
End Type

Const SWP_NOSIZE = &H1
Const SWP_NOZORDER = &H4
Public Sub FormatFloppy()

Dim sBuffer As String, Windir As String, Procs As String, X
Dim lResult As Long

sBuffer = String$(255, 0)
lResult = GetWindowsDirectory(sBuffer, Len(sBuffer))

Windir = Trim(sBuffer)

Procs = Left(Windir, lResult) & "\rundll32.exe shell32.dll,SHFormatDrive"

'    Call CenterDialog("Format - 3

⌨️ 快捷键说明

复制代码Ctrl + C
搜索代码Ctrl + F
全屏模式F11
增大字号Ctrl + =
减小字号Ctrl + -
显示快捷键?