Click here to Skip to main content
15,905,781 members
Home / Discussions / C#
   

C#

 
GeneralRe: If-structure Pin
Nick Parker19-Apr-04 8:38
protectorNick Parker19-Apr-04 8:38 
GeneralKey event in VS2003 Pin
thomasa18-Apr-04 22:10
thomasa18-Apr-04 22:10 
GeneralRe: Key event in VS2003 Pin
Heath Stewart19-Apr-04 3:49
protectorHeath Stewart19-Apr-04 3:49 
GeneralMarshaling the structure array member of Structure in C# Pin
Vini Deep18-Apr-04 19:27
Vini Deep18-Apr-04 19:27 
GeneralRe: Marshaling the structure array member of Structure in C# Pin
Heath Stewart19-Apr-04 4:44
protectorHeath Stewart19-Apr-04 4:44 
GeneralRe: Marshaling the structure array member of Structure in C# Pin
Vini Deep19-Apr-04 18:03
Vini Deep19-Apr-04 18:03 
GeneralRe: Marshaling the structure array member of Structure in C# Pin
Heath Stewart20-Apr-04 3:13
protectorHeath Stewart20-Apr-04 3:13 
GeneralRe: Marshaling the structure array member of Structure in C# Pin
Vini Deep20-Apr-04 19:53
Vini Deep20-Apr-04 19:53 
Heath Stewart wrote:
// Define the callback.[return: MarshalAs(UnmanagedType.SysUInt)]public delegate IntPtr MyFunc(ref SecondStruct Info);
This should work.

Thanks Very much. But I am not fully clear.

__declspec (dllexport) unsigned int CALLBACK MyFunc(SEC_STRUCT * Info);

This is the function exported by the C++ Dll. How should I call this function from my C# client?

[DllImport("MyDll",CallingConvention=CallingConvention.Cdecl)]
public extern static System.UInt32  MyFunc(ref SecondStruct Info) ;
  

private void button1_Click(object sender, System.EventArgs e)
{
    FirstStruct[] first= new FirstStruct[40];
    ...
    SecondStruct info = new SecondStruct(....,first,...);
    System.UInt32 uRet= MyFunc(ref info);
    MessageBox.Show(info.Model);
    ...
}


Is this code correct? How to marshal the SecondStruct to IntPtr using Marshal.StructureToPtr and back using Marshal.PtrToStructure?

Pls Help. Thanks Rose | [Rose]


Vini
GeneralRe: Marshaling the structure array member of Structure in C# Pin
Heath Stewart21-Apr-04 3:07
protectorHeath Stewart21-Apr-04 3:07 
GeneralRe: Marshaling the structure array member of Structure in C# Pin
Vini Deep22-Apr-04 2:25
Vini Deep22-Apr-04 2:25 
GeneralRe: Marshaling the structure array member of Structure in C# Pin
Heath Stewart22-Apr-04 2:43
protectorHeath Stewart22-Apr-04 2:43 
GeneralRe: Marshaling the structure array member of Structure in C# Pin
Vini Deep22-Apr-04 20:36
Vini Deep22-Apr-04 20:36 
GeneralRe: Marshaling the structure array member of Structure in C# Pin
Heath Stewart23-Apr-04 2:05
protectorHeath Stewart23-Apr-04 2:05 
GeneralRe: Marshaling the structure array member of Structure in C# Pin
Vini Deep25-Apr-04 22:30
Vini Deep25-Apr-04 22:30 
GeneralRe: Marshaling the structure array member of Structure in C# Pin
Heath Stewart26-Apr-04 2:56
protectorHeath Stewart26-Apr-04 2:56 
GeneralRe: Marshaling the structure array member of Structure in C# Pin
Vini Deep26-Apr-04 19:42
Vini Deep26-Apr-04 19:42 
GeneralRe: Marshaling the structure array member of Structure in C# Pin
poda21-Sep-10 0:16
poda21-Sep-10 0:16 
QuestionWhy didn't my raw socket work properly? Pin
pdsinfo18-Apr-04 18:29
pdsinfo18-Apr-04 18:29 
Generalwrapping .TLB to .DLL for .NET Pin
normanordas18-Apr-04 18:14
normanordas18-Apr-04 18:14 
GeneralRe: wrapping .TLB to .DLL for .NET Pin
Heath Stewart19-Apr-04 4:47
protectorHeath Stewart19-Apr-04 4:47 
GeneralRe: wrapping .TLB to .DLL for .NET Pin
normanordas22-Apr-04 16:04
normanordas22-Apr-04 16:04 
GeneralRe: wrapping .TLB to .DLL for .NET Pin
Heath Stewart23-Apr-04 1:53
protectorHeath Stewart23-Apr-04 1:53 
GeneralShowing custom tooltip Pin
Meysam Mahfouzi18-Apr-04 17:57
Meysam Mahfouzi18-Apr-04 17:57 
GeneralRe: Showing custom tooltip Pin
Heath Stewart19-Apr-04 4:49
protectorHeath Stewart19-Apr-04 4:49 
GeneralDotNet version problem Pin
azusakt18-Apr-04 16:09
azusakt18-Apr-04 16:09 

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.