求完整的VB复制或移动文件到指定目录下
展开全部
我一个程序里的一段,供你参考一下:
Option Explicit
Private Declare Function GetDC Lib "user32" (ByVal hwnd As Long) As Long
Private Declare Function BitBlt Lib "gdi32" (ByVal hDestDC As Long, ByVal X As Long, ByVal Y As Long, ByVal nWidth As Long, ByVal nHeight As Long, ByVal hSrcDC As Long, ByVal xSrc As Long, ByVal ySrc As Long, ByVal dwRop As Long) As Long
Private Declare Function GetActiveWindow Lib "user32" () As Long
Private Sub Text1_KeyDown(KeyCode As Integer, Shift As Integer)
Dim DestDir, StrScan, nFile As String
Dim n As Integer
Dim i As Integer
Dim ff() As String
Dim fn As Long
List1.Clear
If KeyCode = 13 Then
StrScan = Text1.Text
DestDir = App.path & "\" & "batch" & Right(Val(1000 + m), 3) & "\"
If InStr(StrScan, "-GNR") Then
nFile = Left(StrScan, Len(StrScan) - 4) & "*_OutputModel_SLA.stl"
Else
nFile = StrScan & "*_OutputModel_SLA.stl"
End If
fn = FileList(App.path, nFile, ff())
For i = 1 To fn
List1.AddItem ff(i)
FileCopy ff(m), DestDir & ff(i)
Kill ff(i)
Next
End If
Text1.SetFocu
Text1.SelStart = 0
Text1.SelLength = Len(Text1)
End Sub
Option Explicit
Private Declare Function GetDC Lib "user32" (ByVal hwnd As Long) As Long
Private Declare Function BitBlt Lib "gdi32" (ByVal hDestDC As Long, ByVal X As Long, ByVal Y As Long, ByVal nWidth As Long, ByVal nHeight As Long, ByVal hSrcDC As Long, ByVal xSrc As Long, ByVal ySrc As Long, ByVal dwRop As Long) As Long
Private Declare Function GetActiveWindow Lib "user32" () As Long
Private Sub Text1_KeyDown(KeyCode As Integer, Shift As Integer)
Dim DestDir, StrScan, nFile As String
Dim n As Integer
Dim i As Integer
Dim ff() As String
Dim fn As Long
List1.Clear
If KeyCode = 13 Then
StrScan = Text1.Text
DestDir = App.path & "\" & "batch" & Right(Val(1000 + m), 3) & "\"
If InStr(StrScan, "-GNR") Then
nFile = Left(StrScan, Len(StrScan) - 4) & "*_OutputModel_SLA.stl"
Else
nFile = StrScan & "*_OutputModel_SLA.stl"
End If
fn = FileList(App.path, nFile, ff())
For i = 1 To fn
List1.AddItem ff(i)
FileCopy ff(m), DestDir & ff(i)
Kill ff(i)
Next
End If
Text1.SetFocu
Text1.SelStart = 0
Text1.SelLength = Len(Text1)
End Sub
推荐律师服务:
若未解决您的问题,请您详细描述您的问题,通过百度律临进行免费专业咨询