C# SDK

◆ InitApi() [4/5]

static int InitApi ( string  strPath,
ApplicationHandler  Handler,
int  nLeft,
int  nTop,
int  nWidth,
int  nHeight,
bool  bRunInForeground,
bool  bNoCaption,
IntPtr  hParentWnd 
)
inlinestatic

The function initializes ApplicationAPI and must be called at the very first place.

Parameters
strPathFull path to application Drive.exe.
HandlerDelegate of ApplicationHandler type. Can by used to process events generated by Drive. Supported events are enumerated in ApplicationEvents enum.
nLeftx-coordinate of Drive top left corner.
nTopy-coordinate of Drive top left corner.
nWidthWidth of Drive in pixels.
nHeightHeight of Drive in pixels.
bRunInForegroundIndicates whether Drive shall be brought to foreground after initialization
bNoCaptionBorder of drive window is removed
hParentWndDefines parent window of drive. InitApi has to be in separated thread to avoid deadlock
Returns
1 if successful, other value otherwise.

The function initializes ApplicationAPI and starts Drive.exe.

This function should be called just once at the beginning. Before start Drive repeatedly use CloseApi metod.

If Handler is set to null events will not be processed.

IntPtr hwnd = (IntPtr)null;
private void MyThread()
{
unsafe
{
string strPath = C:\\Program Files\\Fleet\\Drive\\Drive.exe;
CApplicationAPI.InitApi(strPath, handler, 50, 50, 200, 200, true, false, hwnd);
}
}
hwnd = ParentWindow //for example Form1.ActiveForm.Handle;
Thread oThread = new Thread(MyThread);
oThread.Start();

InitApi is called in separated thread