web
You’re offline. This is a read only version of the page.
close
Skip to main content

Notifications

Announcements

No record found.

Community site session details

Community site session details

Session Id :
Microsoft Dynamics AX (Archived)

Windows' handle of any class

(0) ShareShare
ReportReport
Posted on by

I have a class.

I want to find the windows' handle of that class (not handle() property, which returns the classid).

This is usefull for using some api functions on that handle.

 

Thanks :)

*This post is locked for comments

I have the same question (0)
  • Community Member Profile Picture
    on at

    The object.xml() returns an id inside - is that id an hexadecimal value of the object id.

    if I write the following:

    int h;

    h = hex2int(<the hexa code>);

    winapi::getWindowDC(h); // returns 0.

    winapi:getWindowText(h); // return "" even the object has text.

    So, the assumption that object.xml(), which returns xml with the id inside it, may be wrong.

    (Or the pseudo-code above is wrong somehow).

    Thanks :)

  • 640579632b5c4e6780a624c4771b6f93 Profile Picture
    4,730 on at

    try using hWnd

    infolog.hWnd()

  • Suggested answer
    Michael Fruergaard Pontoppidan Profile Picture
    1,616 on at

    X++ classes does not have a Windows handle. From your description it appears that you are using the wrong APIs. What are you trying to accomplish?

  • Community Member Profile Picture
    on at

    Not all the classes have the hwnd.

    I need to know what is the specific windows handle of the component

    (Need to do some manipulation on that object by some real WIN-API function, that X++ doesn't have the commands for it - just need a simple example for any api - not using hwnd, because not all the classes have the hwnd function).

    Thanks :)

  • Michael Fruergaard Pontoppidan Profile Picture
    1,616 on at

    As Huzaifa pointed out, you can use infolog.hwnd() to get the Windows handle for the AX32.exe component.  

    Windows handles are only required when rendering graphics - so most classes do not need a Windows handle.  What is the type of the class in question?  And what API are you attempting to use?

  • Community Member Profile Picture
    on at

    OK.

    BTW - for infolog, there might be a problem, because sometimes infolog returns null value.

     

    There is a problem on hebrew characters on some occasions ...

    (And there might be other situation, where I need using API function directly, so this is just a sample ...)

    i.e there is a string like (and should be on hebrew - you should look the following from right to left. this is called : RTLReading ...)

    אבג (123)

    xyz (123)

    The hebrew (first line is shown with brackets not in place - if you cannot see it the second line is transfered to :

    123) xyz)

    There is no quite solution on AX for all components (it is paritally solved), so I need to call some api function.

    This is called by :

    int l;

    int h;

    #winapi

    ;

    // I need to find the handle ... how can I do that?

      l = WinAPI::getWindowLong(h, #GWL_EXSTYLE);

      l = l | #WS_EX_RTLREADING;

      WinAPI::setWindowLong(h, #GWL_EXSTYLE, l);

    I don't know the handle, so I cannot solve problem as solution above ...

    There are many cases, such as doing alignment to bottom of some elements (good for reports)  and this is a thing good to be known.

    Thanks :)

  • Verified answer
    Community Member Profile Picture
    on at

    I found how doing this ... (windows objects - not the inner controls).

    Thanks, anyway :)

Under review

Thank you for your reply! To ensure a great experience for everyone, your content is awaiting approval by our Community Managers. Please check back later.

Helpful resources

Quick Links

Responsible AI policies

As AI tools become more common, we’re introducing a Responsible AI Use…

Neeraj Kumar – Community Spotlight

We are honored to recognize Neeraj Kumar as our Community Spotlight honoree for…

Leaderboard > 🔒一 Microsoft Dynamics AX (Archived)

#1
Martin Dráb Profile Picture

Martin Dráb 4 Most Valuable Professional

#1
Priya_K Profile Picture

Priya_K 4

#3
MyDynamicsNAV Profile Picture

MyDynamicsNAV 2

Last 30 days Overall leaderboard

Featured topics

Product updates

Dynamics 365 release plans