Example #1
0
BOOL COleClientItem::SetPrintDevice(const PRINTDLG* ppd)
{
    ASSERT(ppd == NULL || AfxIsValidAddress(ppd, sizeof(*ppd), FALSE));
    DVTARGETDEVICE* ptd = NULL;
    if (ppd != NULL)
        ptd = _AfxOleCreateTargetDevice((PRINTDLG*)ppd);

    BOOL bResult = SetPrintDevice(ptd);
    CoTaskMemFree(ptd);
    return bResult;
}
Example #2
0
BOOL COleDocument::ApplyPrintDevice(const PRINTDLG* ppd)
{
	ASSERT_VALID(this);
	ASSERT(ppd == NULL || AfxIsValidAddress(ppd, sizeof(*ppd), FALSE));
	DVTARGETDEVICE* ptd = NULL;
	if (ppd != NULL)
		ptd = _AfxOleCreateTargetDevice((PRINTDLG*)ppd);

	BOOL bResult = ApplyPrintDevice(ptd);
	CoTaskMemFree(ptd);
	return bResult;
}
Example #3
0
DVTARGETDEVICE* AFXAPI _AfxOleCreateTargetDevice(LPPRINTDLG lpPrintDlg)
{
	DVTARGETDEVICE* ptd=NULL;
	LPDEVNAMES pDN;
	LPDEVMODE pDM;

	if ((pDN = (LPDEVNAMES)GlobalLock(lpPrintDlg->hDevNames)) == NULL)
		return NULL;

	if ((pDM = (LPDEVMODE)GlobalLock(lpPrintDlg->hDevMode)) == NULL)
	{
		GlobalUnlock(lpPrintDlg->hDevNames);
		return NULL;
	}

	ptd = _AfxOleCreateTargetDevice(pDN, pDM);

	GlobalUnlock(lpPrintDlg->hDevNames);
	GlobalUnlock(lpPrintDlg->hDevMode);

	return ptd;
}