locked
.Net CF interface with C-API RRS feed

  • Question

  • Hello,

    I want to write a application for winCE 5.0 using .Net CF (Compact framework).
    This application should be a windows forms application and should do the following:
    - Display some controls
    - interact with user
    - communicate with network using a special protocol

    The protocol has already been implemented using C and a C-API exists for the communication parts.

    I want to know can I  create this application in Vb.Net CF and in the background use this C-API for netwokring???

    In short How do VB.Net CF interact with C-API??

    Regards
    A.Quadeer
    Tuesday, March 15, 2011 8:30 AM

Answers

  • You can call the C-API via platform invoke. There is an old MSDN article about it.

     

    Good luck

    Marc

    Tuesday, March 15, 2011 2:41 PM
  • Look into P/Invoke. The link Marc Ambrosius provided is a very good reference.

    Otherwise, here's P/Invoke in a nutshell

     

    // P/Invoke definition

    [DllImport("the filename of the native library exposing C-type methods")]

    static extern [managed return type] [Method Name] ([parameters...]);

     

    Consuming the P/Invoke method is just like calling any other method


    Christian Resma Helle - Commentor A/S
    • Marked as answer by Peter_Yu Tuesday, March 29, 2011 2:20 AM
    Thursday, March 17, 2011 10:07 AM

All replies

  • You can call the C-API via platform invoke. There is an old MSDN article about it.

     

    Good luck

    Marc

    Tuesday, March 15, 2011 2:41 PM
  • Hi,

    The protocol should have interface about how to call.

    I would recommend that you read your protocol manual, then consider whether or not using VB.Net call protecol is feasible.

    Best regards,

    Alalanc

    Thursday, March 17, 2011 3:08 AM
  • Look into P/Invoke. The link Marc Ambrosius provided is a very good reference.

    Otherwise, here's P/Invoke in a nutshell

     

    // P/Invoke definition

    [DllImport("the filename of the native library exposing C-type methods")]

    static extern [managed return type] [Method Name] ([parameters...]);

     

    Consuming the P/Invoke method is just like calling any other method


    Christian Resma Helle - Commentor A/S
    • Marked as answer by Peter_Yu Tuesday, March 29, 2011 2:20 AM
    Thursday, March 17, 2011 10:07 AM