Codejock Forums Homepage
Forum Home Forum Home > Codejock Products > Visual C++ MFC > Report Control
  New Posts New Posts RSS Feed - Not show the dialog with ’Report ctrl’.
  FAQ FAQ  Forum Search   Events   Register Register  Login Login

Not show the dialog with ’Report ctrl’.

 Post Reply Post Reply
Author
Message
mtsanji View Drop Down
Newbie
Newbie


Joined: 17 August 2005
Location: Japan
Status: Offline
Points: 4
Post Options Post Options   Thanks (0) Thanks(0)   Quote mtsanji Quote  Post ReplyReply Direct Link To This Post Topic: Not show the dialog with ’Report ctrl’.
    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. 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;
}
----------------------

Back to Top
Oleg View Drop Down
Admin Group
Admin Group


Joined: 21 May 2003
Location: United States
Status: Offline
Points: 11234
Post Options Post Options   Thanks (0) Thanks(0)   Quote Oleg Quote  Post ReplyReply Direct Link To This Post 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
Back to Top
sserge View Drop Down
Moderator Group
Moderator Group


Joined: 01 December 2004
Status: Offline
Points: 1297
Post Options Post Options   Thanks (0) Thanks(0)   Quote sserge Quote  Post ReplyReply Direct Link To This Post 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
Back to Top
mtsanji View Drop Down
Newbie
Newbie


Joined: 17 August 2005
Location: Japan
Status: Offline
Points: 4
Post Options Post Options   Thanks (0) Thanks(0)   Quote mtsanji Quote  Post ReplyReply Direct Link To This Post 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: 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...

 

Back to Top
Oleg View Drop Down
Admin Group
Admin Group


Joined: 21 May 2003
Location: United States
Status: Offline
Points: 11234
Post Options Post Options   Thanks (0) Thanks(0)   Quote Oleg Quote  Post ReplyReply Direct Link To This Post 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
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.188 seconds.