Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 8813713
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 14, 20262026-06-14T03:55:39+00:00 2026-06-14T03:55:39+00:00

I am working on a c++ browser app which will render html on the

  • 0

I am working on a c++ browser app which will render html on the app screen. I wanna to print the entire contents of the app screen (as internet explorers do). What is the proper, and easiest, way where I only pass handle to app window and it do print/pdf.

I googled this question but found only manual drawing. Is there some lib/technique where i pass handler of current window & it take care of printing text & images.

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-06-14T03:55:42+00:00Added an answer on June 14, 2026 at 3:55 am

    Windows provides the function PrintWindow for getting an image of a window. Here is an example, taken from my sources, it places a resulting screenshot into clipboard (it takes into account that the function may not be supported on some Windows versions, but it seems unimportant to the question):

    void PrintCapturedWindow(HWND hwnd)
    {
      HDC hdc = GetDC(hwnd);
      if (hdc)
      {
        HDC hdcMem = CreateCompatibleDC(hdc);
        if (hdcMem)
        {
          RECT rc;
          GetClientRect(hwnd, &rc);
    
          HBITMAP hbitmap = CreateCompatibleBitmap(hdc, rc.right-rc.left, rc.bottom-rc.top);
          ReleaseDC(hwnd, hdc); hdc = 0;
          if (hbitmap)
          {
              typedef BOOL WINAPI (* pPrintWindow)(HWND hwnd, HDC hdcBlt, UINT nFlags);
              pPrintWindow ppw;
    
              HMODULE user_hand = GetModuleHandle("user32.dll");
              ppw = (pPrintWindow)GetProcAddress(user_hand, "PrintWindow");
              if(ppw)
              {
                SelectObject(hdcMem, hbitmap);
                (*ppw)(hwnd, hdcMem, 0);
              }
    
              ::OpenClipboard(NULL);
              ::EmptyClipboard();
              ::SetClipboardData(CF_BITMAP, hbitmap);
              ::CloseClipboard();
    
              DeleteObject(hbitmap);
          }
          DeleteObject(hdcMem);
        }
        if(hdc != 0) ReleaseDC(hwnd, hdc);
      }
    }
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I'm working on a Grails 2 app, which has HTML 5 based scaffolding. For
I'm working on a new ASP.NET MVC / JQuery app which will need to
I'm working on the design of a web app which will be using AJAX
Whenever a user logs in(into an app which I've been working on), he will
I'm working on a Blackberry 5.2 browser app. I have some JavaScriptthat returns some
I am working on a Browser-based media player which is written almost entirely in
I am working on a web app which has a width of 640px. In
I'm planning on creating an app which will utilise Phonegap, however the app is
I am working on an app which I want to register in the Share
I am working on the architecture of a large enterprise application which will be

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.