I have created one application in VC++ which creates bitmap data according to Text
and I have exported the function from VC++ dll.
In C#, i am accessing this function by using DllImport
I want to pass LOGFONT structure as a parameter to VC++ application through C#.
How can i pass this?
Please Refer to Code sample
VC++
Exported Function looks like this
void MyDllMethod(BYTE *pbByteArray,char* a_sMessage,int a_eHorizontalAllignment, bool a_bDrawVertical,LOGFONT m_winLogFont);
c#
LOGFONT structure is defined as
public struct LOGFONT
{
public int lfHeight;
public int lfWidth;
public int lfEscapement;
public int lfOrientation;
public int lfWeight;
public byte lfItalic;
public byte lfUnderline;
public byte lfStrikeOut;
public byte lfCharSet;
public byte lfOutPrecision;
public byte lfClipPrecision;
public byte lfQuality;
public byte lfPitchAndFamily;
[MarshalAs(UnmanagedType.ByValTStr, SizeConst = 32)]
public string lfFaceName;
public LOGFONT(bool test)
{
lfHeight = 0;
lfWidth = 0;
lfEscapement = 0;
lfOrientation = 0;
lfWeight = 0;
lfItalic = 0;
lfUnderline = 0;
lfStrikeOut = 0;
lfCharSet = 0;
lfOutPrecision = 0;
lfClipPrecision = 0;
lfQuality = 0;
lfPitchAndFamily = 0;
lfFaceName = "Arial";
}
}
[DllImport("Bitmap Creation.dll", EntryPoint = "MyDllMethod", ExactSpelling = false,CallingConvention = CallingConvention.Cdecl)]
public static extern void MyDllMethod(IntPtrbyteArray, [MarshalAs(UnmanagedType.LPStr)]string message,
int a_eHorizontalAllignment, bool a_bDrawVertical,LOGFONT a_logFont);
But in VC++ application, I am getting some garbaouge values in LOGFONT structure.
Please Help..... waiting for your reply...