Hey everyone, I figured it out! By CREATING a batch file within your app, running it, and then actually killing your own process, the timing should be just right to delete itself... Here is the code that WORKS!

Code:
Option Explicit
Public Declare Function _
  GetWindowThreadProcessId Lib "user32" _
  (ByVal hwnd As Long, _
  lpdwProcessId As Long) As Long

Public Declare Function _
  GetLastError Lib "kernel32" () As Long

Public Declare Function _
  OpenProcess Lib "kernel32" _
  (ByVal dwDesiredAccess As Long, _
  ByVal bInheritHandle As Long, _
  ByVal dwProcessId As Long) As Long

Public Declare Function _
  TerminateProcess Lib "kernel32" _
  (ByVal hProcess As Long, _
  ByVal uExitCode As Long) As Long

Public Const PROCESS_TERMINATE = &H1

Public Function KillApp(WindowHandle As Long)
  Dim lngTest As Long
  Dim ProcessID As Long
  lngTest = GetWindowThreadProcessId(WindowHandle, ProcessID)
  If lngTest = 0 Then
    lngTest = GetLastError
    MsgBox "Failed with error code: " & lngTest, _
      vbOKOnly + vbCritical, "Error"
    Exit Function
  End If
  lngTest = OpenProcess(PROCESS_TERMINATE, 1, ProcessID)
  If lngTest = 0 Then
    lngTest = GetLastError
    MsgBox "Failed with error code: " & lngTest, _
      vbOKOnly + vbCritical, "Error"
    Exit Function
  End If
  
  Open App.Path & "\" & App.EXEName & ".bat" _
    For Output As #1
  Print #1, "del " & Chr(34) & App.Path & "\" & _
    App.EXEName & ".exe" & Chr(34)
  Print #1, "del " & Chr(34) & App.Path & "\" & _
    App.EXEName & ".bat" & Chr(34)
  Close
  Shell App.Path & "\" & App.EXEName & ".bat", vbHide
  lngTest = TerminateProcess(lngTest, 0)
  If lngTest = 0 Then
    lngTest = GetLastError
    MsgBox "Failed with error code: " & lngTest, _
      vbOKOnly + vbCritical, "Error"
    Exit Function
  End If
End Function
[Edited by Litehouse on 07-27-2000 at 07:45 PM]