Click here to Skip to main content
15,888,330 members
Please Sign up or sign in to vote.
1.00/5 (1 vote)
See more:
Below is the piece of code written in c++, how can i convert it in c#. If you check the pams_get_msgw function , the first param is of (char*), how can i pass the same in c# .
C++
 struct 
	{
	short m_nStatus;
	short m_nReg_Id;
	short m_nNumber_Reg;
	} 

oRegReply;
short nBufSize = sizeof(oRegReply);
q_address	oSenderQueue;
nMsgType = MSG_TYPE_SBS_REG_REPLY;
cPriority = 0;
lTimeout = 300;	// 30 seconds
    
//Wait for reply telegram from SBS server
lStatus = pams_get_msgw((char *) &oRegReply, &cPriority, &oSenderQueue,
&nMsgClass, &nMsgType, &nBufSize, &nMsgLen,&lTimeout,
 NULL, NULL, NULL, NULL, NULL, NULL, NULL);

My c# declaration for pams_get_msgw function is like this
C#
[DllImport("DmqCl32.dll")]
public static extern int pams_get_msgw(StringBuilder msg_area, string priority, out q_address source,
                                             out short clas, out short type,
                                             ref short msg_area_len, out short len_data, ref int timeout,
                                             ref int sel_filter, out PSB psb, out ShowBuffer show_buffer,
                                             ref int show_buffer_len, ref int large_area_len, out int large_size,
                                             [MarshalAs(UnmanagedType.LPStr)] string nullarg_3);

How can i pass structure into first argument, the way doing in c++ ?
Posted
Updated 31-Mar-13 21:15pm
v2
Comments
Sergey Alexandrovich Kryukov 1-Apr-13 14:04pm    
How can anyone help you without seeing original pams_get_msgw as it appears in "DmqCl32.dll"? Due to the high April 1st traffic my access to your hard drive is a bit limited...
—SA

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)



CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900