Re: WIA custom preview.

Tech-Archive recommends: Repair Windows Errors & Optimize Windows Performance



Thank you Tim. As you mentioned iam creating Win32 Dialog inside
IWiaUIExtension::DeviceDialog(pDialogTemplate) function.. Below is my
the code.

STDMETHODIMP
CWiaUIExtension::DeviceDialog( PDEVICEDIALOGDATA pDeviceDialogData )
{
HRESULT hr = S_OK;
IEnumWiaItem * pEnumItem = NULL;
IWiaItem * pWiaFlatbed = NULL;

MessageBox( NULL, TEXT("CWiaUIExtension::DeviceDialog is being
called"), TEXT("IWiaUIExtension"), 0 );

DialogBox(g_hInst, MAKEINTRESOURCE(IDD_CUSTOM_PREVIEW),
pDeviceDialogData->hwndParent, DialogProc);

return S_OK;
}

BOOL CALLBACK DialogProc(HWND hWnd, UINT nMsg, WPARAM wparam, LPARAM
lparam)
{
switch(nMsg)
{
case WM_INITDIALOG:
INITCOMMONCONTROLSEX iccx;
iccx.dwSize = sizeof(INITCOMMONCONTROLSEX);
iccx.dwICC = ICC_STANDARD_CLASSES;
InitCommonControlsEx(&iccx);
return TRUE;
case WM_COMMAND:
if (LOWORD(wparam) == IDC_CANCEL)
EndDialog(hWnd, LOWORD(wparam));
return TRUE;
}

return FALSE;
}

I have wrapped the above implementation in uiext.dll and this
extension dll gets installed as part of my WIA sample driver inf:
Below is the inf where i have UI extension dll entry:

[WIASample.Scanner.Services]
Include=sti.inf
Needs=STI.SerialSection.Services

[WIASample.DeviceData]
UI Class ID={6DE133D2-12AF-4201-B0CE-3485CDC54280}

[WIASample.AddReg]
HKR,,HardwareConfig,1,1
HKR,,USDClass,,"{98B3790C-0D93-4f22-ADAF-51A45B33C998}"
HKCR,CLSID\{98B3790C-0D93-4f22-ADAF-51A45B33C998},,,"WIA Sample
Scanner STI USD"
HKCR,CLSID\{98B3790C-0D93-4f22-ADAF-51A45B33C998}\InProcServer32,,,%11%
\wiascanr.dll
HKCR,CLSID\{98B3790C-0D93-4f22-
ADAF-51A45B33C998}\InProcServer32,ThreadingModel,,Both\wiascnex.dll"

HKCR,CLSID\{6DE133D2-12AF-4201-B0CE-3485CDC54280},,,"WIA Driver UI
Extension"
HKCR,CLSID\{07DD9E07-ECC0-438a-B5EB-C5227ECA910E}\shellex
\WiaDialogExtensionHandlers\{72C7DCDF-EEC5-4181-AA75-1FD015587C6A}


HKCR,CLSID\{72C7DCDF-EEC5-4181-AA75-1FD015587C6A},,,"WIA Dialog
Extension Handler"
HKCR,CLSID\{72C7DCDF-EEC5-4181-AA75-1FD015587C6A}\InProcServer32,,,%11%
\uiext.dll
HKCR,CLSID\{72C7DCDF-EEC5-4181-AA75-1FD015587C6A}
\InProcServer32,ThreadingModel,,"Both"


[WIASample.CopyFiles]
wiascanr.dll
uiext.dll


Using the above, iam able to successfully install sample scan driver
with customized preview UI dll(uiext.dll), but when i open mspaint and
select scanner as my sample scanner, i get default system UI not my
customized UI which i load in CWiaUIExtension::DeviceDialog() method.
May i know when does this function gets called. Any logs to trace the
flow.
How to get my customized preview to comeup whenever i select my sample
scanner from MSPAINT.
I would appreciate your help on this.


Thanks


On Mar 19, 9:31 am, Tim Roberts <t...@xxxxxxxxx> wrote:
msguri...@xxxxxxxxx wrote:

I want to create new preview dialog for my WIA minidriver. After
reading msdn, got to know we need to implemenet
IWiaUIExtension::DeviceDialog(pDialogTemplate) for custom preview. My
question is , is the pDialogTemplate parameter is already constructed
dialog or can we craeate a new Win32 custom preview dialog and assign
this to pDialogTemplate.

IWiaUIExtension::DeviceDialog is not passed a dialog template.  It's passed
a DEVICEDIALOGDATA, which is a WIA structure that contains the WIA item
database, and little else.  It's entirely up to the DeviceDialog structure
to create and present the dialog window.

Where did you read that it takes a dialog template?

So, when we open mspaint and select scanners from menu, do we get
customized preview?

Yes.
--
Tim Roberts, t...@xxxxxxxxx
Providenza & Boekelheide, Inc.

.



Relevant Pages

  • Re: scanning button gone
    ... I'd suggest contacting HP but you ... > When i click on insert a picture from the scanner it brings up the box ... > asks for ether web quality or print quality and then has two buttons for ... > is for custom scan, which makes the scan document 5 meg or greater, not ...
    (microsoft.public.word.docmanagement)
  • Re: OT: Looking for a document scanner that can stand 700 C
    ... scanner that can stand 700 C. ... Most electronics are ... Even the daytime temperature on the surface of the moon is only about ... put a normal scanner in a custom, ...
    (borland.public.delphi.thirdpartytools.general)
  • Re: OT: Looking for a document scanner that can stand 700 C
    ... A customer of mine needs such a scanner for a lab (that ... Most electronics ... Even the daytime temperature on the surface of the moon ... put a normal scanner in a custom, ...
    (borland.public.delphi.thirdpartytools.general)
  • Re: OT: Looking for a document scanner that can stand 700 C
    ... scanner that can stand 700 C. ... Most electronics are ... Even the daytime temperature on the surface of the moon is only about ... put a normal scanner in a custom, ...
    (borland.public.delphi.thirdpartytools.general)
  • Re: OT: Looking for a document scanner that can stand 700 C
    ... scanner that can stand 700 C. ... Most electronics are ... Even the daytime temperature on the surface of the moon is only about ... put a normal scanner in a custom, ...
    (borland.public.delphi.thirdpartytools.general)