Live Chat Icon For mobile
Live Chat Icon

How to access a winapi that has a LPTSTR and maxlen param

Platform: WinForms| Category: Win32
	[DllImport('user32.dll', CharSet=CharSet.Auto, CallingConvention=CallingConvention.Winapi)] 

	public static extern int GetMenuString(IntPtr hMenu, uint uIDItem, [MarshalAs(UnmanagedType.LPTStr)]string lpString,int maxCount,uint uFlag);

	String caption = new String(’t’, 30);//using a dummy char ‘t’ here.
	int len = GetMenuString(hsysmenu, commandID, caption, 30, 0));

Share with

Related FAQs

Couldn't find the FAQs you're looking for?

Please submit your question and answer.