Ref: "Ap1400ProgGuide1_2.docx" Page 28 of 42
Document Revision: “1.2”
Document Date: “9 Apr. 2013”
DllInitialise
Initialise the USBPrint subsystem and LIBUSB drivers
int WINAPI DllInitialise(void);
This function prepares the LIBUSB subsystem and the USB bus for access. It loads
all necessary LIBUSB dll’s and initialises them. This function must be called once
only, prior to any other access of USBPrintDll functionality (except GetDllVersion).
In a foundation class application this call is best placed in the InitInstance function
of the CWinApp class.
None
Integer value (0 or 1) to indicate success or failure, where 0 is a failure.
If a failure occurs then DllInitialise will display a dialog explaining the problem.
In addition, the system error code is set which can be retrieved by calling
GetLastError()
//Initialise the Support DLL
if(DllInitialise())
{
//Declare & show main dialog
CUSBPrintTestDlg cUSBTestDlg(this);
m_pMainWnd=&cUSBTestDlg;
INT_PTR iResponse=cUSBTestDlg.DoModal();
//We are not bothered about the return
}
else
{
CString csError;
csError.Format(_T(“USBPrintDll failed to initialise. R/C=%d.”),
GetLastError());
AfxMessageBox(csError,MB_ICONSTOP|MB_OK);
}