Skip to content
  • Categories
  • Recent
  • Tags
  • Popular
  • World
  • Users
  • Groups
Skins
  • Light
  • Cerulean
  • Cosmo
  • Flatly
  • Journal
  • Litera
  • Lumen
  • Lux
  • Materia
  • Minty
  • Morph
  • Pulse
  • Sandstone
  • Simplex
  • Sketchy
  • Spacelab
  • United
  • Yeti
  • Zephyr
  • Dark
  • Cyborg
  • Darkly
  • Quartz
  • Slate
  • Solar
  • Superhero
  • Vapor

  • Default (No Skin)
  • No Skin
Collapse
Code Project
  1. Home
  2. General Programming
  3. C#
  4. Interop question C#

Interop question C#

Scheduled Pinned Locked Moved C#
csharpcomtutorialquestion
3 Posts 3 Posters 0 Views 1 Watching
  • Oldest to Newest
  • Newest to Oldest
  • Most Votes
Reply
  • Reply as topic
Log in to reply
This topic has been deleted. Only users with topic management privileges can see it.
  • I Offline
    I Offline
    IsaacB
    wrote on last edited by
    #1

    Hi, anyone has an idea of how to call a function with the following signature long csp2TimeStamp2Str(unsigned char *Stamp, char *value, long nMaxLength) in C# I declare it like this [DllImport("csp2.dll", EntryPoint="csp2TimeStamp2Str")] public static extern int csp2TimeStamp2Str( [MarshalAs(UnmanagedType.LPStr)] System.Text.StringBuilder blah, [MarshalAs(UnmanagedType.LPArray)] byte[] lpBuffer, int maxLength); Thanks in advance

    P S 2 Replies Last reply
    0
    • I IsaacB

      Hi, anyone has an idea of how to call a function with the following signature long csp2TimeStamp2Str(unsigned char *Stamp, char *value, long nMaxLength) in C# I declare it like this [DllImport("csp2.dll", EntryPoint="csp2TimeStamp2Str")] public static extern int csp2TimeStamp2Str( [MarshalAs(UnmanagedType.LPStr)] System.Text.StringBuilder blah, [MarshalAs(UnmanagedType.LPArray)] byte[] lpBuffer, int maxLength); Thanks in advance

      P Offline
      P Offline
      pubududilena
      wrote on last edited by
      #2

      hi pl check like this:- [DllImport("csp2.dll",EntryPoint="csp2TimeStamp2Str",ExactSpelling=false,SetLastError=true)] public static extern int csp2TimeStamp2Str(out char stamp,out char value,int maxLength); regards, pubudu.

      1 Reply Last reply
      0
      • I IsaacB

        Hi, anyone has an idea of how to call a function with the following signature long csp2TimeStamp2Str(unsigned char *Stamp, char *value, long nMaxLength) in C# I declare it like this [DllImport("csp2.dll", EntryPoint="csp2TimeStamp2Str")] public static extern int csp2TimeStamp2Str( [MarshalAs(UnmanagedType.LPStr)] System.Text.StringBuilder blah, [MarshalAs(UnmanagedType.LPArray)] byte[] lpBuffer, int maxLength); Thanks in advance

        S Offline
        S Offline
        StealthyMark
        wrote on last edited by
        #3

        Do you have any documentation? The first parameter unsigned char *Stamp might be 1. a pointer to a simple value, possibly taken from an enumeration ref char stamp ref short stamp [MarshalAs(UnmanagedType.U2)] ref YourEnumType stamp 2. a [In] null-terminated unicode string [MarshalAs(UnmanagedType.LPWStr)] string stamp 3. a [Out/maybe In] null-terminated unicode string [MarshalAs(UnmanagedType.LPWStr)] StringBuilder stamp 4. a [In] data array, its length is given in parameter nMaxLength [MarshalAs(UnmanagedType.LPArray, SizeParamIndex = 2)] char[] stamp 5. a [Out] data array, its length is the return value of the function IntPtr stamp This goes for the second parameter as well, except for the last two possibilities, one is an [Out] parameter, the other one is an [In] parameter. Without some documentation it is very hard to tell. Mark

        1 Reply Last reply
        0
        Reply
        • Reply as topic
        Log in to reply
        • Oldest to Newest
        • Newest to Oldest
        • Most Votes


        • Login

        • Don't have an account? Register

        • Login or register to search.
        • First post
          Last post
        0
        • Categories
        • Recent
        • Tags
        • Popular
        • World
        • Users
        • Groups