📄 73.txt
字号:
使用浏览器的文件复制对话框
By John Percival
介绍
Ever wanted to use the dialog box that appears when you do file operations in Explorer? Well, it is not
that hard to work, and can be used to provide some very neat little features for your application.
One little warning before we go too much further: you can easily use this function to delete entire
directories without any confirmation; I recommend that you create some temporary directories that
you can play about with, rather than destroying any useful directories.
All the dialog boxes are based around one function, SHFileOperation. It is very easy to use, and
only has one parameter, a SHFILEOPSTRUCT user-defined type. Here are the declarations that
you will need:
Public Declare Function SHFileOperation Lib _"shell32.dll" Alias "SHFileOperationA" _(lpFileOp As Any) As LongPublic Declare Sub SHFreeNameMappings Lib _"shell32.dll" (ByVal hNameMappings As Long)Public Declare Sub CopyMemory Lib "KERNEL32" _Alias "RtlMoveMemory" (hpvDest As Any, hpvSource _As Any, ByVal cbCopy As Long)Public Type SHFILEOPSTRUCThwnd As LongwFunc As FO_FunctionspFrom As StringpTo As StringfFlags As FOF_FlagsfAnyOperationsAborted As LonghNameMappings As LonglpszProgressTitle As String 'only used if FOF_SIMPLEPROGRESSEnd TypePublic Enum FO_FunctionsFO_MOVE = &H1FO_COPY = &H2FO_DELETE = &H3FO_RENAME = &H4End EnumPublic Enum FOF_FlagsFOF_MULTIDESTFILES = &H1FOF_CONFIRMMOUSE = &H2FOF_SILENT = &H4FOF_RENAMEONCOLLISION = &H8FOF_NOCONFIRMATION = &H10FOF_WANTMAPPINGHANDLE = &H20FOF_ALLOWUNDO = &H40FOF_FILESONLY = &H80FOF_SIMPLEPROGRESS = &H100FOF_NOCONFIRMMKDIR = &H200FOF_NOERRORUI = &H400FOF_NOCOPYSECURITYATTRIBS = &H800FOF_NORECURSION = &H1000FOF_NO_CONNECTED_ELEMENTS = &H2000FOF_WANTNUKEWARNING = &H4000End EnumPublic Type SHNAMEMAPPINGpszOldPath As StringpszNewPath As StringcchOldPath As LongcchNewPath As LongEnd Type
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -