Click here to Skip to main content
16,021,560 members
Please Sign up or sign in to vote.
5.00/5 (1 vote)
See more:
Hi,
I'm using a c++ dll file in order to execute some functions,
I'm blocked in this function :

BOOL CLIENT_CapturePicture(
  LONG       hPlayHandle,
  const char *pchPicFileName
);


I'm trying this code but it's not working :

[DllImport("dhnetsdk.dll", CharSet = CharSet.Ansi)]
public static extern bool CLIENT_CapturePicture
    (long hPlayHandle,
    [MarshalAs(UnmanagedType.LPStr)]
    string pchPicFileName);


Please Help me :) &thx
Posted

OK, I find the solution, it's to consider
long
in the c++ code as a
int
in c#, Thanks :-O
 
Share this answer
 
I think you need the Marshal.StringToHGlobalAnsi Method.
:)
 
Share this answer
 
It work, but not correctly, the string parameter
string pchPicFileNam
is not examined correctly, I get an output file that have a name like "€mÕ":confused:, Are there other suggestion please
 
Share this answer
 

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)



CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900