Skip to main content

Posts

Showing posts with the label dll

How to use COM Wrapper dll in AX

(i) Install the COM Wrapper DLL Files, into the bin directory of the AOS. (ii) Register it with the following Command, %WINDIR%\Microsoft.NET\Framework\v2.0.50727\regasm.exe Test.Wrapper.DLL /tlb:Test.Wrapper.tlb (iii) Now, After Successful Registration, Follow the below path and click on COM Class Wrapper Wizard.i.e., Tools->Development tools->Wizards->COM Class Wrapper Wizard (iv) On the first Page of the Wizard, Click Next Button (v) Select the installed Wrapper and then click Next Button. (vi) Then give some string as an element mask and then click finish. Now, you can see that all the classes created in the wrapper dll will be present in the AOT. Just directly use those class/classes in your code. Things to remember while you call this class : As the Wrapper DLL has been registered in the AOS, So the methods in the extracted classes have to be called from the methods of classes whose run on property is server.

AXAPTA - Using common DLL

Put your DLL file at Client\Bin at Axapta folder under Program Files. That folder's name is : C:\Program Files (x86)\Microsoft Dynamics AX\50\Client\Bin\ at my PC. Set parameters with extTypes enum at Arg method. Sample usage: void Test() { DLL testDll; DLLFunction test; ; testDll = new DLL("MyTestDLL.dll"); test = new DLLFunction(printDLL, "MyTestingMethod"); test.arg(extTypes::Word ,extTypes::String); test.call(12345,"ABCDE"); }

Calling external dll files from Dynamics AX

In this example, we will use the Beep function of kernel32.dll. This function needs two parameters: BOOL Beep(DWORD dwFreq,DWORD dwDuration); The AX Code is static void ExtDLL(Args _args) {     DLL winApiDLL = new DLL('kernel32');     DLLFunction Function = new DLLFunction(winApiDLL,'Beep');   Function.arg(extTypes::DWord,extTypes::DWord);   Function.call(400,1000); } Run this and you will hear a beep.