Tattakashi123 / t

Automatically exported from code.google.com/p/twaindotnet
0 stars 0 forks source link

TWUNK_16.EXE ERROR #17

Open GoogleCodeExporter opened 8 years ago

GoogleCodeExporter commented 8 years ago
Windows Vista Business
Flatbed scanner Uniscan A686

1. Run TestApp.
2. Select Source.
3. Check "Use UI"
4. Click Scan button.
5. Click Scan button in scanner user interface. 

Scan never started after clicking scan button. The scanner UI can't be 
closed normally. In Windows XP, it may work correctly.

TWAIN.LOG:

TWUNK_16.EXE - ERROR   - Twunk   --InitFileLocks - Not Started By Twain
TWUNK_16.EXE - ERROR   - Twunk   --WinMain - Posting Startup Failed To 
Twain
TWAIN_32.DLL - MESSAGE - CTWTRACE--Uniscan_A686(238) to TwainDotNet(237):
TWAIN_32.DLL - MESSAGE - CTWTRACE--CONTROL, [ 0000 ], XFERREADY
TWAIN_32.DLL - ERROR   - DSM     --DSM_Entry - Invalid lpSrc
TWAIN_32.DLL - MESSAGE - CTWTRACE--Uniscan_A686(238) to TwainDotNet(237):
TWAIN_32.DLL - MESSAGE - CTWTRACE--CONTROL, [ 0000 ], CLOSEDSREQ
TWAIN_32.DLL - ERROR   - DSM     --DSM_Entry - Invalid lpSrc

Original issue reported on code.google.com by sunhongy...@gmail.com on 25 May 2010 at 8:39

GoogleCodeExporter commented 8 years ago
This Issue has been solved. 
I found twain_32.dll both in "C:\Windows\System32\" and "C:\Windows\" folder.
But in Windows XP, twain_32.dll is only found in "C:\Windows\" folder.

I add the following code to solve this issue:

[DllImport("Kernel32.dll")]
public static extern IntPtr LoadLibrary(string lpFileName);

public DataSourceManager(Identity applicationId, IWindowsMessageHook 
messageHook)
{
// Call LoadLibrary API to load twain_32.dll at first.
twLibHandler = LoadLibrary(Directory.GetParent(Environment.SystemDirectory) 
+ "//twain_32.dll");

...
...

}

Original comment by sunhongy...@gmail.com on 5 Jun 2010 at 5:44