?
Solved

using twain scanner under delphi xe

Posted on 2013-01-28
6
Medium Priority
?
1,685 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
VIDEO: THE CONCERTO CLOUD FOR HEALTHCARE

Modern healthcare requires a modern cloud. View this brief video to understand how the Concerto Cloud for Healthcare can help your organization.

 
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

Industry Leaders: 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!

Question has a verified solution.

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

A lot of questions regard threads in Delphi.   One of the more specific questions is how to show progress of the thread.   Updating a progressbar from inside a thread is a mistake. A solution to this would be to send a synchronized message to the…
Introduction The parallel port is a very commonly known port, it was widely used to connect a printer to the PC, if you look at the back of your computer, for those who don't have newer computers, there will be a port with 25 pins and a small print…
This is my first video review of Microsoft Bookings, I will be doing a part two with a bit more information, but wanted to get this out to you folks.
In this video you will find out how to export Office 365 mailboxes using the built in eDiscovery tool. Bear in mind that although this method might be useful in some cases, using PST files as Office 365 backup is troublesome in a long run (more on t…
Suggested Courses
Course of the Month10 days, 21 hours left to enroll

770 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