title: Problem with CreateDC of printer after call PageSetupDlg() function
body: <p>I am working with project in C++ WinAPI for WindowsCE 2013.
  IDE which I use is Visual Studio 2013
  I firstly initialize a PageSetupDialog in my application..
  Screen below:
  <a href="https://i.stack.imgur.com/vuHzw.png" rel="nofollow noreferrer"><img src="https://i.stack.imgur.com/vuHzw.png" alt="enter image description here" /></a></p>
  <p>Unfortunately I still have problem with start printing.
  I have assumption that problem is in CreateDC that the values from DialogBox are not forwarded to CreateDC function.
  I read in that documentation that PageSetupDlg function return DEVMODE structure, but I have no idea how to forward that to Create DC function. Thanks for Your help in this matter.
  I put definition of responsible function:</p>
  <blockquote>
  <pre><code>BOOL OknoDrukowania(HWND hWnd)
  {
      PAGESETUPDLG psd;   
      DEVMODE dm;// common dialog box structure
      // Initialize PAGESETUPDLG
      ZeroMemory(&amp;psd, sizeof(psd));
      psd.lStructSize = sizeof(psd);
      psd.hwndOwner = hWnd;
      psd.hDevMode = NULL; // Don't forget to free or store hDevMode.
      psd.hDevNames = NULL; // Don't forget to free or store hDevNames.
      psd.Flags = PSD_INTHOUSANDTHSOFINCHES | PSD_MARGINS ;
      psd.rtMargin.top = 1000;
      psd.rtMargin.left = 1250;
      psd.rtMargin.right = 1250;
      psd.rtMargin.bottom = 1000;
      //psd.lpfnPagePaintHook = PaintHook;
   
      if (PageSetupDlg(&amp;psd) == TRUE)
      {
          HDC hDC;
          hDC = CreateDC(NULL, dm.dmDeviceName, NULL, NULL);
          StartDoc(hDC, NULL);
          StartPage(hDC);
          Ellipse(hDC, 500, 500, 1000, 1000);
          Ellipse(hDC, 1000, 800, 1500, 1300);
          Ellipse(hDC, 800, 1000, 1800, 2000);
          EndPage(hDC);
          EndDoc(hDC);
          DeleteDC(hDC);  // check paper size and margin values here.
      }
      return TRUE;
   
  }
  </code></pre>
  </blockquote>