none
[WP8.1] How to Call function with pointer parameter in c++ Runtime Component RRS feed

  • Question

  • Hi

    I do develop WP8.1 C# Application.

    however i have problem for using the c++ Runtime component.

    I want call function as c++ runtime component

    for exam as below (c#)

    private void Button_Click(object sender, RoutedEventArgs e)
    {
                var dmd = new Class1();
                int result1 = dmd.PMDeviceApiInit();

                if (result1 == 0)
                {
                    uint index = ((3) << 16) + (3);
                    byte[] p = new byte[32];
            int size = 32;
            int n = 0;

                    int res = dmd.PMDeviceApiGet(index, p, size, n);
                    this.Edit1.Text = "res : " + res;

                    dmd.PMDeviceApiDeinit();
                }
                else
                {
                    this.Edit1.Text = "fail : " + result1;
                }
    }

    and this is my function in runtime component (c++)

    UINT Class1::PMDeviceApiGet(UINT index, UCHAR *p, int size, int n)
    {
    if (g_hDevice == INVALID_HANDLE_VALUE)
    return 0;

    int pn = 0;
    DMDPARAM_T dmdParam = { DEVICEAPI_CONTROL_GET_MASK & index, n };

    DeviceIoControl(g_hDevice, (DWORD)IOCTL_DMD_CONTROL, (VOID *)&dmdParam, sizeof(DMDPARAM_T), (LPVOID)p, size, (LPDWORD)&pn, NULL);

    return pn;
    }

    but i can't call this function.

    pointer is can't use in c#.

    How to define this function's parameter?

    Please let me know.

    Thanks.

    Jack. 


    Thursday, May 12, 2016 7:56 AM

Answers

  • Hi

    I am trying to involve someone familiar with this topic to further look at this issue. There might be some time delay. Appreciate your patience.


    Best Regards, Sunteen Wu

    • Marked as answer by jack.hong Thursday, June 2, 2016 5:07 AM
    Friday, May 13, 2016 9:22 AM
  • Hi Sunteen.

    Iresolved this issue.

    using the String class and String ^ as C++/CX .

    Try to Convert String to String ^ in Runtime Component

    It result is success.

    Thanks.

    Jack.


    • Edited by jack.hong Thursday, June 2, 2016 5:07 AM
    • Marked as answer by jack.hong Thursday, June 2, 2016 5:07 AM
    Thursday, June 2, 2016 5:06 AM

All replies

  • Hi

    I am trying to involve someone familiar with this topic to further look at this issue. There might be some time delay. Appreciate your patience.


    Best Regards, Sunteen Wu

    • Marked as answer by jack.hong Thursday, June 2, 2016 5:07 AM
    Friday, May 13, 2016 9:22 AM
  • Hi Sunteen.

    Iresolved this issue.

    using the String class and String ^ as C++/CX .

    Try to Convert String to String ^ in Runtime Component

    It result is success.

    Thanks.

    Jack.


    • Edited by jack.hong Thursday, June 2, 2016 5:07 AM
    • Marked as answer by jack.hong Thursday, June 2, 2016 5:07 AM
    Thursday, June 2, 2016 5:06 AM
  • Hi jacj.hong,

    Many thanks for sharing!


    Best Regards, Sunteen Wu

    Friday, June 3, 2016 2:05 AM