-----Original Message-----
Steve,
I think you can get away with this by using the following declaration
for SendMessage:
// Note, you have to set the function name, depending on the platform to do
this. You can't
// just use "SendMessage" for the entry point.
[DllImport("user32.dll", EntryPoint="SendMessageA")]
public static extern int SendPosFromCharMessage(
IntPtr hWnd,
[MarshalAs(UnmanagedType.U4)] int Msg,
ref Point wParam,
IntPtr lParam);
The Point structure in .NET has the same layout as the POINTL structure
that the EM_POSFROMCHAR message expects. Also, declaring it this way should
handle the marshaling of the structure automatically.
If you didn't want to use this method, then you would have to declare a
structure and marshal it using the static StructureToPtr method on the
Marshal class and then pass that to the SendMessage function declared with
the wParam and lParam parameters as IntPtr values.
Hope this helps.
--
- Nicholas Paldino [.NET/C# MVP]
- (e-mail address removed)
Steve said:
I am trying to use the SendMessage API function using
EM_POSFROMCHAR to get the x,y location of the current
character. I have declared the function and placed the
call into my code. How do I access the x,y coordinates.
Some example code in C# would be greatly appreciated.
.