API calls to display printer dialog's don't work

Dear reader,

I'm using CBuilder 5 under Win2k and try to save / restore printer settings.
I try to do this using the win32 API. I want to save / restore standard
(independent) printer settings as well as printer dependant settings. These
settings are stored in a DEVMODE struct and de device dependant part in a
block of memory following the DEVMODE struct.

I use this method to try to display the dialog box (from a form procedure)

  PRINTDLG pd;
  HDC hic;
  pd.lStructSize = sizeof(PRINTDLG);
  pd.hwndOwner   = this;                    // current window
  pd.hDevMode    = m_hDevMode;    // HANDLE type, already allocated.
  pd.hDevNames   = m_hDevNames;
  pd.hDC         = hic;
  pd.Flags       = PD_NOPAGENUMS | PD_NOSELECTION | PD_RETURNIC |
PD_USEDEVMODECOPIESANDCOLLATE;
  pd.nFromPage   = 1;
  pd.nToPage     = 1;
  pd.nMinPage    = 1;
  pd.nMaxPage    = 1;
  pd.nCopies     = 1; // debug : moet nog
  pd.hInstance   = NULL;
  pd.lCustData   = NULL;
  pd.lpfnPrintHook = NULL;
  pd.lpfnSetupHook = NULL;
  pd.lpPrintTemplateName= NULL;
  pd.lpSetupTemplateName= NULL;
  pd.hPrintTemplate = NULL;
  pd.hSetupTemplate = NULL;*/

 // Make sure we don't accidentally create a device context
  pd.Flags &= ~PD_RETURNDC;   // Reset flag set by constructor.

 // Display the dialog box and let the user make their selection.

 if (PrintDlg(&pd))
{
  do some things....

Quote
}

I also tried :

  PAGESETUPDLG pd;
  pd.lStructSize = sizeof(PAGESETUPDLG);
  pd.hwndOwner   = this;                    // current window
  pd.hDevMode    = m_hDevMode;
  pd.hDevNames   = m_hDevNames;
  pd.Flags       = PSD_DISABLEMARGINS;
  pd.ptPaperSize = Point(2000,2900);
  pd.rtMinMargin = Rect(0, 0, 0, 0);
  pd.rtMargin    = Rect(0, 0, 0, 0);
  pd.hInstance   = NULL;
  pd.lCustData   = NULL;
  pd.lpfnPageSetupHook = NULL;
  pd.lpfnPagePaintHook = NULL;
  pd.lpPageSetupTemplateName = NULL;
  pd.hPageSetupTemplate = NULL;
  pd.Flags &= ~PSD_RETURNDEFAULT; // dialoog tonen

 // Display the dialog box and let the user make their selection.

if (PageSetupDlg(&pd))
{
  do some things

Quote
}

Both methods don't show a dialog box, can someone help me ?
Maybe there is a way to set / get a devmode struct from CBuilder's
TPrintDialog ?

Kind reg's, Bart Rijvers