vb6.0 [vb6.0] 실행돼있는 상태에서 자신 파일 삭제
페이지 정보
본문
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
Sub KillSelf()
Dim cAppPath, cTarget, strBat
cAppPath = IIf(Right(App.Path, 1) = "\", Left(App.Path, Len(App.Path) - 1), App.Path)
cTarget = cAppPath & "\Kill.bat"
strBat = _
"@echo off" & vbCrLf & _
":retry" & vbCrLf & _
"IF NOT EXIST """ & cAppPath & "\" & App.EXEName & ".exe"" goto end" & vbCrLf & _
"attrib """ & cAppPath & "\" & App.EXEName & ".exe"" -h -r -s" & vbCrLf & _
"del """ & cAppPath & "\" & App.EXEName & ".exe""" & vbCrLf & _
"IF EXIST """ & cAppPath & "\" & App.EXEName & ".exe"" goto retry" & vbCrLf & _
"@echo on" & vbCrLf & _
"cls" & vbCrLf & _
"del %0" & vbCrLf & _
"exit"
Open cTarget For Output As #1
Print #1, strBat
Close #1
ShellExecute Me.hWnd, "OPEN", cTarget, "", "", 0
End
End Sub
Private Sub Command1_Click()
KillSelf
End Sub
[출처] 실행되있는 상태에서 자신파일삭제 (고구마S) |작성자 잘모르는 초보
- 다음글[vb.net/vb6.0/vba] 유닉스 타임스템프(Timestamp) 사용하기 19.08.04
댓글목록
등록된 댓글이 없습니다.