求一个vb小程序代码(简单)!

2024-11-02 10:28:53
推荐回答(2个)
回答1:

清空回收站代码
Private Declare Function SHEmptyRecycleBin Lib "shell32.dll" Alias "SHEmptyRecycleBinA" _
(ByVal hwnd As Long, ByVal pszRootPath As String, ByVal dwFlags As Long) As Long
Private Declare Function SHUpdateRecycleBinIcon Lib "shell32.dll" () As Long
Private Const SHERB_NOCONFIRMATION = &H1
Private Const SHERB_NOPROGRESSUI = &H2
Private Const SHERB_NOSOUND = &H4
Private Sub Command1_Click()
Dim retval As Long ' return value
' 清空回收站, 确认
retval = SHEmptyRecycleBin(RecycleBin.hwnd, "", SHERB_NOPROGRESSUI)
' 若有错误出现,则返回回收站图示
If retval <> 0 Then ' error
retval = SHUpdateRecycleBinIcon()
End If
End Sub
Private Sub Command2_Click()
Dim retval As Long ' return value
' 清空回收站, 不确认
retval = SHEmptyRecycleBin(RecycleBin.hwnd, "", SHERB_NOCONFIRMATION)
' 若有错误出现,则返回回收站图示
If retval <> 0 Then ' error
retval = SHUpdateRecycleBinIcon()
End If
Command1_Click
End Sub

回答2:

童鞋,你是准备学VB吗?,要小程序有什么用啊。如果是初学,建议去找本书看看,网上也有神童VB教程之类都适合初学者,也有例题。
如果你是要什么功能的程序,请写出来你具体想要什么
希望对你有帮助