Set actionlist actions using Windows Messages

Posted on 2011-10-14
Last Modified: 2012-05-12
Hi all,

I've build a plug-in for another application which fills edit boxes with default entry values. This works fine.
But now I want to extend this function by disabling/enabling some actions in the other application's action list to apply some business rules.

Is there a way I can also set values to non-visual components through Windows Messages?

Thanks in advance,

Question by:JeePeeTee
    LVL 32

    Expert Comment


    If the host application exposes methods to handle its controls, then you can use those.
    Otherwise you have to know the handle of the control you want to modify and use PostMessage.

    The challenge is how to find the handle of the component and therein is the problem!
    LVL 21

    Expert Comment

    If you can compile the other application then you can add in your own message handling.  This would easily allow you to do what you are attempting.  The problem is that non visual controls tend to be non windows controls.  This means that normal message handling assumptions may not apply.  As ewangoya stated, your only other recourse would be to use an API the application provides.
    LVL 4

    Author Comment

    Unfortunately, I can't compile the other program and it's API is insufficient. That's why I try to work around it. I know the application is programmed in Delphi as well, but that's about everything I know.

    So, you say that non-visual components can't be controlled by Windows Messages, because they are not native Windows Controls? But in the other program the buttons are attached to an action list. How are these attached actions controlled during run-time, since the attached buttons are Windows Controls?

    LVL 21

    Accepted Solution

     As I understand it, the action list works based on the idle time of the application.  During this time the action list is scanned to see if a matching hot key is pressed to trigger activation of the event.  When a button has the action property set for a specific action then the OnClick event of the button is set to the Execute event of the action.  So, if the button is clicked then the action event is called.  If a hot key combination is pressed then the action list calls the event.

      Actions can be used with non visual controls too.  This, by itself, makes it obvious that Windows messages are not how the effect is implemented.

      If the user interface is not going to change, and you know the control you want to make use of is non-visual, then you can send a mouse down and mouse up at the relative coordinates of the non visual control.  Delphi interprets the coordinates to cause the click for the non visual control.

      I would really classify that type of programming as reckless.  It is too easily broken.
    LVL 4

    Author Closing Comment

    Ok, thanks for all the info developmentguru.

    Guess I have to find some other ways.

    Featured Post

    Better Security Awareness With Threat Intelligence

    See how one of the leading financial services organizations uses Recorded Future as part of a holistic threat intelligence program to promote security awareness and proactively and efficiently identify threats.

    Join & Write a Comment

    Creating an auto free TStringList The TStringList is a basic and frequently used object in Delphi. On many occasions, you may want to create a temporary list, process some items in the list and be done with the list. In such cases, you have to…
    Hello everybody This Article will show you how to validate number with TEdit control, What's the TEdit control? TEdit is a standard Windows edit control on a form, it allows to user to write, read and copy/paste single line of text. Usua…
    Access reports are powerful and flexible. Learn how to create a query and then a grouped report using the wizard. Modify the report design after the wizard is done to make it look better. There will be another video to explain how to put the final p…
    Polish reports in Access so they look terrific. Take yourself to another level. Equations, Back Color, Alternate Back Color. Write easy VBA Code. Tighten space to use less pages. Launch report from a menu, considering criteria only when it is filled…

    728 members asked questions and received personalized solutions in the past 7 days.

    Join the community of 500,000 technology professionals and ask your questions.

    Join & Ask a Question

    Need Help in Real-Time?

    Connect with top rated Experts

    18 Experts available now in Live!

    Get 1:1 Help Now