Re: Using DLLImport with a function requiring char *
From: Willy Denoyette [MVP] (willy.denoyette_at_pandora.be)
Date: 12/06/04
- Next message: IceColdFire: "Re: How to include newline in TxtBox.Text display"
- Previous message: Jon Skeet [C# MVP]: "Re: newbie & basic multithreading"
- In reply to: Jason Bell: "Re: Using DLLImport with a function requiring char *"
- Next in thread: Jason Bell: "Re: Using DLLImport with a function requiring char *"
- Reply: Jason Bell: "Re: Using DLLImport with a function requiring char *"
- Messages sorted by: [ date ] [ thread ]
Date: Mon, 6 Dec 2004 12:23:29 +0100
Jason,
Well, actualy all characters are passed (as unicode characters), it's just
the native code that looks for a single null (0x00) byte in the input buffer
as string terminator.
Note that there is no need to specify LPStr as it's the default.
Willy.
"Jason Bell" <halobear333@yahoo.com> wrote in message
news:Xns95B6A696FB35Bhalobear333yahoocom@198.161.157.145...
> Thanks, I got it working by marshaling it as LPStr. LPWStr just passed
> the
> first character in the string. Here's what I used:
>
> [DllImport("XGL.dll", EntryPoint="XGL_Core_SetCaption",
>
> ExactSpelling=false,CallingConvention=CallingConvention.Cdecl)]
> public unsafe static extern void SetCaption( void * Core,
> [MarshalAs(UnmanagedType.LPStr)]string s );
>
> Thanks again.
>
- Next message: IceColdFire: "Re: How to include newline in TxtBox.Text display"
- Previous message: Jon Skeet [C# MVP]: "Re: newbie & basic multithreading"
- In reply to: Jason Bell: "Re: Using DLLImport with a function requiring char *"
- Next in thread: Jason Bell: "Re: Using DLLImport with a function requiring char *"
- Reply: Jason Bell: "Re: Using DLLImport with a function requiring char *"
- Messages sorted by: [ date ] [ thread ]
Relevant Pages
|