C# example
VB.NET example
//using System.Runtime.InteropServices;
[DllImport("user32.dll", EntryPoint = "SendMessageW", CharSet = CharSet.Unicode)]
internal static extern IntPtr SendMessageS(IntPtr hWnd, int Msg, uint wParam, string lParam);
[DllImport("user32.dll", EntryPoint = "FindWindowW", CharSet = CharSet.Unicode)]
internal static extern IntPtr FindWindow(string lpClassName, string lpWindowName);
static void TestQm2SendMessage()
{
var hwnd = FindWindow("QM_Editor", null);
if(hwnd == default(IntPtr)) return;
SendMessageS(hwnd, 12, 1, "Q ' M 'Macro295' C test C#");
}
VB.NET example
'Imports System.Runtime.InteropServices
<DllImport("user32.dll", EntryPoint:="SendMessageW", CharSet:=CharSet.Unicode)>
Function SendMessageS(hWnd As IntPtr, Msg As Int32, wParam As UInt32, lParam As String) As IntPtr
End Function
<DllImport("user32.dll", EntryPoint:="FindWindowW", CharSet:=CharSet.Unicode)>
Function FindWindow(lpClassName As String, lpWindowName As String) As IntPtr
End Function
Sub TestQm2SendMessage()
Dim hwnd = FindWindow("QM_Editor", Nothing)
If hwnd = IntPtr.Zero Then Return
SendMessageS(hwnd, 12, 1, "Q ' M 'Macro295' C test VB")
End Sub