- This topic has 16 replies, 3 voices, and was last updated 1 year, 7 months ago by Gary Ilg.
July 24, 2008 at 2:33 pm #22367
Apologies if this has already been answered or is not been asked in a proper techinical manner.
I have set up virtual machine as a Citrix server and put my application on it. I then set up a client pointing to the server from which I am running my application. I have no problems running the application in this manner (from the client) except that when I try to get a picture using a webcam, false is returned by CTwain::OpenSource.
I traced this to the fact that in InitTwain() the line CallTwainProc(&m_AppId, NULL, DG_CONTROL, DAT_PARENT, MSG_OPENDSM, (TW_MEMREF) &m_hMessageWnd); fails.
The same CTwain code works when I am running the application in a Windows environment.
As other CTwain functions like SelectSource work in the Citrix client server environment I have set up, I believe the issue is not one of my set up being incompatible with what I am trying to do.
Has anyone had this type of issue or can anyone give me some advice as to what else I can look at or configure to stop MSG_OPENDSM failing?
Thanks in advance for any helpJuly 24, 2008 at 4:04 pm #24562
I did a “GetStatus” in CTwain::CallTwainProc after the mesage fails and I get a TWCC_SEQERROR.
I guess my question is why what might cause that in a Citrix client server environment (with theserve being a virtual machine)w hen the same code doesn’t return an error running via winows.July 25, 2008 at 5:50 am #24563
typically when I’m running twain code in Citrix (or on a terminal server) the problem is in your profile’s windows directory. I would check if you loadlibrary call was successful, I imagine that either it failed or that you don’t have the .ds located under the user profile that you think you do.
If this doesn’t make sense or if you’re still having trouble post back
.July 25, 2008 at 11:05 am #24564
Thanks for your post gabe. To answer your question, loadlibrary is succesfull and I think the issue might be with the ds. I have also had a further read of ‘Twain’ to better understand how it works and it appears that the Data Source Manager is the cause of my present woes in the Citrix environment.
In trying to locate the .ds as you kindly suggested in order to copy it/them on to the Citrix srever or client, I did a search on my laptop for various files (ds, dsm, twaindsm.dll) in my user profile (i.e. C:Documents and Settingstunji) but did not come up with anything.
There are some twain dll files in C:Windows but I believe those have nothing to do with my user profile and also suspect they might not be
the ones you meant. Those files also exist on both the Citrix server and client (under C:Windows) in any case.
I believe if I can get the OPEN_DSM call to return true, I’ll have made enough progress by that stage to (hopefully) have enough knowledge of fixing any further issues with OPEN_DS.
Are there any files relating to the Data Source Manager that I need on the Citrix Server or Client AND where might they be located on my laptop?July 25, 2008 at 11:10 am #24565
In your typical vanilla nonTS machine you have C:WINDOWStwain_32 and c:WINDOWStwain_32.dll
Any/all .ds will live under C:WINDOWStwain_32
copy C:WINDOWStwain_32 to the user’s profile’s windows dir
.July 25, 2008 at 3:01 pm #24566
Gabe (and anyone else interested),
The wiatwain.ds file was already in C:WindowsTwain and the user’s profile windows directory (in my case C:Documents and Settingstest1WINDOWS) on the Citrix machine.
I then copied the 4 subdirectories from C:WindowsTwain. They are LogiVid, QuickCam, Sample and VM321) to the Citrix directories C:WindowsTwain and C:Documents and Settingstest1WINDOWS.
I ran the application again and am still getting the same issue, is there anything I have missed out?July 25, 2008 at 5:37 pm #24567
unfortunate, that was the easy fix. Who’s CTwain are you using? And what device are you testing with?
.July 28, 2008 at 9:06 am #24568
I have a couple of devices. Sony Visual Communication Camera 1.0 AND Logitech Camera 1.3.
I am not too sure what you mean by whose CTwain you are using. It appears to be a ‘standard’ CTWain file with a few modifications, none if which are in the region of the OPEN_DSM call. I am calling it a ‘standard ‘file because like other external files in the project, it doesn’t strictly conform to our coding standards.
Come to think of it, the CTwain.cpp and h files I am looking at were incorporated into our projects circa 2003. Can anyone point me to an updated set of files (cpp, h and dll)?July 29, 2008 at 4:41 am #24569
ah, yes I wasn’t sure if you were using a third party library – as you say it’s a common name.
the only update in terms of .h, .cpp, would be to just check that your twain header matches the current one from twain.org.
I would test that code against a different driver. I use and recommend Kodak’s drivers for development. The i30 is a simple enough driver that does almost everything I need to test my code with. Almost any of the drivers you get from Kodak that have ‘i’ as the first letter and are followed by 2 digits (i30, i55) have done almost everything I expect. The main reason I use and recommend them is that outside of having what appears to be the strongest support for the twain specification they support a ‘simulation mode’ where you can run the driver without hardware connected. If you seach the forum you should be able to find a couple of posts where I describe settings up simulation mode – if you need help post back.
Test you open call with the i30, post backwith your success|failure. I seem to remember testing Citrix and I if you have the drivers (the .ds) in the user’s profile that you code works on the desktop that you’ll be fine.
Then I have a question, why twain in citrix? I know why I run twain in citrix but I’m curious why you are. Most solutions don’t need or want to scan from the server room – they want a device in the user’s hand. What is your target?
.October 29, 2008 at 4:51 pm #24570
Apologies or the late reply Gabe. The application I am working on is an exectuable residing on the server and each client runs it in a citrix environment.
Said application takes pictures or scans documents at some point and that is where I am encountering problems as doing either of those from the client returns the error I initially complained about.October 30, 2008 at 6:16 am #24571
I still suspect that the wrong twain32.dll is involved. My c++ projects have little trouble with citrix, but my .net apps have a little more trouble as I don’t control which dll gets loaded. The issues that exists with my native projects have come from someone installing a driver to the server (not their profile) or to their profile and not the server. For those people I have a .config file with a switch indicating whether to load the user profile twain32.dll or the system twain32.dll. You mentioned something about wiatwain – I would disable wia for the time being as I have found that it complicates an already messy environment.
How are you determining the location of the twain32.dll?
what programming language?
.October 30, 2008 at 2:56 pm #24572
I am getting twain32.dll by using the LoadLibrary call and I am using C++.
I downloaded the twain developers toolkit and I am having the same problems trying to acquire an image over a citrix network using the twack_32 application. The error I got was ‘Error in Open, LoadLibrary, or GetProcAddress.Twain DLL may not exist’. I then copied twain_32.dll to the directory twack_32 exists and still get the same error.
My twain_32 dll is version 22.214.171.124.
Just to clarify, I don’t have a problem with other parts of my application, it is the image capture functionality that is not working over a citrix network.October 30, 2008 at 2:58 pm #24573
more specifically, how do you get the path to the twain32.dll.
.October 30, 2008 at 3:13 pm #24574
Gabe, I’m not sure if I fully understand your question but I just pass in the dll name to Loadlibrary like so –>
strLibName = _T(“TWAIN_32.DLL”);
hTwainDLL = LoadLibrary(strLibName);
LoadLibrary then searches through a whole raft of folders, in a particular order, to find the dll as below:
http://msdn.microsoft.com/en-us/library/ms682586(VS.85).aspxOctober 30, 2008 at 3:24 pm #24575
yes and depending on whether you want the user’s profile or the system you should(could?) format the call with what is returned from GetWindowsDirectory or GetSystemWindowsDirectory.
Just depends on where the drivers were installed. If the drivers were install while the system was in install mode then they should be in the system if the drivers were installed and the server wasn’t in install mode then they could have ended up under the user’s profile. It is somewhat common.