Click here to Skip to main content
15,891,567 members
Home / Discussions / C#
   

C#

 
Generallocation based system Pin
mathon1-Sep-04 7:16
mathon1-Sep-04 7:16 
GeneralRe: location based system Pin
Heath Stewart1-Sep-04 15:33
protectorHeath Stewart1-Sep-04 15:33 
QuestionHow to cut a picture...?? Pin
Member 9401251-Sep-04 6:47
Member 9401251-Sep-04 6:47 
QuestionHow can I get width of window of my program when it change? Pin
arbrsoft1-Sep-04 5:51
arbrsoft1-Sep-04 5:51 
AnswerRe: How can I get width of window of my program when it change? Pin
LongRange.Shooter1-Sep-04 7:34
LongRange.Shooter1-Sep-04 7:34 
QuestionUnable to capture USB Gamepad using DirectInput? Pin
zhaonian1-Sep-04 4:57
zhaonian1-Sep-04 4:57 
AnswerRe: Unable to capture USB Gamepad using DirectInput? Pin
Heath Stewart1-Sep-04 15:27
protectorHeath Stewart1-Sep-04 15:27 
GeneralData Marshalling issues when Calling C++ dll in C# using P/Invoke Pin
KZHU011-Sep-04 4:17
KZHU011-Sep-04 4:17 
I am trying to make C++ api calls from my C# code. I don't know how to properly define my data structure in C# so that data can be properly marshalled. Here is how in C++ api and struct are defined:

*****C++ code ********
...........
typedef struct {
char uid[20]; // Max Len: xx
char *data; // Data on Tag
int len; // Data length
} DataBuffer;

class AFX_EXT_CLASS cObject
{
public:
bool ReadData(DataBuffer* RetVal, int iTime);
cObject();
virtual ~cObject();

private:
DataBuffer* mBufferData;


};
....
********End C++ code ***************************

Here is C# code i tried but failed

*********C# code ***************************8
....
namespace MyCAPI
{

[StructLayout(LayoutKind.Sequential)]
public struct DataBuffer
{
public StringBuilder uid; // Max Len: xx
public StringBuilder data; // Data on Tag
public int len; // Data length

}

/// <summary>
/// Summary description for Class1.
/// </summary>
public class CAPI
{

[DllImport("Cobject.dll")]
public static extern bool ReadData(ref DataBuffer RetVal, int iTime);

}
}
....
**********END OF C#*******************


Please advise. Thanks


Kevin
GeneralRe: Data Marshalling issues when Calling C++ dll in C# using P/Invoke Pin
Heath Stewart1-Sep-04 15:23
protectorHeath Stewart1-Sep-04 15:23 
GeneralNUnit - Specifying the order of Tests Pin
matthias s.1-Sep-04 3:44
matthias s.1-Sep-04 3:44 
GeneralRe: NUnit - Specifying the order of Tests Pin
Marc Clifton1-Sep-04 4:12
mvaMarc Clifton1-Sep-04 4:12 
GeneralRe: NUnit - Specifying the order of Tests Pin
Steven Campbell1-Sep-04 7:44
Steven Campbell1-Sep-04 7:44 
GeneralAxWebBrowser, BeforeNavigate2Event, postData problem Pin
Member 12847121-Sep-04 3:14
Member 12847121-Sep-04 3:14 
QuestionDrawing Window on Second Display...? Pin
jkersch1-Sep-04 1:14
jkersch1-Sep-04 1:14 
AnswerRe: Drawing Window on Second Display...? Pin
Marc Clifton1-Sep-04 2:58
mvaMarc Clifton1-Sep-04 2:58 
GeneralRe: Drawing Window on Second Display...? Pin
jkersch1-Sep-04 3:36
jkersch1-Sep-04 3:36 
GeneralRe: Drawing Window on Second Display...? Pin
Marc Clifton1-Sep-04 4:18
mvaMarc Clifton1-Sep-04 4:18 
GeneralDrag 'n' Drop with WebBrowser problems Pin
cheesepirate1-Sep-04 0:51
cheesepirate1-Sep-04 0:51 
QuestionAccessing other forms control? Pin
sachinkalse31-Aug-04 22:49
sachinkalse31-Aug-04 22:49 
AnswerRe: Accessing other forms control? Pin
sreejith ss nair31-Aug-04 23:02
sreejith ss nair31-Aug-04 23:02 
GeneralRe: Accessing other forms control? Pin
sachinkalse31-Aug-04 23:46
sachinkalse31-Aug-04 23:46 
GeneralRe: Accessing other forms control? Pin
sreejith ss nair1-Sep-04 0:15
sreejith ss nair1-Sep-04 0:15 
GeneralRe: Accessing other forms control? Pin
sachinkalse1-Sep-04 1:01
sachinkalse1-Sep-04 1:01 
GeneralRe: Accessing other forms control? Pin
sreejith ss nair1-Sep-04 1:43
sreejith ss nair1-Sep-04 1:43 
AnswerRe: Accessing other forms control? Pin
LongRange.Shooter1-Sep-04 7:45
LongRange.Shooter1-Sep-04 7:45 

General General    News News    Suggestion Suggestion    Question Question    Bug Bug    Answer Answer    Joke Joke    Praise Praise    Rant Rant    Admin Admin   

Use Ctrl+Left/Right to switch messages, Ctrl+Up/Down to switch threads, Ctrl+Shift+Left/Right to switch pages.