Click here to Skip to main content
15,902,112 members
Home / Discussions / C#
   

C#

 
AnswerRe: Localisation of c# Windows Application Pin
Bhupi Bhai22-Jan-07 22:56
Bhupi Bhai22-Jan-07 22:56 
AnswerRe: Localisation of c# Windows Application Pin
Kodanda Pani23-Jan-07 19:08
Kodanda Pani23-Jan-07 19:08 
GeneralRe: Localisation of c# Windows Application Pin
VijayaRam31-Jan-07 1:41
VijayaRam31-Jan-07 1:41 
Questiondatabase write permission change Pin
raju_net181822-Jan-07 22:14
raju_net181822-Jan-07 22:14 
Questiontransfering of file Pin
Fatima Tuz Zahra22-Jan-07 21:18
Fatima Tuz Zahra22-Jan-07 21:18 
AnswerRe: transfering of file Pin
bobsugar22222-Jan-07 21:47
bobsugar22222-Jan-07 21:47 
AnswerRe: transfering of file Pin
Parwej Ahamad22-Jan-07 22:39
professionalParwej Ahamad22-Jan-07 22:39 
QuestionPassing an array of structs from c# to unmanaged c++ dll Pin
Marek Konieczny22-Jan-07 21:12
Marek Konieczny22-Jan-07 21:12 
Hi,

I need to pass a relativly complicated struct into a dll calling a CORBA Service which has to be written in vc6.0 and it has to contain many elements which are necessary to create an input for a service.

Unfortunately I can see only the first array element, other are ignored.

Here an example of c# code:

<br />
[StructLayout(LayoutKind.Sequential, CharSet = CharSet.Ansi)]<br />
public struct MyStrStruct3<br />
{<br />
    public string FirstName;<br />
    public string FamilyName;<br />
    public int size;<br />
}<br />
<br />
[DllImport(@"C:\Projects\CorbaLib60\Debug\CorbaLib.dll")]<br />
private static extern int TestMe(ref MyStrStruct3[] pstr);<br />
<br />
MyStrStruct3[] Names = new MyStrStruct3[2];<br />
Names[0].FamilyName = "Konieczny";<br />
Names[0].FirstName = "Marek";<br />
Names[0].size = 3;<br />
Names[1].FamilyName = "OtherName";<br />
Names[1].FirstName = "OtherFirst";<br />
Names[1].size = 2;<br />
int miki1 = TestMe(ref Names);<br />


C++ code look like this:

<br />
typedef struct _MyStruct2<br />
{<br />
   char* FirstName;<br />
   char* FamilyName;<br />
   UINT size; <br />
} MyStruct2;<br />
<br />
<br />
int TestMe(MyStruct2* pStruct[])<br />
{  <br />
int Size = 2;<br />
<br />
for (int i=0; i<Size; i++ )<br />
   {<br />
      int woofie = pStruct[i]->size;<br />
      char* miki = pStruct[i]->FamilyName;<br />
      char* miki1 = pStruct[i]->FirstName;<br />
   }<br />
   return 42;<br />
}<br />


I define export :

<br />
<br />
__declspec(dllexport) int TestMe(MyStruct2* pStruct[2]);<br />
<br />


It works, but only for first element. I also have tried to pass it as

[StructLayout(LayoutKind.Sequential, CharSet = CharSet.Ansi)]<br />
public struct MyStrStruct4<br />
{<br />
    public MyStrStruct3[] Names;<br />
    public int size;<br />
}


but it doesn't work and raise an exception.
Marek
Questionhow to write on an html page through StremWriter class?? Pin
Saira Tanwir22-Jan-07 21:07
Saira Tanwir22-Jan-07 21:07 
AnswerRe: how to write on an html page through StremWriter class?? Pin
bobsugar22222-Jan-07 22:04
bobsugar22222-Jan-07 22:04 
GeneralRe: how to write on an html page through StremWriter class?? Pin
Saira Tanwir22-Jan-07 22:17
Saira Tanwir22-Jan-07 22:17 
AnswerRe: how to write on an html page through StremWriter class?? Pin
Guffa22-Jan-07 22:24
Guffa22-Jan-07 22:24 
GeneralRe: how to write on an html page through StremWriter class?? Pin
bobsugar22222-Jan-07 22:35
bobsugar22222-Jan-07 22:35 
AnswerRe: how to write on an html page through StremWriter class?? Pin
Stefan Troschuetz22-Jan-07 22:23
Stefan Troschuetz22-Jan-07 22:23 
GeneralRe: how to write on an html page through StremWriter class?? Pin
Saira Tanwir22-Jan-07 22:33
Saira Tanwir22-Jan-07 22:33 
GeneralRe: how to write on an html page through StremWriter class?? [modified] Pin
bobsugar22222-Jan-07 22:39
bobsugar22222-Jan-07 22:39 
GeneralRe: how to write on an html page through StremWriter class?? Pin
Saira Tanwir22-Jan-07 22:51
Saira Tanwir22-Jan-07 22:51 
GeneralRe: how to write on an html page through StremWriter class?? Pin
bobsugar22222-Jan-07 22:59
bobsugar22222-Jan-07 22:59 
GeneralRe: how to write on an html page through StremWriter class?? Pin
bobsugar22223-Jan-07 0:09
bobsugar22223-Jan-07 0:09 
GeneralRe: how to write on an html page through StremWriter class?? Pin
Stefan Troschuetz22-Jan-07 22:48
Stefan Troschuetz22-Jan-07 22:48 
GeneralRe: how to write on an html page through StremWriter class?? Pin
Saira Tanwir22-Jan-07 22:59
Saira Tanwir22-Jan-07 22:59 
QuestionList of languages in C# Pin
bouli22-Jan-07 20:35
bouli22-Jan-07 20:35 
AnswerRe: List of languages in C# Pin
lmoelleb22-Jan-07 20:41
lmoelleb22-Jan-07 20:41 
QuestionSort DatagridView Pin
aaraaayen22-Jan-07 18:55
aaraaayen22-Jan-07 18:55 
AnswerRe: Sort DatagridView Pin
Guffa22-Jan-07 19:25
Guffa22-Jan-07 19:25 

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.