Get handle of my scanner

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?

  Scanner: Fujitsu fi-60F
  IDE: Delphi 7
  ActiveX Control: Fujitsu Scanner Control (Version 5.20) FiScn.ocx
LVL 13
Who is Participating?
briangochnauerConnect With a Mentor Commented:
Handle to do what?

Have you read through this?
rfwoolfAuthor Commented:
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
rfwoolfAuthor Commented:
There's also a Windows type library that enumerates image devices, but I'm still trying to figure out how to get a handle:
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);
I: Integer;
Dev: IWiaDeviceInfo;
Caption := IntToStr(wia.Devices.Count);
for I := 0 to wia.Devices.Count - 1 do
Dev := wia.Devices.Item[I] as IWiaDeviceInfo;
lb.Items.Add(Dev.Name + ' (' + Dev.Id + ')');
The 14th Annual Expert Award Winners

The results are in! Meet the top members of our 2017 Expert Awards. Congratulations to all who qualified!

rfwoolfAuthor Commented:
You can see from the functions I listed in the question stuff like open scanner, see if its available, scan an image, etc
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.
rfwoolfAuthor Commented:
"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:
Upload the generated TLB file (FiScnLib_tlb.pas) and I'll take a look;
rfwoolfAuthor Commented:
Gave up
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;
or something like that.

Could have been determined by looking at the FiScnLib_tlb.pas I asked for; or sending the OCX to me;
meant to say;
 don't think you needed the handle with the the component dropped on the form .
Question has a verified solution.

Are you are experiencing a similar issue? Get a personalized answer when you ask a related question.

Have a better answer? Share it in a comment.

All Courses

From novice to tech pro — start learning today.