Google Groups no longer supports new Usenet posts or subscriptions. Historical content remains viewable.
Dismiss

Regarding CPSUI

25 views
Skip to first unread message

killme

unread,
Jul 15, 2008, 5:10:05 AM7/15/08
to
Hi,

I have been implementing a printer interface DLL which uses normal Win32
dialog based property pagesinstead of CPSUI based property pages and noticed
following issues.
1. The PROPSHEETUI_REASON_SET_RESULT is never called in case of Win32
dialog based property pages. I am not sure whether there is any way to make
this get called.
2. If I open from control panel -> printer properties, the settings
changes are not saved in the DEVMODE due to problem 1. I have to explictly
save the settings using GetPrinter() functions. I believe this also is
related to (1)
What are the additional things to be done when non-CPSUI based printer
property pages are used?

Thanks.

Carey Gregory

unread,
Jul 15, 2008, 11:13:33 AM7/15/08
to
killme <kil...@discussions.microsoft.com> wrote:

> 1. The PROPSHEETUI_REASON_SET_RESULT is never called in case of Win32
>dialog based property pages. I am not sure whether there is any way to make
>this get called.

Your dialog proc should do this:


static PPSPINFO pPSPInfo;
switch (msg)
{
case WM_INITDIALOG:
pPSPInfo = PPSPINFO_FROM_WM_INITDIALOG_LPARAM(lParam);
return TRUE;

case WM_NOTIFY:
{
switch (pnmhdr->code)
{
case PSN_APPLY:
// OK or Apply button has been pressed
pPSPInfo->pfnComPropSheet(pPSPInfo->hComPropSheet,
CPSFUNC_SET_RESULT,
(LPARAM)hSheet,
CPSUI_OK);
return TRUE;

default:
break;
}
}
break;

killme

unread,
Jul 16, 2008, 1:32:12 AM7/16/08
to
Hi,

Thanks for the reply. I already tried in this manner and it worked for
same cases while not for some other:
i. In the WM_INITDIALOG, the pfnComPropSheet pointer was NULL (am I doing
anything wrong here?!.) in the PPSPINFO structure. So, instead I cached the
one I got in DrvDocumentPropertySheets(). I am not sure how safe this is.
ii. When I used this pfnComPropSheet() function in the PSN_APPLY, I have
not used the hSheet for third param but instead used NULL since I was not
sure from where I can get the hSheet value.

The above two changes worked in following case:
If I try changing the settings from some applications, the changes I do
in property pages got reflected in the applications print dialog and vice
versa. This was fine

The above two changes were not working in following case:
In Control Panel, printer preferences, If I change any printer settings
like orientation, paper size etc and click apply button, the settings are not
getting saved. I have to resort to using SetPrinter() in
PROPSHEETUI_REASON_DESTROY to save the settings explicitly which will not be
desirable since this may unnecessarily save the settings when the property
pages are launched from any application.

0 new messages