RunApplication

PowerBuilder Native Interface

IPB_VM interface:

RunApplication method

Description

Runs the specified application.

Syntax

RunApplication(LPCTSTR   applicationName, LPCTSTR* libraryList, pbuint numLibs, LPCSTR commandLine, IPB_Session**   session)

Argument

Description

applicationName

The name of the application object to be run, in lowercase

libraryList

The library list of the application

numLibs

The number of libraries in the library list

commandLine

Parameters to be passed to the application object

session

A pointer to IPB_Session*, which will return the current IPB_Session pointer after the call

Return Values

PBXRESULT. PBX_OK for success.

Examples

This code fragment loads the PowerBuilder VM and runs an application called runapp that uses one library, runapp.pbd. It passes in a command line with two arguments:

LRESULT CALLBACK WndProc(HWND hWnd, UINT message, WPARAM wParam, LPARAM lParam)
{
   LPCTSTR szHello = "Hello world";

// Provide command line parameters (employee ids)
// to be passed to the PowerBuilder application
   LPCTSTR szcommandline = "102 110";

   int wmId, wmEvent, ret;
   PAINTSTRUCT ps;
   HDC hdc;

   switch (message)
   {
      case WM_CREATE:
         {
         hPBVMInst = ::LoadLibrary("pbvm125.dll");

         P_PB_GetVM getvm = (P_PB_GetVM)
            GetProcAddress(hPBVMInst,"PB_GetVM");

         IPB_VM* vm = NULL;

         getvm(&vm);

         static const char *liblist [] =
            {"runapp.pbd"};
         
         vm->RunApplication("runapp", liblist, 1,
            szcommandline, &session);
         
         break;
         }

See Also