Solved

Get handle of my scanner

Posted on 2010-09-08
10
1,414 Views
Last Modified: 2012-08-13
I installed an ActiveX component, but all of its functions require you to know the OLE_HANDLE of the scanner, for example:
    function ScannerAvailable(hWnd: OLE_HANDLE): WordBool;
    function OpenScanner(hWnd: OLE_HANDLE): Integer;
    function CloseScanner(hWnd: OLE_HANDLE): Integer;
The scanner is a USB scanner, how do I get its handle to start and stop scanning?

Details:
  Scanner: Fujitsu fi-60F
  IDE: Delphi 7
  ActiveX Control: Fujitsu Scanner Control (Version 5.20) FiScn.ocx
0
Comment
Question by:rfwoolf
  • 5
  • 5
10 Comments
 
LVL 13

Author Comment

by:rfwoolf
Comment Utility
FYI There is a link to the MSDN about a function  called EnumerateWiaDevices but this may be incorrect and I may need some help using this in Delphi
http://msdn.microsoft.com/en-us/library/ms629852(VS.85).aspx
0
 
LVL 13

Author Comment

by:rfwoolf
Comment Utility
There's also a Windows type library that enumerates image devices, but I'm still trying to figure out how to get a handle:
http://www.delphigroups.info/2/3/936314.html
==================================
I have imported
"Microsoft Windows Image Acquisition 1.01 Type Library"
using the Project / Import Type Library menu option. The file
WIALib_TLB.pas was created automatically.
I can get a list of cameras attached to my PC by doing:
procedure TForm1.FormCreate(Sender: TObject);
var
I: Integer;
Dev: IWiaDeviceInfo;
begin
wia.Connect;
Caption := IntToStr(wia.Devices.Count);
lb.Items.Clear;
for I := 0 to wia.Devices.Count - 1 do
begin
Dev := wia.Devices.Item[I] as IWiaDeviceInfo;
lb.Items.Add(Dev.Name + ' (' + Dev.Id + ')');
end;
end;
0
 
LVL 5

Accepted Solution

by:
briangochnauer earned 500 total points
Comment Utility
Handle to do what?

Have you read through this?
http://msdn.microsoft.com/en-us/library/ms630814(VS.85).aspx
0
 
LVL 13

Author Comment

by:rfwoolf
Comment Utility
You can see from the functions I listed in the question stuff like open scanner, see if its available, scan an image, etc
0
 
LVL 5

Expert Comment

by:briangochnauer
Comment Utility
Then you would notice that there is nothing in the documentation stating a 'handle' is available.
'Handle' is a generic term not a specification. Check the documentation for the ActiveX control you installed or contact the developer that created the ActiveX control.
Or you could always use the Microsoft API for free.
0
IT, Stop Being Called Into Every Meeting

Highfive is so simple that setting up every meeting room takes just minutes and every employee will be able to start or join a call from any room with ease. Never be called into a meeting just to get it started again. This is how video conferencing should work!

 
LVL 13

Author Comment

by:rfwoolf
Comment Utility
"Or you could always use the Microsoft API for free."
You mean Windows Image Acquisition (WIA)?
Unfortunately I couldn't find much in the way of example source code for Delphi - in fact I've spent a great deal of time trying to get the snippets of code that I *did* find to work.

"Check the documentation for the ActiveX control you installed or contact the developer that created the ActiveX control."
Yeah, unfortunately Fujitsu are dragging their feet on this - I have to pay to use their SDK but on their Japanese website they say it's free - AND the SDK comes with the scanner anyway -- well just the ActiveX library.
Here's an image:
delphi.jpg
0
 
LVL 5

Expert Comment

by:briangochnauer
Comment Utility
Upload the generated TLB file (FiScnLib_tlb.pas) and I'll take a look;
0
 
LVL 13

Author Closing Comment

by:rfwoolf
Comment Utility
Gave up
0
 
LVL 5

Expert Comment

by:briangochnauer
Comment Utility
too bad :(   I don't think you needed the and with the the component dropped on the form you should have been able to do a;
FiScn1.Scan;
or
FiScn1.Start;
or something like that.

Could have been determined by looking at the FiScnLib_tlb.pas I asked for; or sending the OCX to me;
 
0
 
LVL 5

Expert Comment

by:briangochnauer
Comment Utility
meant to say;
 don't think you needed the handle with the the component dropped on the form .
0

Featured Post

Why You Should Analyze Threat Actor TTPs

After years of analyzing threat actor behavior, it’s become clear that at any given time there are specific tactics, techniques, and procedures (TTPs) that are particularly prevalent. By analyzing and understanding these TTPs, you can dramatically enhance your security program.

Join & Write a Comment

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 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…
Internet Business Fax to Email Made Easy - With eFax Corporate (http://www.enterprise.efax.com), you'll receive a dedicated online fax number, which is used the same way as a typical analog fax number. You'll receive secure faxes in your email, fr…
This video shows how to remove a single email address from the Outlook 2010 Auto Suggestion memory. NOTE: For Outlook 2016 and 2013 perform the exact same steps. Open a new email: Click the New email button in Outlook. Start typing the address: …

762 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

Need Help in Real-Time?

Connect with top rated Experts

11 Experts available now in Live!

Get 1:1 Help Now