shell能執行 執行檔
kill能刪除檔案
vb 我會建立純文字檔
可是…剛剛試一下
shell不能開資料夾(vb會說沒有檔案)
kill亦同
建資料夾…沒試過,打算晚點在試…
2005-11-11 07:41:17 · 3 個解答 · 發問者 暴走生物 1 in 電腦與網際網路 ➔ 程式設計
還有…
有無辦法開啟其他檔(例:圖/文檔)
不是讀檔…是直接開啟。
這和觀念比較沒關係
反而是看熟不熟悉函數
2005-11-11 07:48:37 · update #1
Shell 也可開啟圖/文檔,利用API來作也行:
Private Const FO_DELETE = &H3
Private Const FOF_NOCONFIRMATION = &H10
Private Const FOF_ALLOWUNDO = &H40
Private Type SHFILEOPSTRUCT
hWnd As Long
wFunc As Long
pFrom As String
pTo As String
fFlags As Integer
fAborted As Boolean
hNameMaps As Long
sProgress As String
End Type
Private Declare Function SHFileOperation Lib "shell32.dll" Alias "SHFileOperationA" (lpFileOp As SHFILEOPSTRUCT) As Long
Private Declare Function ShellExecute Lib "shell32.dll" Alias "ShellExecuteA" (ByVal hWnd As Long, ByVal lpOperation As String, ByVal lpFile As String, ByVal lpParameters As String, ByVal lpDirectory As String, ByVal nShowCmd As Long) As Long
Private Sub Command1_Click()
'開啟 C:\Test 資料夾
ShellExecute 0, vbNullString, "C:\Test\", "", "", vbNormalFocus
'開啟 C:\Test\Test.bmp 檔案
ShellExecute 0, vbNullString, "C:\Test\Test.bmp", "", "", vbNormalFocus
End Sub
'刪除資料夾(API方法)
Private Sub Command2_Click()
Dim S As SHFILEOPSTRUCT
With S
.wFunc = FO_DELETE
.pFrom = "C:\Test" '→欲刪除之資料夾
'丟到資源回收桶
.fFlags = FOF_ALLOWUNDO + FOF_NOCONFIRMATION
'直接刪除
.fFlags = FOF_NOCONFIRMATION
End With
SHFileOperation S
End Sub
'刪除資料夾(VB方法),此法若資料夾內有檔案則會產生錯誤
Private Sub Command3_Click()
RmDir "C:\Test\"
End Sub
2005-11-11 15:15:21 · answer #1 · answered by W.J.S. 7 · 0⤊ 0⤋
http://blog.xuite.net/kevin2769/jaychou/19822276
這有教學..可以看看唷(圖.文)
2008-10-07 12:31:17 · answer #2 · answered by ? 4 · 0⤊ 0⤋
嗚…看不懂。
能說詳細一點嗎
2005-11-12 06:30:05 · answer #3 · answered by 暴走生物 1 · 0⤊ 0⤋