Print Page | Close Window

Not show the dialog with ’Report ctrl’.

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=3514
Printed Date: 23 November 2024 at 8:56am
Software Version: Web Wiz Forums 12.04 - http://www.webwizforums.com


Topic: Not show the dialog with ’Report ctrl’.
Posted By: mtsanji
Subject: Not show the dialog with ’Report ctrl’.
Date Posted: 16 January 2006 at 2:59am

Hi,

The dialog that include "Report" control doesn't display, if I use the resorce dll which I created for local use.

So far, I found that if I register the "Instance handle" and "Resouce Handle" to the windows class in CXTPReportControl::ResigterWindowClass, this problem does not occur. (Please see the code below)

Do I have to do some thing special if I want to  use the external resource file?
I don't want to change the Xtream library by my self.

Thanks,

Sanji

*1). I attach the code to see the problem. https://forum.codejock.com/uploads/mtsanji/2006-01-16_025026_Sample.zip - 2006-01-16_025026_Sample.zip  (See the "readme.txt")

*2). If I made the following changes to "CXTPReportControl" (see below), the dialog displays.

----------------------
BOOL CXTPReportControl::RegisterWindowClass()
{
 WNDCLASS wndcls;
 HINSTANCE hInst = AfxGetInstanceHandle();
 if (!(::GetClassInfo(hInst, XTPREPORTCTRL_CLASSNAME, &wndcls)))
 {
  // otherwise we need to register a new class
  wndcls.style             = CS_DBLCLKS | CS_HREDRAW | CS_VREDRAW;
  .....
 }

 // <<<< Added following code... >>>>
 hInst = AfxGetResourceHandle();
 if (!(::GetClassInfo(hInst, XTPREPORTCTRL_CLASSNAME, &wndcls)))
 {
  // otherwise we need to register a new class
  wndcls.style             = CS_DBLCLKS | CS_HREDRAW | CS_VREDRAW;
  .....
 }

 return TRUE;
}
----------------------




Replies:
Posted By: Oleg
Date Posted: 16 January 2006 at 11:54am

in last versions we added parameter


BOOL CXTPReportControl::RegisterWindowClass(HINSTANCE hInstance /*= NULL*/)
{
 WNDCLASS wndcls;
 if (hInstance == NULL) hInstance = AfxGetInstanceHandle();
 

 

to allow call it with another instance.

I can only suggest you to change sources now.



-------------
Oleg, Support Team
CODEJOCK SOFTWARE SOLUTIONS


Posted By: sserge
Date Posted: 16 January 2006 at 2:35pm
Hi Sanji,

There is no need to change library source by yourself.
In this case just change the following string in your Sample.cpp:
    if (NULL != hRes) AfxSetResourceHandle(hRes);
to
    XTPResourceManager()->SetResourceHandle(hRes);
    
Please note that the ReportControl (and others) use XTPResourceManager to load resources instead of MFC or API functions.
For more details see CXTPResourceManager class documentation.

--
Best regards,
Serge


Posted By: mtsanji
Date Posted: 17 January 2006 at 1:49am

Hi Oleg and Serge,

Thank you for your help.

If I add the CReportControl::RegisterWindowClass(<resouce handle>) to the dialog constructer and the dialog is displayed.

I tried to change the source code to use 'XTPResourceManager()->SetResourceHandle(hRes)' instead of the above but, it didn't work. It seems that the application cannot replace the resource handle.

sample: https://forum.codejock.com/uploads/mtsanji/2006-01-17_014739_Sample.zip - 2006-01-17_014739_Sample.zip

Is there any way to solve this problem except using the new RegisterWindowClass?

Thank you.

Sanji.

* Sorry for the attached "readme.txt" that included Japanese charactors...

 



Posted By: Oleg
Date Posted: 17 January 2006 at 3:32am

 

Just call RegisterWindowClass in constructor of dialog. Think you don't need to call XTPResourceManager()->SetResourceHandle



-------------
Oleg, Support Team
CODEJOCK SOFTWARE SOLUTIONS



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