Solved

using twain scanner under delphi xe

Posted on 2013-01-28
6
1,638 Views
Last Modified: 2013-02-05
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
0
Comment
Question by:Buropro-Citation
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
  • 4
6 Comments
 
LVL 21

Expert Comment

by:developmentguru
ID: 38827757
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.
0
 

Author Comment

by:Buropro-Citation
ID: 38831638
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.
0
 

Author Comment

by:Buropro-Citation
ID: 38831706
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
0
Technology Partners: We Want Your Opinion!

We value your feedback.

Take our survey and automatically be enter to win anyone of the following:
Yeti Cooler, Amazon eGift Card, and Movie eGift Card!

 
LVL 27

Expert Comment

by:Sinisa Vuk
ID: 38833513
0
 

Accepted Solution

by:
Buropro-Citation earned 0 total points
ID: 38839649
I have tried the mentioned solution and it didn't worked.   I have in the meantime found the cause of the problem this morning, in delphi 5 I was able to use
TWAIN_AcquireNative(0, 0); which was the suggested way of using it on the web but now I have to send the form handle like so : TWAIN_AcquireNative(form1.Handle, 0);

This is why the createwindows function was giving an error.    As to why the eztwain.c reacts differently when it is called from delphi xe will remain a mystery.

Thank you for giving some attention to this case, it's appreciated.
0
 

Author Closing Comment

by:Buropro-Citation
ID: 38854282
I have found the answer while also trying expert solutions which, even though were good suggestions, didn't solve the problem.
0

Featured Post

Free Tool: ZipGrep

ZipGrep is a utility that can list and search zip (.war, .ear, .jar, etc) archives for text patterns, without the need to extract the archive's contents.

One of a set of tools we're offering as a way to say thank you for being a part of the community.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Suggested Solutions

Title # Comments Views Activity
Delphi - replicating a form 8 111
tidtcpserver connection lost handle 2 124
Can Live bindings change TGrid Cell Colour ? 1 61
Connect to SQL 2008 r2 server over the Internet 4 79
In this tutorial I will show you how to use the Windows Speech API in Delphi. I will only cover basic functions such as text to speech and controlling the speed of the speech. SAPI Installation First you need to install the SAPI type library, th…
Introduction Raise your hands if you were as upset with FireMonkey as I was when I discovered that there was no TListview.  I use TListView in almost all of my applications I've written, and I was not going to compromise by resorting to TStringGrid…
In an interesting question (https://www.experts-exchange.com/questions/29008360/) here at Experts Exchange, a member asked how to split a single image into multiple images. The primary usage for this is to place many photographs on a flatbed scanner…

734 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question