IPC: C# --> AHK Topic is solved

Get help with using AutoHotkey (v1.1 and older) and its commands and hotkeys
Verdlin
Posts: 63
Joined: 04 Oct 2013, 08:55
Contact:

IPC: C# --> AHK

04 Jan 2017, 13:43

I've created a simple C# dll which I'm trying to leverage with AHK. There are more than enough IPC: AHK --> AHK examples. I have yet to find a C# --> AHK example.

I'm open to suggestions, but would rather one of these methods:
  1. Register callback so that AHK code invokes upon C# function invoke
  2. Named pipe server. C# sends messages to listening AHK app
Can anyone help me get started? Note: I'm using CLR, and I can invoke whatever methods I want within the C# dll, I just can't figure out how to pass data between the dll and AHK.
lexikos
Posts: 9641
Joined: 30 Sep 2013, 04:07
Contact:

Re: IPC: C# --> AHK  Topic is solved

04 Jan 2017, 22:12

Is this C# dll loaded into your script, or loaded into a separate process? "IPC" usually means inter-process communication, which means communication between two or more processes.

I would suggest using an object/class.

If you need to communicate with another process, you can use ObjRegisterActive in the script and Marshal.GetActiveObject from C#.

If the dll is loaded into the script, you can just pass the object as a value to the dll. Depending on the version of C#, I suppose you can use the dynamic type and interact with the object (call methods or properties) using natural C# syntax.
Verdlin
Posts: 63
Joined: 04 Oct 2013, 08:55
Contact:

Re: IPC: C# --> AHK

05 Jan 2017, 16:00

lexikos wrote:Is this C# dll loaded into your script, or loaded into a separate process? "IPC" usually means inter-process communication, which means communication between two or more processes.

I would suggest using an object/class.

If you need to communicate with another process, you can use ObjRegisterActive in the script and Marshal.GetActiveObject from C#.

If the dll is loaded into the script, you can just pass the object as a value to the dll. Depending on the version of C#, I suppose you can use the dynamic type and interact with the object (call methods or properties) using natural C# syntax.
Thanks, Lexikos. Very helpful! I realized I was only trying to forward events and that you showed us how to forward events from C# to AHK in the "Event Handling" post. This is working wonderfully!

Return to “Ask for Help (v1)”

Who is online

Users browsing this forum: Bing [Bot], effel, TAC109 and 203 guests