Re: CreateProcess Fails With No Error

Tech Tip: Click here to run a free scan for Windows Errors and optimize PC performance



Steve Cooper wrote:
Why is it that the following call:-

lngRet = CreateProcess(0&, "TestProg.EXE", 0&, 0&, 1&, NORMAL_PRIORITY_CLASS, 0&, 0&, start, proc)

Always works from within one VB6 program but in another always returns zero and proc.hProcess = 0 yet a call to GetLastError returns zero.

In both programs start is set up as follows:-

    start.cb = Len(start)
    start.wShowWindow = SHOWNORMAL

the CreateProcess and GetLastError headers, PROCESS_INFORMATION and STARTUPINFO structures and the NORMAL_PRIORITY_CLASS, SHOWNORMAL constants are declared in EXACTLY the same way (one is copied and pasted from the other). TestProg.EXE is present in both project folders and is exactly the same in each.

THANKS

Are you using the API call GetLastError?
If so, replace it by Err.LastDllError and see what value you get there.
GetLastError API is not usable in VB since the RunTime calls it itself.


Sinna .



Relevant Pages

  • RE: CreateProcess Fails With No Error
    ... contained in CurDir (which CreateProcess looks in if only a partial file spec ... > Always works from within one VB6 program but in another always returns zero ... > STARTUPINFO structures and the NORMAL_PRIORITY_CLASS, SHOWNORMAL constants ...
    (microsoft.public.vb.bugs)
  • Create Process Fails Without Error
    ... Always works from within one VB6 program but in another always returns zero ... SHOWNORMAL constants ...
    (microsoft.public.win32.programmer.kernel)
  • CreateProcess Fails With No Error
    ... Always works from within one VB6 program but in another always returns zero ... SHOWNORMAL constants ...
    (microsoft.public.vb.bugs)