- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
having trouble getting app to print a dialog box like a bitmap in colour. I understand that there are common printing dialog boxes. How do you get them to open and how can the programs interface be printed not just the text/graphics it contains?
Link Copied
1 Reply
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
Here's the routine which invokes common print dialog and prints contents of window with handle hWnd. If you're using QuickWin, use GETHWNDQQ to obtain window handle:
Jugoslav
subroutine PrintWindow(hwnd) use comdlg32 use gdi32 use user32 use dfwin TYPE(T_PRINTDLG) pd TYPE(T_DOCINFO) DocInfo TYPE(T_RECT) Rect INTEGER hdc, iSt,hwnd, iXRes, iYRes hdc = GetWindowDC(hWnd) call ZeroMemory(LOC(pd), sizeof(pd)) pd%lStructSize= sizeof(pd) pd%hwndOwner= hWnd pd%Flags= PD_RETURNDC iSt=PrintDlg(pd) DocInfo%cbSize = sizeof(DOCINFO) DocInfo%lpszDocName = LOC("TEST"C) DocInfo%lpszOutput = NULL iSt=StartDoc(pd%hDC, DocInfo) iSt=StartPage(pd%hDC) iSt=GetWindowRect(hWnd,Rect) iXRes=GetDeviceCaps(pd%hDC, HORZRES) iYRes=GetDeviceCaps(pd%hDC, HORZRES) iSt=StretchBlt(pd%hdc, 0, 0, (Rect%Right-Rect%Left)*iXRes/96, & (Rect%Bottom-Rect%Top)*iYRes/96, & hDC, 0, 0, Rect%Right-Rect%Left, Rect%Bottom-Rect%Top, SRCCOPY) iSt=GetLastError() iSt=EndPage(pd%hDC) iSt=EndDoc(pd%hDC) if (pd%hDevMode /= NULL) iSt=GlobalFree(pd%hDevMode) if (pd%hDevMode /= NULL) iSt=GlobalFree(pd%hDevNames) iSt=ReleaseDC(hWnd,hdc) iSt=DeleteDC(pd%hDC) end subroutine
Jugoslav

Reply
Topic Options
- Subscribe to RSS Feed
- Mark Topic as New
- Mark Topic as Read
- Float this Topic for Current User
- Bookmark
- Subscribe
- Printer Friendly Page