Pertinent to receiving events from MM, I see three things happening in that source code (assuming I'm reading this right):
1) They set up their VB.NET app as a registered COM server. (COM does not depend on .NET, but .NET assemblies are easy to turn into COM components. Of course, MM is a native app, not a .NET/managed one.)
2) They create an autoscript that instantiates the app instance of the plugin, and then calls Init() on the instance. (I assume this is the "register with MM" step.) It's not clear but I think in this case the app is running InProc, not as a local server.
3) They attach a handler to SDB.OnShutdown (which removes the system-wide keyboard hooks installed during the Init() call). There are also numerous hooks into the controls of the app itself, which I guess are driven by MM.
That event-hook-in uses .NET delegation. In C#, the code would similarly be
Code: Select all
SDB.OnShutdown += ExitApplication; //or something like this
This presumably is enabled by .NET providing appropriate wrappers to the COM event handler exposed by MM.
Out-of-proc event handlers are still elusive! They should be as easy to implement as out-of-proc calls into MM, but so far, no go. (Which, I know, is a common complaint.)