Search code examples
c#c++pinvoketelephonytapi

lineTranslateAddress c++ to managed c#


I have an application that programatically makes calls to different numbers. The application is written in c# (managed) and I use pInvoke for the c++ TAPI functions. Everything works fine except the fact that I need to convert the phone number to a the dialable format.

To do this conversion, I have to use the C++ function lineTranslateAddress, but from C#. Has anyone used this function from managed code and can provide me some samples or at least explanations.

Maybe some indications how to marshall / nmarshall the last field

LPLINETRANSLATEOUTPUT lpTranslateOutput

I should also mention that the application is for a smart device.

Thanks,


Solution

  • I used this code example, and it works

    [DllImport("coredll", SetLastError = true)]
    extern public static int lineTranslateAddress(
        IntPtr hLineApp,
        int dwDeviceID,
        int dwAPIVersion,
        string lpszAddressIn,
        int dwCard,
        int dwTranslateOptions,
        byte[] lpTranslateOutput
        );