Programming For Other Programs? Plugins?

  • Thread starter Thread starter Donald Smith
  • Start date Start date
D

Donald Smith

Hello,

Does anyone know how to code plugins, or code run off your own program
that affects another program?

Example: File1.exe sends the string "Test" to File2.exe (A Completely
different program) and "Test" Appears in a textbox on File2.exe.

Its kind of hard to explain, but I hope you know what I mean. I'm not asking
for code on how to do that, I'm asking for the general idea on how to do it,
but whatever you can contribute will be appreciated. Thanks. :)

- Donald.
 
Donald Smith said:
Does anyone know how to code plugins, or code run off your own program
that affects another program?

Example: File1.exe sends the string "Test" to File2.exe (A Completely
different program) and "Test" Appears in a textbox on File2.exe.

Its kind of hard to explain, but I hope you know what I mean. I'm not asking
for code on how to do that, I'm asking for the general idea on how to do it,
but whatever you can contribute will be appreciated. Thanks. :)

The way of writing plugins is usually that the "driver" program
publishes an interface (as a DLL, usually) and the plugin is another
DLL. The "driver" is then told (eg in a configuration file) the name of
the plugin DLL, and it's loaded and used via interfaces.

See http://www.pobox.com/~skeet/csharp/plugin.html for a complete
example. The main point of the article is how to avoid problems with
it, but it does give complete code.
 
Donald Smith said:
Hello,

Does anyone know how to code plugins, or code run off your own program
that affects another program?

Example: File1.exe sends the string "Test" to File2.exe (A Completely
different program) and "Test" Appears in a textbox on File2.exe.

Its kind of hard to explain, but I hope you know what I mean. I'm not asking
for code on how to do that, I'm asking for the general idea on how to do it,
but whatever you can contribute will be appreciated. Thanks. :)

- Donald.

We write Photoshop plugins and it works exactly as John says; a plugin is
compiled as a DLL and must contain an entry point with a specified
signature. Photoshop scans a given folder for any DLLs that have a valid
entry point, and loads them when they're called. If you're doing it
yourself, you need to be careful that you keep the interfaces identical
between host and plugin. If all your plugins have a common interface, you
can dynamically load them within the host app and call the interface
function in the knowledge that the plugin knows what to do. Be aware of
changes you make to shared data and any errors and exceptions that can get
thrown - generally, having plugins throwing unexpected exceptions is a Bad
Thing.

Steve
 
Back
Top