Home › Forums › TWAIN Classic › OpenDSM fails when run from Citrix client › Reply To: OpenDSM fails when run from Citrix client
October 30, 2008 at 3:35 pm #24576
sloppy code example that has worked for me in the past,
BOOL IdHitThat::LoadSourceManager(BOOL bProfileAware)
{
wchar_t s[MAX_PATH];
CString szSM = _T("");
if (twState >= 2) {
return TRUE; // SM already loaded
}
if (bProfileAware) {
GetWindowsDirectory(s, sizeof(s)); /* GetWindowsDirectory is user specific in Citrix & TS */
} else {
GetSystemWindowsDirectory(s, sizeof(s));
}
szSM = s;
if ( szSM[szSM.GetLength() -1] != '\' ) {
szSM.Append(_T("\"));
}
szSM.Append((CString)DSM_FILENAME);
hDSMDLL = LoadLibrary(szSM);
if (hDSMDLL == NULL) {
std::cout << "LoadLibrary: failed" << szSM;
hDSMDLL = NULL;
}
if (hDSMDLL != NULL) {
lpDSM_Entry = (DSMENTRYPROC)GetProcAddress(hDSMDLL, DSM_ENTRYPOINT);
if (lpDSM_Entry) {
twState = 2;
} else {
std::cout << "LoadSourceManager: FAIL. Unable to GetProcAddress.n";
FreeLibrary(hDSMDLL);
hDSMDLL = NULL;
}
} else {
lpDSM_Entry = NULL;
}
if (twState != 2 ) {
std::cout << "LoadSourceManager: FAIL.n";
}
return (twState >= 2);
}