-
Notifications
You must be signed in to change notification settings - Fork 3
Attaching to Another Process
Shai S edited this page Aug 25, 2023
·
2 revisions
To start playing with a remote process you need to create a RemoteApp object like so:
// Taget app is running .NET (Managed app)
Process target = Process.GetProcessesByName("OtherDotNetAppName").Single();
RemoteApp remoteApp = RemoteAppFactory.Connect(target, RuntimeType.Managed);
// Taget app is running MSVC C++ (Unmanaged app)
Process target = Process.GetProcessesByName("OtherMsvcAppName").Single();
RemoteApp remoteApp = RemoteAppFactory.Connect(target, RuntimeType.Unmanaged);RemoteApp is your root object for any remote interaction.
This object represents the "link" from your app and the attachee.
RemoteApp implements IDisposable and it should only be disposed once all remote
interactions are complete. Disposing breaks the link between the apps and, for
example, retrieved objects (which are not of a primitive type) will stop working once that happens.
Make sure to use the correct value for the runtime parameter.