
FAQ:
Using Windows Imaging AutomationIn Windows ME, Microsoft added Windows Image Acquisition (WIA) which is based on the Still Image libraries. WIA is included in Windows XP. Note: Still Image is not supported under Windows 98 / NT4 / 2000, and cannot be retro-installed.
WIA is a base-level subset of scanner and digicam functions including acquisition, displaying and printing of images. PiXCL 6 accesses WIA through the WIA Automation layer, which is a DLL obtainable free from Microsoft web site. Windows XP Service Pack 2 is required.
Functions include Common Dialogs for
selecting devices
Possibly the most useful is the Photo Printing Wizard, shown below, being controlled from a PiXCL application.

You can send one image or a list of image names (BMP, JPG, TIF, GIF and PNG are the only formats supported by WIA) to the Wizard, and print them all on one page, or on multiple pages. It's all seamless, and quite simple to do with a few lines of PiXCL code.
PrintingFile:
WaitInput(1)
FreeBitmapAll
DrawBackground
Image1$ = SourceDir$ + "\image1.bmp"
Image2$ = SourceDir$ + "\image2.bmp"
{print one image}
CreateCOMInstance("Wia.CommonDialog",INPROC_SERVER,"",IWiaCommonDialog)
AutomateApp(IWiaCommonDialog,"ShowPhotoPrintingWizard",METHOD,Image$,VT_BSTR,Res)
{print a set of images}
CreateCOMInstance("Wia.Vector",INPROC_SERVER,"",IWiaVector)
AutomateApp(IWiaVector,"Add",METHOD,Image1$,VT_BSTR,Res)
AutomateApp(IWiaVector,"Add",METHOD,Image2$,VT_BSTR,Res)
AutomateApp(IWiaCommonDialog,"ShowPhotoPrintingWizard",
METHOD,IWiaVector,VT_VECTOR,Res)
ReleaseDispatchInterfaceObject(IWiaVector,Res)
ReleaseCOM( ) { PiXCL 6 only needs one of these. }
Goto Wait_for_Input
If wiaaut.dll is not installed, copy the wiaaut.dll file to your System32 directory (usually located at C:\Windows\System32)
From a Command Prompt in the System32 directory run the following command:
regsvr32 wiaaut.DLL
Assuming you have some WIA devices installed, it's simple to enquire what's available with the AutomateApp command in PiXCL.
You can have any combination of Still Cameras, Scanners and Video cameras.
Checking for Video cameras will produce a dialog like this.

Select a camera, and WIA goes off to locate all images you have stored. Here, it's asking which image is to be copied to the calling application.

An image has been selected (or a new image has been captured), passed into the PiXCL application and the image displayed in the client area.

WIA also provides a Video Preview control. In fact this is a scriptable ActiveX control, and since PiXCL does not directly support ActiveX controls, we have to use the HTMLControl command instead that uses the underlying HTML rendering engine of Internet Explorer. All we need is a simple HTM file as follows:
<HTML id=dlgVideoPreview STYLE="width: 336; height: 316">
<HEAD>
<TITLE>WIA Video Preview Dialog</TITLE>
</HEAD>
<BODY>
<FONT SIZE=1 FACE="Arial">
<TABLE BORDER=1>
<TR>
<TD>
<OBJECT id="VideoPreview" width=320 height=240
classid="clsid:0B5F2CC8-5E1E-44F9-899B-3B789705AFCA">
</OBJECT>
</TD>
</TR>
<TR>
<TD ALIGN=CENTER>
<INPUT id=btnPause type=button value=Pause>
<INPUT id=btnCancel type=button value=Close>
</TD>
</TR>
</TABLE>
<SCRIPT LANGUAGE="VBScript">
Sub btnPause_OnClick()
If VideoPreview.Pause Then
VideoPreview.Pause = False
btnPause.value = "Pause"
Else
VideoPreview.Pause = True
btnPause.value = "Resume"
End If
End Sub
Sub btnCancel_OnClick()
	window.close
End Sub
</SCRIPT>
</FONT>
</BODY>
</HTML>
and a handler in the PiXCL app like this.
HTMLFileName$ = SourceDir$ + "\VideoPreview.htm"
WinGetLocation(Title$,x1,y1,x2,y2,Res) { locate the control in the app window }
x1 += 240
y1 += 100
HTMLControl(x1,y1,NOCENTER,HTMLFileName$, "",Res$, Res)
The result is an application that looks like this (Live Long and Prosper, with BOTH hands yet...).

Copyright 2008
Stewart DIBBS. All Rights Reserved.