Print Page | Close Window

CXTP-derived class can't get WM messages

Printed From: Codejock Forums
Category: Codejock Products
Forum Name: Toolkit Pro
Forum Description: Topics Related to Codejock Toolkit Pro
URL: http://forum.codejock.com/forum_posts.asp?TID=12848
Printed Date: 07 May 2025 at 7:27am
Software Version: Web Wiz Forums 12.04 - http://www.webwizforums.com


Topic: CXTP-derived class can't get WM messages
Posted By: admitriev
Subject: CXTP-derived class can't get WM messages
Date Posted: 03 December 2008 at 11:11am
Hi all,
 
A few days ago I suddenly ran into the problem I would have never imagine to happen with MFC code before.
 
There's a need to dynamically create a CXTPToolBar-derived class object with some buttons attached to it. When I finished with that and started writing the control part of my code, I found that my class object couldn't get any messages from outside (not even user-defined ones).
 
Here's how my I've been trying to do that:
 

BEGIN_MESSAGE_MAP(DynamicToolBar, CXTPToolBar)

ON_COMMAND_RANGE( ID_STD_SUMMARY_OBJECT, ID_EXT_BLOCK_OBJECT + 8, OnOptionSelect)

END_MESSAGE_MAP()

...
class DynamicToolBar: public CXTPToolBar

//DynamicToolBar message handlers

protected:

afx_msg virtual LRESULT OnControlSelected(WPARAM wParam, LPARAM lParam);

afx_msg void OnOptionSelect(UINT nID);

DECLARE_MESSAGE_MAP()

No suprises, right?  
 
And below is how I create my toolbar.  I must say that my code works in a separate DLL and I can't use CommandBars the way it's used in several samples provided by CJ.
 

// create a toolbar for the active communication

if( !communicationToolBar_.CreateToolBar(

WS_CHILD | WS_VISIBLE | CBRS_TOP | CBRS_GRIPPER |

CBRS_TOOLTIPS | CBRS_FLYBY | CBRS_SIZE_DYNAMIC,

acedGetAcadFrame()) )

{

....

where acedGetAcadFrame return a pointer to the CMDIFrameWnd object of the main application.
 
Could anybody gimme a hint on what might be wrong here and how it could be worked around?
 
many thanks for any help, guys!
- alex



Replies:
Posted By: Oleg
Date Posted: 03 December 2008 at 11:52am
Hi,
 
Our Toolbar and Standard Toolbar (I sure it will work same) send WM_COMMAND to parent/owner class - not to self.  Catch it in parent dialog/frame.


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


Posted By: admitriev
Date Posted: 04 December 2008 at 2:17am
Hi Oleg,
 
many thanks for your prompt reply. both your and standard toolbar work the way you said, indeed! However, it wouldn't have solved my issue in any case since I don't have an access to the parent frame code. What I tried to do is to override OnChildNotify method just like we used to do in MFC-based toolbars. I was really suprised when did find that the only message came into OnChildNotify was WM_PARENTNOTIFY. No WM_COMMAND messages've come into this handler. I implemented this exactly the same way we used to do toolbars for MFC code.
 
Any ideas on how this issue could be sorted out, Oleg?
 
Many thanks in advance,
- Alex 
 
P.S. I've double-checked this via Spy++ and it looks like the parent frame receives my WM_COMMAND but doesn't notify my control...


Posted By: admitriev
Date Posted: 05 December 2008 at 1:34am
hi,
 
is there anybody who could provide me with a suggestion on how to resolve this issue? it's quite urgent since it's been blocking my delivery which is always stressful enough... :)
 
if you need more details about this case, please just gimme a shout...
 
thanks,
- Alex 
 
PS I've just tried to reflect WM_COMMAND messages by putting ON_CONTROL_REFLECT into the message map of my control but it've not had any effect... :( Having surfed several internet forums, I've noticed quite a few questions related to my issue but no fully-working solution yet...  


Posted By: admitriev
Date Posted: 10 December 2008 at 1:32am

Hi,

any updates on this issue?
 
thanks,
- Alex



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