ShowPrintPreviewDlg Example for C++ 5.0 and later

void CDialogs::OnShowPrintPreviewDlg()
{
	HRESULT hr;
	int nRet;

	ILEADRasterDlgKrn_U *m_pRasterDlgKrn = NULL;
	hr = CoCreateInstance(CLSID_LEADRasterDlgKrn_U,
		NULL,
		CLSCTX_ALL,
		IID_ILEADRasterDlgKrn_U,
		(LPVOID*)&m_pRasterDlgKrn);

	ILEADRasterDlgFile_U *m_pRasterDlgFile = NULL;
	hr = CoCreateInstance(CLSID_LEADRasterDlgFile_U,
		NULL,
		CLSCTX_ALL,
		IID_ILEADRasterDlgFile_U,
		(LPVOID*)&m_pRasterDlgFile);

	nRet = m_pRasterDlgKrn->InitDlg(INIT_WITH_COLOR);

	m_pRasterDlgFile->MarginsTop = 0; 
	m_pRasterDlgFile->MarginsLeft = 0; 
	m_pRasterDlgFile->MarginsWidth = 320; 
	m_pRasterDlgFile->MarginsHeight = 240; 

	m_pRasterDlgFile->MinMarginsTop = 0; 
	m_pRasterDlgFile->MinMarginsLeft = 0; 
	m_pRasterDlgFile->MinMarginsWidth = 100; 
	m_pRasterDlgFile->MinMarginsHeight = 100; 

	m_pRasterDlgFile->Bitmap = m_pLead1.GetBitmap();

	m_pRasterDlgFile->ShowPrintPreviewDlg((long)this->m_hWnd); 
}