Buropro-Citation
asked on
using twain scanner under delphi xe
Hi, I was using the free component multitwain's function called TWAIN_AcquireNative(0, 0) and it was working fine under delphi 5 but with delphi XE, the same code give an access violation 00000000.
I have attached the component even though I pretty sure there's no way it can be fixed.
I think I would probably need a new component. My goal is to be able to tell windows to open the scan document dialog and then when it's done, I need to specify via my software the name of the file and where to save it based on what was scanned.
I'm not used to interact with scanners, I would need someone to point me in the right direction.
multitwain.pas
I have attached the component even though I pretty sure there's no way it can be fixed.
I think I would probably need a new component. My goal is to be able to tell windows to open the scan document dialog and then when it's done, I need to specify via my software the name of the file and where to save it based on what was scanned.
I'm not used to interact with scanners, I would need someone to point me in the right direction.
multitwain.pas
Right off the top of my head, you will need to change PChar to PAnsiChar. In Delphi 5 PChar was a pointer to an ANSI based character string. Newer versions of Delphi use a wide char for a normal character. Once you have changed the declarations of the interface functions, you will need to make sure to assign your strings to an ansistring type of string, or use the compiler settings to limit the entire program to using ansi strings.
ASKER
Hi have replaced all pchar for pansichar but I'm not sure what you mean by changing strings to ansistrings since there is no strings variable in the multitwain.pas
Changing only pchar to pansichar didn't resolved the problem, I'll need more informations about the second part of the solution.
Changing only pchar to pansichar didn't resolved the problem, I'll need more informations about the second part of the solution.
ASKER
I have found something interesting, there is a eztwain.c which is used and when I go step by step, the error actually occurs right here (I don't see why though):
HWND CreateProxyWindow(void)
{
HWND hwnd;
hwnd = CreateWindow("STATIC", // class
"Acquire Proxy", // title
WS_POPUPWINDOW | WS_VISIBLE, // style
CW_USEDEFAULT, CW_USEDEFAULT, // x, y
CW_USEDEFAULT, CW_USEDEFAULT, // width, height
HWND_DESKTOP, // parent window
NULL, // hmenu
hinstLib, // hinst
NULL); // lpvparam
return hwnd;
} // CreateProxyWindow
Eztwain.c
HWND CreateProxyWindow(void)
{
HWND hwnd;
hwnd = CreateWindow("STATIC", // class
"Acquire Proxy", // title
WS_POPUPWINDOW | WS_VISIBLE, // style
CW_USEDEFAULT, CW_USEDEFAULT, // x, y
CW_USEDEFAULT, CW_USEDEFAULT, // width, height
HWND_DESKTOP, // parent window
NULL, // hmenu
hinstLib, // hinst
NULL); // lpvparam
return hwnd;
} // CreateProxyWindow
Eztwain.c
This probably will work for you:
http://stackoverflow.com/q uestions/2 059343/twa in-scannin g-componen ts-for-del phi
... and/or this... http://www.kluug.net/delph itwain.php
http://stackoverflow.com/q
... and/or this... http://www.kluug.net/delph
ASKER CERTIFIED SOLUTION
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
ASKER
I have found the answer while also trying expert solutions which, even though were good suggestions, didn't solve the problem.