Zyrca
Joined: 19 Apr 2002 Posts: 219 Location: MA
|
Posted: Tue Jun 17, 2003 8:40 am Post subject: VB 6.0 - Communication Between Plugins |
|
|
The plugin you are communicating with needs to have some methods and/or events exposed, or else it will be usless to communicate with it. The DecalHotkeySystem is an example of a plugin that you may wish to communicate with. I will be using the DecalHotkeySystem as my example.
First, you will need to add a reference to the plugin.
Under Project / References, locate the library of the plugin. (If you browse for it, this will be the plug-ins dll)
Next, you will need a pointer to the plugin:
| Code: | | Private WithEvents pluginPointer As DHS.HotkeySystem |
Now, you will need to get a reference to the plugin from plugin site ... however, you don't want to try and get it during your IPlugin_Initialize routine because the plugin you wish to get a pointer to may not exist yet. So, I would suggest aquiring the pointer when you get the 0xF7C7 packet (Enter 3d mode).
| Code: | | Set pluginPointer = PluginSite.Plugin("{6B6B9FA8-37DE-4FA3-8C60-52BD6A2F9855}") |
You have a reference to the plugin. If it has events, you can get them via the drop-down menu at the top of the window, or look in the object browser. The subroutines, functions and properties can be found in the usual way (pluginPointer. or the Object Browser.)
GKusnick on getting the CLSID for a plugin (that big huge string) and accessing other plugins:
DecalPlugins?.xml (in your Decal installation folder) has the CLSIDs of all widely used plugins. Failing that, the CLSIDs of all plugins installed on your machine are listed under the HKEY_LOCAL_MACHINE\SOFTWARE\Decal\Plugins registry key. Just copy out the CLSID you want and paste it in as a string constant in your code.
You access the plugin's functionality the same way you access Decal's, or any other ActiveX object's: by adding a reference to its typelib to your project, declaring variables of those types, and using VB's object browser to explore their properties and methods. However if you didn't write the other plugin, and its author wasn't expecting it to be used in this way, it probably doesn't expose much in the way of useful functionality (apart from the standard plugin interfaces that all plugins must implement).
_
-- Greg _________________ -Zyrca
Last edited by Zyrca on Tue Jun 17, 2003 1:04 pm; edited 1 time in total |
|