jeudi 19 janvier 2012

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.

Aucun commentaire:

Enregistrer un commentaire