Since this is a MASM forum, how come I find stuff like this in here so often?
#define WIN32_LEAN_AND_MEAN
#include <windows.h>
#include <commdlg.h>
void GDIDraw_Print(HWND hWnd)
{
PRINTDLG pd = {0};
pd.lStructSize = sizeof( pd );
pd.hwndOwner = hWnd;
pd.Flags = PD_RETURNDC;
// Retrieves the printer DC
if (PrintDlg(&pd))
{
HDC hdc = pd.hDC;
StartDoc (hdc, NULL);
StartPage (hdc);
// Drawing code begin
//
RECT rc;
rc.top = 100;
rc.left = 100;
rc.bottom = 300;
rc.right = 300;
HBRUSH greenBrush=CreateSolidBrush(RGB(0,255,0));
FillRect(hdc, &rc, greenBrush);
DeleteObject(greenBrush);
//
// Drawing code end
EndPage (hdc);
EndDoc(hdc);
DeleteObject(hdc);
}
I can't help wondering.