Codejock Forums Homepage
Forum Home Forum Home > Codejock Products > Visual C++ MFC > Report Control
  New Posts New Posts RSS Feed - Issue due to SetColumnWidthWYSIWYG
  FAQ FAQ  Forum Search   Events   Register Register  Login Login

Issue due to SetColumnWidthWYSIWYG

 Post Reply Post Reply
Author
Message
KumarCJ View Drop Down
Groupie
Groupie
Avatar

Joined: 02 April 2007
Location: India
Status: Offline
Points: 96
Post Options Post Options   Thanks (0) Thanks(0)   Quote KumarCJ Quote  Post ReplyReply Direct Link To This Post Topic: Issue due to SetColumnWidthWYSIWYG
    Posted: 19 March 2012 at 4:12am
Hi

We are using "Xtreme ToolkitPro v15.1.3". We are using customized print dialog and related function. The flow of function is

BOOL CGridViewCJ::OnPreparePrinting(CPrintInfo* pInfo)
{
...
// Delete the CPrintDialog object created in the CPrintInfo

...
// Construct and substitute with customized print dialog.

....
// Set the page range

...
// Change the PRINTDLG struct so that the custom print dialog

...
// Set the flags of the PRINTDLG structure otherwise the changes will have no effect.

....
and other initializations such as paper, title

// Call another function
ABC();

}// End of OnPreparePrinting()


void CCMCGridViewCJ::ABC()
{
....
   /* get the page layout record */
   if (!GetLayoutRecord(nLayoutId, &Layout))
      return;

   int nTop, nLeft, nBottom, nRight;
   nTop     = Layout.nTopMargin; // unit is in 1000th of an inch
   nLeft    = Layout.nLeftMargin;
   nBottom  = Layout.nBottomMargin;
   nRight   = Layout.nRightMargin;

    //SK:9312
   GetPaintManager()->SetColumnWidthWYSIWYG(TRUE);
   m_pPrintOptions->GetPageHeader()->m_lfFont = *(GetLogFont(TITLEFONTINDEX));
   // assume title is at center(row1,col2).
   CString strHeaderFormat;

   // date setup
   if (Layout.bTitleDate)
      strHeaderFormat = "&d";
   else
      strHeaderFormat = g_null;

    // assume title is at center(row1,col2).
   if (Layout.bTitle)
      strHeaderFormat = strHeaderFormat + "&b" + lpMPrintOpt->szDetailString;
   else
      strHeaderFormat = g_null;

   if(!strHeaderFormat.IsEmpty())
      m_pPrintOptions->GetPageHeader()->m_strFormatString = _T(strHeaderFormat); 

      // set page count option
   CString strPageCode;
   strPageCode.LoadString(IDS_RG_PRINT_PAGE);
   m_pPrintOptions->GetPageFooter()->m_strFormatString = _T(strPageCode);
   CRect rect;
   if(m_pPrintOptions->IsMarginsMeasureInches())
   {
      rect.top = nTop;
      rect.bottom = nBottom;
      rect.left = nLeft;
      rect.right = nRight;
      m_pPrintOptions->m_rcMargins = rect;
   }
   else
   {
       rect.top = nTop/1000;
      rect.bottom = nBottom/1000;
      rect.left = nLeft/1000;
      rect.right = nRight/1000;
        m_pPrintOptions->m_rcMargins =  rect;
   }

}


The above functions flow works OK and display the Print dialog on WIN XP, But the when we tried to build the application (32 bits) on WIN 7 (64 bits) and run the exe in debug/release mode, then after displaying the Print Dialog application get crashed on WIN 7 (64 bits).

[Note: above 2 function is for 32bit application ]

call to "GetPaintManager()->SetColumnWidthWYSIWYG(TRUE);" leads to "CXTPReportPaintManager::GetPrintPageWidth()" and then it fails.

I observe that "GetPrinterDeviceDefaults(...)" get called from our own function flow and also due to "GetPaintManager()->SetColumnWidthWYSIWYG(TRUE);" in ABC(..) function.

Please see the attached call stack "Print Diloag Crash-Call Stack.zip"
uploads/2903/Print_Diloag_Crash-Call_Stack.zip

Please help me out.

Thanks,
Saket Kumar
-- Saket Kumar
Back to Top
 Post Reply Post Reply
  Share Topic   

Forum Jump Forum Permissions View Drop Down

Forum Software by Web Wiz Forums® version 12.04
Copyright ©2001-2021 Web Wiz Ltd.

This page was generated in 0.141 seconds.