Monday, December 7, 2015

AX 2012 Close Open Forms

Hi Guys

About this topics I spent some time and at the end I’m not able to call by code the standard AX 2012 command in order to Close All Forms, see picture below.

In order to achieve this goal, I have modified the SysSetupFormRun Class, Run Method and saved the Window handle of all open forms in a List and move it in the Global Cache, like below :

    // Exclude ListPage Forms
    If (this.form().formTemplate() != 1





Finally, using the sendMessage WinApi Function I have closed all Forms, like below :


    listIterator ....
    WinApi::sendMessageEx( WindowHandle, #WM_CLOSE, 0, 0);
That's it!

Stay Tuned!

1 comment:

Anonymous said...

Great solution. I'm trying to learn some microsoft dynamics theory but I see that there is yet a lot of to learn about this great erp :)