I use the following powershell code to run the c# code, but it doesn't work, why?
http://www.quickmacros.com/forum/showthr...2#pid32622
How to directly use the QmSendMessage.dll file to call?
The code below does not work
————————————————————————————————————————
[Reflection.Assembly]::LoadFile("C:\Program Files (x86)\Quick Macros 2\QmSendMessage.dll")
$q = new-object Class.Methods
$q.Run("Q ' M 'Macro8'")
http://www.quickmacros.com/forum/showthr...2#pid32622
$code = @'
using System;
using System.Runtime.InteropServices;
public class Mystuff{
[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);
public static void TestQm2SendMessage() {
var hwnd = FindWindow("QM_Editor", null);
if (hwnd == default(IntPtr)) return;
SendMessageS(hwnd, 12, 1, "Q ' M 'Macro8'");
}
}
'@
Add-Type $code
[Mystuff]::TestQm2SendMessage
How to directly use the QmSendMessage.dll file to call?
The code below does not work
————————————————————————————————————————
[Reflection.Assembly]::LoadFile("C:\Program Files (x86)\Quick Macros 2\QmSendMessage.dll")
$q = new-object Class.Methods
$q.Run("Q ' M 'Macro8'")