Thread Rating:
  • 0 Vote(s) - 0 Average
  • 1
  • 2
  • 3
  • 4
  • 5
Use powershell to send a message to the QM window
#4
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

 
Code:
Copy      Help
 
$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'")


Messages In This Thread
RE: Use powershell to send a message to the QM window - by win - 05-11-2019, 02:42 AM

Forum Jump:


Users browsing this thread: 1 Guest(s)