📄 73.htm
字号:
<p>使用浏览器的文件复制对话框</p>
<p></p>
<p>By John Percival</p>
<p></p>
<p>介绍</p>
<p></p>
<p>Ever wanted to use the dialog box that appears when you do file operations in Explorer? Well, it is not</p>
<p>that hard to work, and can be used to provide some very neat little features for your application.</p>
<p>One little warning before we go too much further: you can easily use this function to delete entire</p>
<p>directories without any confirmation; I recommend that you create some temporary directories that</p>
<p>you can play about with, rather than destroying any useful directories.</p>
<p></p>
<p></p>
<p>All the dialog boxes are based around one function, SHFileOperation. It is very easy to use, and</p>
<p>only has one parameter, a SHFILEOPSTRUCT user-defined type. Here are the declarations that </p>
<p>you will need:</p>
<p></p>
<p>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</p>
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -