Announcement

Collapse
No announcement yet.

CreateProcess question

Collapse
X
 
  • Filter
  • Time
  • Show
Clear All
new posts

  • CreateProcess question

    Hi,

    I've got this code piece (from Semen I believe) that works just great

    Code:
    Sub ExecCmd(cmdline$)
        Dim proc As PROCESS_INFORMATION
        Dim start As STARTUPINFO
                
        ' Initialize the STARTUPINFO structure:
        start.cb = Len(start)
        ' Start the shelled application:
        ret& = CreateProcessA(0&, cmdline$, 0&, 0&, 1&, NORMAL_PRIORITY_CLASS, 0&, 0&, start, proc)
        ' Wait for the shelled application to finish:
        ret& = WaitForSingleObject(proc.hProcess, infinite)
        ret& = CloseHandle(proc.hProcess)
        
    End Sub
    In the cmdline$, I've got both the full path of the program (PBDLL.exe) as well as the .bas file to compile.
    One problem: custom installation means an option to install in C:\Program Files\ !

    This means: the break is made based on the space, so there's a message saying something : can't find Files\...

    I tried seperating the two pieces by single quote and double quotes but that doesn't work. How can I solve this ?

    BTW : W2K doesn't have this problem.


    Sincerely
    Jeroen


    ------------------

  • #2
    In a cmdline you must surround your 'long file name' with quotes
    I.e "C:\Program Files\My Dir\My File.My Ext"



    ------------------
    Fred
    mailto:[email protected][email protected]</A>
    http://www.oxenby.se

    Fred
    mailto:[email protected][email protected]</A>
    http://www.oxenby.se

    Comment


    • #3
      You're right but what about this:

      My cmdLine$ would be:

      C:\Program Files\My Dir\PBDLL.EXE C:\Program Files\My Dir\My File.bas

      To tell the compiler to handle the bas file.
      I've tried

      'C:\Program Files\My Dir\PBDLL.EXE' 'C:\Program Files\My Dir\My File.bas'
      "C:\Program Files\My Dir\PBDLL.EXE" "C:\Program Files\My Dir\My File.bas"
      "C:\Program Files\My Dir\PBDLL.EXE" C:\Program Files\My Dir\My File.bas
      C:\Program Files\My Dir\PBDLL.EXE "C:\Program Files\My Dir\My File.bas"

      It keeps saying: "C:\Program Files\My Dir\My File.bas"(0:1) Compiler file not found

      (and I'm sure this is the exact location for both files!)

      Hope someone knows

      Regards
      Jeroen



      ------------------

      Comment


      • #4
        Jeroen --
        You mix two moments.
        CreateProcess allows to use long names for exe.
        PbDll.Exe (99,9% sure) doesn't understand long names, even in "".
        Use
        Dim TmpAsciiz As Asciiz * %MAX_PATH
        GetShortPath "C:\Program Files\My Dir\My File.bas", TmpAsciiz, SizeOf(TmpAsciiz)
        CreateProcess ... Chr$(34) + "C:\Program Files\My Dir\PBDLL.EXE" + _
        Chr$(34, 32) + TmpAsciiz ...

        ------------------
        E-MAIL: [email protected]

        Comment


        • #5
          Thanks Semen, you're right!
          I solved this problem and had the problem moved on to the Includes I use.

          So the way I handled it is have the needed include files in a subdir of your app and then copy them to a fixed location. After compilation, destroy the copy.

          Thanks again
          Jeroen

          ------------------

          Comment

          Working...
          X