-
8. Dynamic Load DLL
Compiler would not load the DLL while use dynamic load DLL, it help user to load the DLL if it exists while the
application executed. The follow is the example.
Note: Even user does not need include the header and lib file but need to know the function definition.
//////////////////////////////////////////////////////////////////////////////////////////
HINSTANCE g_hUSIDLL;
typedef BOOL (*lpfnUSI_GetScannerVersion)(LPTSTR model, LPTSTR firmware, LPTSTR sdk, int blen);
lpfnUSI_GetScannerVersion USI_GetScannerVersion;
g_hUSIDLL = LoadLibrary(L"\\Windows\\USI.dll");
if (g_hUSIDLL != NULL)
{
USI_GetScannerVersion = (lpfnUSI_GetScannerVersion)GetProcAddress(g_hUSIDLL,
TEXT("USI_GetScannerVersion"));
}
else
{
MessageBox(_T("Load library USI.dll fail"), NULL, MB_OK);
return;
}
TCHAR lstrmodel[50], lstrfirmware[50], lstrsdk[50];
if (USI_GetScannerVersion != NULL)
rc = USI_GetScannerVersion(lstrmodel, lstrfirmware, lstrsdk, sizeof(lstrmodel) + sizeof(lstrfirmware) +
sizeof(lstrsdk));
else
MessageBox(_T("USI_GetScanerVersion does not find"), NULL, MB_OK);
if (g_hUSIDLL != NULL)
FreeLibrary(g_hUSIDLL);
//////////////////////////////////////////////////////////////////////////////////////////
Summary of Contents for PA600
Page 1: ...PA600 Programming Manual V 1 6 1 11 2008...
Page 9: ...9...