Answering follow-up message:
Use this declaration (for Win32):
using System;
using System.Runtime.InteropServices;
[StructLayout(LayoutKind.Sequential)]
public struct RECT {
public int _Left;
public int _Top;
public int _Right;
public int _Bottom;
}
[StructLayout(LayoutKind.Sequential)]
public struct POINT {
public X, Y;
}
[DllImport("user32.dll", EntryPoint = "SendMessageW")]
static extern IntPtr SendMessageW(
IntPtr hWnd,
UInt32 Msg,
IntPtr wParam,
[MarshalAs(UnmanagedType.LPWStr)] string lParam);
[DllImport("user32.dll", EntryPoint = "SendMessage")]
static extern void SendMessageRect(
IntPtr hWnd,
UInt32 msg,
IntPtr wParam,
ref RECT lParam);
[DllImport("user32.dll", EntryPoint = "SendMessage")]
static extern IntPtr SendMessagePoint(
IntPtr hWnd,
UInt32 msg,
IntPtr wParam,
ref POINT lParam);
[DllImport("user32.dll", EntryPoint = "SendMessage")]
static extern IntPtr SendMessageInt32(
IntPtr hWnd,
UInt32 Msg,
Int32 wParam,
Int32 lParam);
[return: MarshalAs(UnmanagedType.Bool)]
[DllImport("user32.dll", SetLastError = true)]
static extern bool PostMessage(
HandleRef hWnd,
uint Msg,
IntPtr wParam,
IntPtr lParam);
Do you need explanation on how Interop works? Basically, you just use these declarations.
You can use your variants of
ref
types, depending on
Msg
parameters, see Win32 documentation.
—SA