How to call a windows message

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
 
N

Nicholas Paldino [.NET/C# MVP]

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.
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top