CodeGuru Home VC++ / MFC / C++ .NET / C# Visual Basic VB Forums Developer.com
Page 2 of 2 FirstFirst 12
Results 16 to 21 of 21
  1. #16
    Join Date
    Nov 2000
    Location
    Voronezh, Russia
    Posts
    6,633

    Re: Single Event Handle for Multiple Controls

    Quote Originally Posted by greekgoddj
    Well its safe to say now that ON_CONTROL_RANGE is not suitable to be used with ActiveX controls...
    Are you sure it is?

    so the new question is...What is?
    I'm not sure about what exact thing you're trying to do, but I suppose you're trying to fire some event from AX depending on the fact some of the buttons were clicked, right? Well, for this purpose you have to have message map in your AX along with the ON_CONTROL_RANGE inside, and some event which must be fired on button clicking. Apparently AX event must pass some value related to ctrlID which was clicked. Having these all you just fire AX event from inside control range handler. Easy, ain't it?
    Best regards,
    Igor

  2. #17
    Join Date
    Apr 2003
    Location
    kathmandu, nepal
    Posts
    1,570

    Re: Single Event Handle for Multiple Controls

    Did you ponder about the point that Igor made?

    ON_CONTROL_RANGE macro works for pre-defined notifications from MFC controls. I doubt that it could be extended to handle events fired by your ActiveX controls (even if your ActiveX control is generated by MFC).

    So your first approach seems quite the way i.e. using ON_EVENT in the EVENT SINK MAP

    What you need is something like ON_EVENT_RANGE and it is precisely what is available.

    Please see ON_EVENT_RANGE macro
    If there is no love sun won't shine

  3. #18
    Join Date
    Apr 1999
    Posts
    3,585

    Re: Single Event Handle for Multiple Controls

    What I meant to say is that I cannot/should not change the behaviour of the controls which are already being used in many places and different applications, just for them being used in one specific application.
    Are you aware that through versioning, you can add new functionality to a control without breaking other applications that use the control? Modifying the controls seems like the best option here. Otherwise, you'll need to look into using Windows hooks to trap any messages. And, I'm not sure that will handle everything you want.
    Gort...Klaatu, Barada Nikto!

  4. #19
    Join Date
    Dec 2004
    Location
    Leamington Spa, UK
    Posts
    202

    Talking Re: Single Event Handle for Multiple Controls

    Hi again,

    The AX controls take care of events from mouse and keyboard and everything is fine with controls themselves. When the AX controls respond to those user events(or are they messages), the AX controls fire off custom events/messages. Now my application is using many of these AX controls and wish to capture the events fired from the AX controls.

    The good news...It now works!!! What I needed was ON_EVENT_RANGE http://msdn.microsoft.com/library/de...vent_range.asp




    Thanks Igor and Mike!

    Aristotel

  5. #20
    Join Date
    Dec 2004
    Location
    Leamington Spa, UK
    Posts
    202

    Re: Single Event Handle for Multiple Controls

    Ohh..I just posted that last post and THEN saw the recommendation of ON_EVENT_RANGE!! So yes guys..that was what I needed! Thanks Mitesh
    Last edited by greekgoddj; December 22nd, 2005 at 10:39 AM.

  6. #21
    Join Date
    Jul 2010
    Posts
    1

    Red face Re: Single Event Handle for Multiple Controls

    Hi greekgoddj,

    if you have no issue then can u plz give me your code sample to handle all the db events of Axapta in my .net application.

    It will really very much helpful to me.

    Thanx in adavance.

    Regards,
    Ashlesh

Page 2 of 2 FirstFirst 12

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  





Click Here to Expand Forum to Full Width

Featured