WIA Wrapper

Applications, Games, Tools, User libs and useful stuff coded in PureBasic
Netvampire
New User
New User
Posts: 7
Joined: Fri Dec 29, 2006 6:52 pm
Location: Germany

WIA Wrapper

Post by Netvampire »

WIA is an Windows-API for Picturedevices like Scanners, Cameras and Videodevices. To use WIA and not TWAIN is in some cases the better decision, cause WIA has no depencies to drivers or devices. Also WIA has a Wrapper for TWAIN-Drivers included, so mostly all scanners should work without problems.
WIA has nothing to do with movies or moving pictures like videos. That means: You can shoot a picture with your Webcam but you can't write an Webcam-Application with it ;)

Now to my Wrapper:
This Wrapper isn't a wrapper, cause it doesn't map exactly all WIA-Functions. I've tried to build WIA-Procedures that feels like PB-Procedures.
Also there are some functions in WIA, that i've not implemented yet, e.g. the imagemanipulation. If someone needs them, this package should ne usefull to do them on your own 8)
To use WIA i've used COMatePLUS, all really awesome piece of code. COMate-Guys, if you read this: You rock!

All Includes and the CHM-File are in the download, also the wiaauth.chm from the WIA-SDK. Without this helpfile it's dificult to do anything with WIA, cause other documentations from MS are crap :P
Also i includes two samples to understand how to use scanners. Especially the order of doing things is important, cause WIA works with objects and we have to create them in background ...

Now to points to dislike that all :D
I don't like EnableExplicit, the Code looks like that ;) The Code is untested, cause i hadn't 100 Scanners at home and yes, this code has errors! (Your code hasn't ever errors? You are god!) Thats the first time i used COMatePLUS, be prepaired that i've done some fundamental fail :mrgreen:

http://www.net4freaks.de/purebasic/wiawrapper.zip

A Question to improve the wrapper:
I've search a way to get an WIA-Image into an PB-Image. The Object "ImageFile" has the methode "FileData" to export the data into a structure called "Vector". There is a superarray inside and i tried something with CatchImage(), but that failed. I need to write a superarray into a memorybuffer to use catchimage or something like that, but i hate pointers and direct memoryaccess :oops:
In the meantime: save the image with the wiafunction and use LoadImage() :P