投稿日 | : 2002/11/14(Thu) 22:38 |
投稿者 | : KKK |
Eメール | : |
URL | : |
タイトル | : FileCopyでのエラー |
いつもお世話になってます。
下のプルグラムのように、ファイルのコピーが終了するまでその先の作業を実行させないようにAPIを使っているのですが、困ったことにFileCopyのところで”Functionまたは変数が必要です”メッセージが出るのですが、何が原因なのかわかりません。
よろしくお願いします。
Public Function BuckUp()
Dim StrFileTo_Dom As String
'バックアップファイルの作成
On Error GoTo buckup_err
StrFileTo_Dom = "\\Fhit_server\G$\test.txt"
IDProcess = FileCopy(StrFileForm, StrFileTo_Dom)
ExitCode = ProcessWait(IDProcess)
If ExitCode = RC_NORMAL Then
BuckUp = RC_NORMAL←0です
Else
BuckUp = RC_ABORT←1です
Exit Function
End If
Exit Function
buckup_err:
BuckUp = RC_ABORT
End Function
Function ProcessWait(ID As Long) As Long
Dim hProcess As Long, ExitCode As Long, ret As Long
hProcess = OpenProcess(PROCESS_QUERY_INFORMATION, 1, ID)
Do
ret = GetExitCodeProcess(hProcess, ExitCode)
DoEvents
Loop While (ExitCode = STILL_ACTIVE)
ret = CloseHandle(hProcess)
ProcessWait = ExitCode
End Function