views:

75

answers:

1

Hi, im using C# dll in VC++ application.I have somedetails in VC++ like PageNumer pageTitle PageDesc BoxDetail I have to pass this to C# Dll. So i made one structure in VC++,then i pas that to C#.But i could't do that.Pls help mw. VC++ Function:

struct SCS3OverVwPg
{
 __int32 iOvrPgNo;      
 char sOvrPgTitle[30]; //OverView Page Title
};


 void CToolTab::SendOverview()
    { 
     SCS3OverVwPg *pOverVw = 0;
     pOverVw = new SCS3OverVwPg;    
     Globals1::gwtoolbar->SetTree(pOverVw);
    }

C# function:

public struct SCS3Over
{
    Int32 iOvrPgNo;
    char[] sOvrPgTitle;
}

public void SetTree(SCS3Over x)
{
  MessageBox.Show("Data received");          

 }

If i do like this,it shows error error C2664: 'Tabcontrol::ToolBar::SetTree' : cannot convert parameter 1 from 'SCS3OverVwPg *' to 'SCS3Over'

IF i change name in C# dll to SCS3OverwPg, it show error of structure redifinition Pls help me.

A: 

I will have to assume you are using managed C++...

Instead of redeclaring the struct in managed C++, just reference the struct type from the C# assembly, and use that when calling the function.

CDSO1