From: Jason Harrison on
I'm trying to determine how to remove the standard Unidrv property
sheets from a printer preferences/properties dialog. These are the
Layout, Paper/Quality, and Advanced pages. I have by modifying
my .gpd file removed all but the Advanced page (by using
"*ConcealFromUI?: TRUE" for the features on these pages) but I am left
with the Advanced page with no entries, and non-functioning OK and
Cancel buttons.

I found a posting from a few years back suggesting a solution:
>Regarding the removal of the property sheets created by Unidrv, I've done
>this at runtime using Win32 property sheet APIs calls (done inside the
>DocumentPropertySheets() implementation). The insertion of my own property
>sheets is done right after the removal of the ones created by Unidrv, again
>using Win32 APIs. There is no patching/modification of any system components
>(such as Unidrv).

However I haven't been able to find the API calls where I can turn the
provided PPROPSHEETUI_INFO structure into something that can be used
to remove property sheets.

- no window handle for PropSheet_RemovePage
- the property sheet group provided has no pages in it

So I'm left wondering if there is some other way to get a HWND for the
property sheet dialog and send it (or one of it's children) a message
to remove the property sheet. Of course in DocumentPropertySheets, the
dialog isn't yet created so there isn't a window get...

Suggestions?
-Jason




From: Agromatic on
On Jan 15, 11:59 am, Jason Harrison <drjasonharri...(a)gmail.com> wrote:
> I'm trying to determine how to remove the standard Unidrv property
> sheets from a printer preferences/properties dialog.  These are the
> Layout, Paper/Quality, and Advanced pages.  I have by modifying
> my .gpd file removed all but the Advanced page (by using
> "*ConcealFromUI?: TRUE" for the features on these pages) but I am left
> with the Advanced page with no entries, and non-functioning OK and
> Cancel buttons.
>
> I found a posting from a few years back suggesting a solution:
>
> >Regarding the removal of the property sheets created by Unidrv, I've done
> >this at runtime using Win32 property sheet APIs calls (done inside the
> >DocumentPropertySheets() implementation). The insertion of my own property
> >sheets is done right after the removal of the ones created by Unidrv, again
> >using Win32 APIs. There is no patching/modification of any system components
> >(such as Unidrv).
>
> However I haven't been able to find the API calls where I can turn the
> provided PPROPSHEETUI_INFO structure into something that can be used
> to remove property sheets.
>
> - no window handle for PropSheet_RemovePage
> - the property sheet group provided has no pages in it
>
> So I'm left wondering if there is some other way to get a HWND for the
> property sheet dialog and send it (or one of it's children) a message
> to remove the property sheet. Of course in DocumentPropertySheets, the
> dialog isn't yet created so there isn't a window get...
>
> Suggestions?
> -Jason

There is no way to remove them, but if every item on a page is hidden,
the sheet wont be displayed.

In hrDocumentPropertyPage do this:

// Hide default items
for (DWORD i = 0; i < pOEMUIParam->cDrvOptItems; i++) {
(pOEMUIParam->pDrvOptItems + i)->Flags |= OPTIF_HIDE;
}