Skip to content
  • Categories
  • Recent
  • Tags
  • Popular
  • World
  • Users
  • Groups
Skins
  • Light
  • Cerulean
  • Cosmo
  • Flatly
  • Journal
  • Litera
  • Lumen
  • Lux
  • Materia
  • Minty
  • Morph
  • Pulse
  • Sandstone
  • Simplex
  • Sketchy
  • Spacelab
  • United
  • Yeti
  • Zephyr
  • Dark
  • Cyborg
  • Darkly
  • Quartz
  • Slate
  • Solar
  • Superhero
  • Vapor

  • Default (No Skin)
  • No Skin
Collapse
Code Project
  1. Home
  2. General Programming
  3. ATL / WTL / STL
  4. COleDocObjectItem::OnPrint(this, pInfo, TRUE) ?

COleDocObjectItem::OnPrint(this, pInfo, TRUE) ?

Scheduled Pinned Locked Moved ATL / WTL / STL
question
2 Posts 1 Posters 0 Views 1 Watching
  • Oldest to Newest
  • Newest to Oldest
  • Most Votes
Reply
  • Reply as topic
Log in to reply
This topic has been deleted. Only users with topic management privileges can see it.
  • M Offline
    M Offline
    Mardigin
    wrote on last edited by
    #1

    I have embed excel into my application and would like to overide my onprint function. Upon entry into this function pDC->m_hAttribDC; pDC->m_hDC; Are both NULL. the CDC* pDC however is not. If I try calling onPrint before an excel spreadsheet is open, then neither member is NULL. Only when I have an excel spreadsheet open are these members NULL. Why is this so? Sincerely, Mardigin

    M 1 Reply Last reply
    0
    • M Mardigin

      I have embed excel into my application and would like to overide my onprint function. Upon entry into this function pDC->m_hAttribDC; pDC->m_hDC; Are both NULL. the CDC* pDC however is not. If I try calling onPrint before an excel spreadsheet is open, then neither member is NULL. Only when I have an excel spreadsheet open are these members NULL. Why is this so? Sincerely, Mardigin

      M Offline
      M Offline
      Mardigin
      wrote on last edited by
      #2

      Okay I was able to get the hdc in the following manner void CBPReportView::OnPrint(CDC* pDC, CPrintInfo* pInfo) { // TODO: add customized printing code here if(pInfo->m_bDocObject) { CDC * pOleDC = this->GetDC(); pDC->Attach(pOleDC->m_hDC); pDC->TextOut(100,100,"Muah ha ha h aa"); COleDocObjectItem::OnPrint(this, pInfo, TRUE); ReleaseDC(pOleDC); } else CView::OnPrint(pDC, pInfo); } Only trouble is that "muah ha ha h aa" never shows up on my printed page, only the excel spreadsheet shows up. Any ideas? Mardigin

      1 Reply Last reply
      0
      Reply
      • Reply as topic
      Log in to reply
      • Oldest to Newest
      • Newest to Oldest
      • Most Votes


      • Login

      • Don't have an account? Register

      • Login or register to search.
      • First post
        Last post
      0
      • Categories
      • Recent
      • Tags
      • Popular
      • World
      • Users
      • Groups