TWAIN Working Group

Newsletter Signup
Donate
Help keep TWAIN free
  • About TWAIN
    • What’s New?
    • News
    • Events
    • Membership
    • Consider a Donation
    • Contact Us
  • Why TWAIN?
  • Developers
    • Driver Developer
    • Application Developer
    • TWAIN Features
    • Specification & Tools
    • Self Certification Process
  • Support Forums
  • Scanner End-User
  • Find Certified Drivers
    • Facebook
    • LinkedIn
    • Vimeo

Reply To: OpenDSM fails when run from Citrix client

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
gabe
Participant
  • Topics - 9
  • Replies - 583
  • Total Posts - 592

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);

}

Quick Links

Service Providers
TWAIN Support Forums
Membership
Contact Us
Privacy Policy

Newsletter Signup

TWAIN Working Group Family

TWAIN Working Group
TWAIN Direct®
TWAIN Resources
TWAIN Certified Drivers
PDF/raster

  • Facebook
  • GitHub
  • LinkedIn
  • Vimeo

Recent Topics

  • EPSON V600 TWAIN and WIA on Windows 10
  • When and how to use WaitForEvents command ?
  • Problem enumerating list of installed scanners in windows server 2012
  • Failed to create TWAIN progress! Error code is 1260.
  • To get the list of scanners from javascript client side (browser)
  • Quarterly Newsletter
  • TWAIN Working Group Membership
  • Logo Usage
  • TWAIN License
  • Contact Us
Privacy Policy • Privacy Tools • Copyright © 2021 TWAIN Working Group • by iHwy, LLC • Log in