How to call a windows message

  • Thread starter Thread starter Ivan Sammut
  • Start date Start date
I

Ivan Sammut

Hi,

I am trying to set the maximum length for the label of a tree node. I know I
have to call the windows command EM_LIMITTEXT but I do not have a clue how
to send a message to windows. Any one can pls give me an example


Normal Syntax in other languages
Get WindowsMessage Hnd1 EM_LIMITTEXT 50

Thanks
Ivan Sammut
 
Ivan,

Here is the declaration for SendMessage you will need.

[DllImport("user32.dll", CharSet=CharSet.Auto, SetLastError=true)]
public static extern IntPtr SendMessage(
IntPtr hWnd
[MarshalAs(UnmanagedType.U4)] int Msg,
IntPtr wParam,
IntPtr lParam);

This will allow you to send the appropriate message and get the result
that you want.

Hope this helps.
 
Back
Top