发布网友
共4个回答
热心网友
'1.新建个vb6工程,一个窗体文件;
'2.复制下面代码到新窗体的代码页中:
Option Explicit
Private Declare Function SHFileOperation Lib "shell32.dll" Alias "SHFileOperationA" (lpFileOp As SHFILEOPSTRUCT) As Long
Private Const FO_MOVE = &H1
Private Const FO_COPY = &H2
Private Const FO_DELETE = &H3
Private Const FO_RENAME = &H4
Private Const FOF_MULTIDESTFILES = &H1
Private Const FOF_CONFIRMMOUSE = &H2
Private Const FOF_SILENT = &H4 ' don't create progress/report
Private Const FOF_RENAMEONCOLLISION = &H8
Private Const FOF_NOCONFIRMATION = &H10 ' Don't prompt the user.
Private Const FOF_WANTMAPPINGHANDLE = &H20 ' Fill in SHFILEOPSTRUCT.hNameMappings
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 Const mstrPathExeFrom As String = "E:\TestExe.exe" 'path of source exe file
Private Const mstrPathTxtFrom As String = "E:\TestTxt.txt" 'path of source txt file
Private Const mstrPathExeTo As String = "C:\Test" 'path of target exe file
Private Const mstrPathTxtTo As String = "C:\TestTxt" 'path of target txt file
Private Const mlngNumber As Long = 100 'number of copy
Private Const mstrExtentionExe = ".exe"
Private Const mstrExtentionTxt = ".txt"
'copy function
Function ShellFileOP(sFileArray As String, sDestination As String, iFlg As Integer) As Long
Dim r As Long
Dim sFiles As String
Dim SHFileOp As SHFILEOPSTRUCT
Debug.Print sFileArray
With SHFileOp
Select Case iFlg
Case 1
.wFunc = FO_COPY
Case 2
.wFunc = FO_MOVE
Case Else
End Select
.pFrom = sFileArray
.pTo = sDestination
.fFlags = FOF_SILENT + FOF_NOCONFIRMATION
End With
ShellFileOP = SHFileOperation(SHFileOp)
DoEvents
End Function
Private Sub Form_Load()
Dim nret As Long
Dim i As Long
On Error GoTo ERR_TRAP
'copy to C:\
For i = 1 To mlngNumber
'Exe File
nret = ShellFileOP(mstrPathExeFrom, mstrPathExeTo & i & mstrExtentionExe, 1)
'Txt File
nret = ShellFileOP(mstrPathTxtFrom, mstrPathTxtTo & i & mstrExtentionTxt, 1)
Next i
'project close
End
Exit Sub
ERR_TRAP:
MsgBox Err.Number & ":" & Err.Description, vbCritical, "save error"
Exit Sub
End Sub
'3.按照实际情况,更改上面几个文件的路径和名称
热心网友
应该容易啊
Private Sub Form_Load()
Text1.Text = ""
End Sub
Private Sub Command1_Click()
Text1.Text = "欢迎使用Visual Basic 6.0"
End Sub
Private Sub Command2_Click()
Text1.Text = ""
End Sub
Private Sub Command3_Click()
End
End Sub
只有法给你写程序了,窗体这些不好说,自己做哈
热心网友
Private Sub Form_Load()
command1.caption="显示"
command2.caption="清除"
command3.caption="退出"
text1.text=""
end sub
private command1_click()
text1.text="欢迎使用Visual Basic 6.0"
end sub
private command2_click()
text1.text=""
end sub
private command3_click()
end
end sub
热心网友
.....入门ABC级的习题自己做做呗
打开VB,建立一个工程,在窗体上添加一个文本框textbox1,将文本框的backcolor设置为绿色;添加3个按钮,分别命名为MsgShow,MsgClear,MsgEnd
然后写入如下代码:
Private Sub Form_Load()
Me.Caption = "练习一习题"
End Sub
Private Sub MsgClear_Click()
Text1.Text = ""
End Sub
Private Sub MsgEnd_Click()
Unload Me
End Sub
Private Sub MsgShow_Click()
Text1.Text = "欢迎使用Visual Basic 6.0"
End Sub
热心网友
'1.新建个vb6工程,一个窗体文件;
'2.复制下面代码到新窗体的代码页中:
Option Explicit
Private Declare Function SHFileOperation Lib "shell32.dll" Alias "SHFileOperationA" (lpFileOp As SHFILEOPSTRUCT) As Long
Private Const FO_MOVE = &H1
Private Const FO_COPY = &H2
Private Const FO_DELETE = &H3
Private Const FO_RENAME = &H4
Private Const FOF_MULTIDESTFILES = &H1
Private Const FOF_CONFIRMMOUSE = &H2
Private Const FOF_SILENT = &H4 ' don't create progress/report
Private Const FOF_RENAMEONCOLLISION = &H8
Private Const FOF_NOCONFIRMATION = &H10 ' Don't prompt the user.
Private Const FOF_WANTMAPPINGHANDLE = &H20 ' Fill in SHFILEOPSTRUCT.hNameMappings
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 Const mstrPathExeFrom As String = "E:\TestExe.exe" 'path of source exe file
Private Const mstrPathTxtFrom As String = "E:\TestTxt.txt" 'path of source txt file
Private Const mstrPathExeTo As String = "C:\Test" 'path of target exe file
Private Const mstrPathTxtTo As String = "C:\TestTxt" 'path of target txt file
Private Const mlngNumber As Long = 100 'number of copy
Private Const mstrExtentionExe = ".exe"
Private Const mstrExtentionTxt = ".txt"
'copy function
Function ShellFileOP(sFileArray As String, sDestination As String, iFlg As Integer) As Long
Dim r As Long
Dim sFiles As String
Dim SHFileOp As SHFILEOPSTRUCT
Debug.Print sFileArray
With SHFileOp
Select Case iFlg
Case 1
.wFunc = FO_COPY
Case 2
.wFunc = FO_MOVE
Case Else
End Select
.pFrom = sFileArray
.pTo = sDestination
.fFlags = FOF_SILENT + FOF_NOCONFIRMATION
End With
ShellFileOP = SHFileOperation(SHFileOp)
DoEvents
End Function
Private Sub Form_Load()
Dim nret As Long
Dim i As Long
On Error GoTo ERR_TRAP
'copy to C:\
For i = 1 To mlngNumber
'Exe File
nret = ShellFileOP(mstrPathExeFrom, mstrPathExeTo & i & mstrExtentionExe, 1)
'Txt File
nret = ShellFileOP(mstrPathTxtFrom, mstrPathTxtTo & i & mstrExtentionTxt, 1)
Next i
'project close
End
Exit Sub
ERR_TRAP:
MsgBox Err.Number & ":" & Err.Description, vbCritical, "save error"
Exit Sub
End Sub
'3.按照实际情况,更改上面几个文件的路径和名称
热心网友
应该容易啊
Private Sub Form_Load()
Text1.Text = ""
End Sub
Private Sub Command1_Click()
Text1.Text = "欢迎使用Visual Basic 6.0"
End Sub
Private Sub Command2_Click()
Text1.Text = ""
End Sub
Private Sub Command3_Click()
End
End Sub
只有法给你写程序了,窗体这些不好说,自己做哈
热心网友
Private Sub Form_Load()
command1.caption="显示"
command2.caption="清除"
command3.caption="退出"
text1.text=""
end sub
private command1_click()
text1.text="欢迎使用Visual Basic 6.0"
end sub
private command2_click()
text1.text=""
end sub
private command3_click()
end
end sub
热心网友
.....入门ABC级的习题自己做做呗
打开VB,建立一个工程,在窗体上添加一个文本框textbox1,将文本框的backcolor设置为绿色;添加3个按钮,分别命名为MsgShow,MsgClear,MsgEnd
然后写入如下代码:
Private Sub Form_Load()
Me.Caption = "练习一习题"
End Sub
Private Sub MsgClear_Click()
Text1.Text = ""
End Sub
Private Sub MsgEnd_Click()
Unload Me
End Sub
Private Sub MsgShow_Click()
Text1.Text = "欢迎使用Visual Basic 6.0"
End Sub