Codejock Forums Homepage
Forum Home Forum Home > Codejock Products > Visual C++ MFC > Toolkit Pro
  New Posts New Posts RSS Feed - CXTP-derived class can't get WM messages
  FAQ FAQ  Forum Search   Events   Register Register  Login Login

CXTP-derived class can't get WM messages

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


Joined: 24 November 2008
Location: Russian Federation
Status: Offline
Points: 8
Post Options Post Options   Thanks (0) Thanks(0)   Quote admitriev Quote  Post ReplyReply Direct Link To This Post Topic: CXTP-derived class can't get WM messages
    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
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: 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
Back to Top
admitriev View Drop Down
Newbie
Newbie


Joined: 24 November 2008
Location: Russian Federation
Status: Offline
Points: 8
Post Options Post Options   Thanks (0) Thanks(0)   Quote admitriev Quote  Post ReplyReply Direct Link To This Post 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...
Back to Top
admitriev View Drop Down
Newbie
Newbie


Joined: 24 November 2008
Location: Russian Federation
Status: Offline
Points: 8
Post Options Post Options   Thanks (0) Thanks(0)   Quote admitriev Quote  Post ReplyReply Direct Link To This Post 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...  
Back to Top
admitriev View Drop Down
Newbie
Newbie


Joined: 24 November 2008
Location: Russian Federation
Status: Offline
Points: 8
Post Options Post Options   Thanks (0) Thanks(0)   Quote admitriev Quote  Post ReplyReply Direct Link To This Post Posted: 10 December 2008 at 1:32am

Hi,

any updates on this issue?
 
thanks,
- Alex
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.172 seconds.