Solved

using twain scanner under delphi xe

Posted on 2013-01-28
6
1,655 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
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!

 
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

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!

Question has a verified solution.

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

This article explains how to create forms/units independent of other forms/units object names in a delphi project. Have you ever created a form for user input in a Delphi project and then had the need to have that same form in a other Delphi proj…
Introduction I have seen many questions in this Delphi topic area where queries in threads are needed or suggested. I know bumped into a similar need. This article will address some of the concepts when dealing with a multithreaded delphi database…
If you're a developer or IT admin, you’re probably tasked with managing multiple websites, servers, applications, and levels of security on a daily basis. While this can be extremely time consuming, it can also be frustrating when systems aren't wor…
There's a multitude of different network monitoring solutions out there, and you're probably wondering what makes NetCrunch so special. It's completely agentless, but does let you create an agent, if you desire. It offers powerful scalability …

690 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