No announcement yet.

Call PBDLL.exe from VB

  • Filter
  • Time
  • Show
Clear All
new posts

    Call PBDLL.exe from VB

    I was wandering how to call the PBDLL.exe straight away?
    I'm working from VB 6.0. Do I use ShellExecute somehow?
    Say my file is "C:\test.bas" and I want to compile it.

    I can't find info on it (but that may be my problem..)


    This is from Pb/DLL help:

    The core compiler in PB/DLL is a command line application. It can be accessed directly, or through the IDE or Shell. To access it directly:

    From DOS (in a Win95/NT DOS box)

    Run PBDLL.EXE from the DOS prompt using a command line with the following syntax:

    PBDLL [/Ipath] [/L] [/Q] FileName

    where FileName is the name of the source file to compile. If you just type PBDLL (omitting FileName), you'll get a dialog box asking for the name of the file to compile.

    If FileName does not have an extension, PB/DLL assumes .BAS. If you don't want the file you're compiling to have an extension, you must append a period (.) to the end of FileName.

    The PB/DLL compiler is a 16-bit Windows application. Your source code files can not use long filenames, nor can you use long filenames when specifying a path. For example, if your source is located in “C:\Program Files\MyProject\myfile.bas”, you must specify the path as “c:\progra~1\myproj~1\myfile.bas” (case is not significant).

    It is important to note that programs you compile are true 32-bit Windows applications and will support long filenames. All Basic language statements that use filenames (OPEN, DIR$, NAME, KILL, etc…) will support long filenames. Only metastatements such as #INCLUDE and #RESOURCE do not support long filenames as these are interpreted at compile time.

    The /I command line option provides the compiler with a search path when looking for #INCLUDE and #RESOURCE files. See #INCLUDE and #RESOURCE for more details.

    The /L command line option causes the compiler to generate a log file with all of the compile results, including error code and error line number if an error occurs during compile time.

    The /Q command line option causes the compiler to not display a message box when compiling is finished. This should only be used with the /L option.



      Yes, i found it too, but's that not really my question.
      What I'm confused about is how to call the compiler, make sure
      the .bas file is filled in on the command line and the compile statement is
      executed, all from VB.

      It may sound strange but we generate lots of PB code by means of a VB interface.
      That's why I'd like to call the compiler directly from PB after I've generated the .bas file from VB.

      Hope you can help


      [This message has been edited by jeroen brouwers (edited July 13, 2000).]


        As I understood you correctly, you want to start Pb/DLL compiler from VB and to wait, when compilation is finished.
        Private Type STARTUPINFO
           cb As Long
           lpReserved As String
           lpDesktop As String
           lpTitle As String
           dwX As Long
           dwY As Long
           dwXSize As Long
           dwYSize As Long
           dwXCountChars As Long
           dwYCountChars As Long
           dwFillAttribute As Long
           dwFlags As Long
           wShowWindow As Integer
           cbReserved2 As Integer
           lpReserved2 As Long
           hStdInput As Long
           hStdOutput As Long
           hStdError As Long
        End Type
        Private Type PROCESS_INFORMATION
           hProcess As Long
           hThread As Long
           dwProcessID As Long
           dwThreadID As Long
        End Type
        Private Declare Function WaitForSingleObject Lib "kernel32" (ByVal _
           hHandle As Long, ByVal dwMilliseconds As Long) As Long
        Private Declare Function CreateProcessA Lib "kernel32" (ByVal _
           lpApplicationName As Long, ByVal lpCommandLine As String, ByVal _
           lpProcessAttributes As Long, ByVal lpThreadAttributes As Long, _
           ByVal bInheritHandles As Long, ByVal dwCreationFlags As Long, _
           ByVal lpEnvironment As Long, ByVal lpCurrentDirectory As Long, _
           lpStartupInfo As STARTUPINFO, lpProcessInformation As _
        Private Declare Function CloseHandle Lib "kernel32" (ByVal _
           hObject As Long) As Long
        Private Const NORMAL_PRIORITY_CLASS = &H20&
        Private Const INFINITE = -1&
        Private 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
        Private Sub Form_Load()
           ExecCmd "PbDll C:\Test.Bas"
           MsgBox "Ok"
        End Sub


          Thanks, that's what I was looking for. Gonna test it right way. Great!