Print Page | Close Window

Issue due to SetColumnWidthWYSIWYG

Printed From: Codejock Forums
Category: Codejock Products
Forum Name: Report Control
Forum Description: Topics Related to Codejock Report Control
URL: http://forum.codejock.com/forum_posts.asp?TID=19582
Printed Date: 28 September 2024 at 11:36am
Software Version: Web Wiz Forums 12.04 - http://www.webwizforums.com


Topic: Issue due to SetColumnWidthWYSIWYG
Posted By: KumarCJ
Subject: Issue due to SetColumnWidthWYSIWYG
Date 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 - uploads/2903/Print_Diloag_Crash-Call_Stack.zip

Please help me out.

Thanks,
Saket Kumar


-------------
-- Saket Kumar



Print Page | Close Window

Forum Software by Web Wiz Forums® version 12.04 - http://www.webwizforums.com
Copyright ©2001-2021 Web Wiz Ltd. - https://www.webwiz.net