Important alert: (current site time 7/16/2013 1:29:18 AM EDT)
 

winzip icon

A Complete Plug-in Framework (Update: 4 (11/3/01))

Email
Submitted on: 8/6/2001 12:53:18 AM
By: Shawn Bullock  
Level: Advanced
User Rating: By 78 Users
Compatibility: VB 6.0
Views: 37051
(About the author)
 
     This is a reusable library that demonstrates how to use plugins. The application must have an object model (demonstrated) and the pluginutility DLL also has an object model, which really because a part of the application object model (demonstrated). The app sends events and the plugs have a configuration screen which becomes a part of the application. There is a complete module manager to deal with nitty gritty tasks for you. 1500-2000 lines of code.

Update 1: I cleaned this up a little. Should be easier to install. There is a new install.txt file. Added capability to add plugins to menu item, and finsished the FindText plug in. Be sure to check the Settings for the configuration of the plug defaults, you'll learn a lot. Bug Fixes, and the plugs are now early bound. This update should correct the problem mentioned in the feedback.

Update 2: Corrected the lock up problem. This only happened before the first plug is registered. Added two project types for templates in the VB Templates directory: HostApplicatoin, PluginModule. Read the Readme.txt. Those are so you can create a new host application from the new projects box, and a new plug for any supported host from the new project box. Added a PluginSettings form for the VB Form Templates so you can add a settings manager compliant form to you're project by choosing Forms->Add->PluginSetting. Other enhancements.

Update 3: Added a new plug-in, Autosave. Added some new events and functionality to the sample host application. Minor bug fixes such as correcting the ability to register a plug-in not in the default directory. Updated the project templates to reflect changes.

Update 4: Updated the display picture shown below:

Update 4b: Right-clicking a module in the module manager will now remove the reference to the plug-in, and unregister the DLL instance.

Read the Readme.txt file for more info. *** Please Vote For Me ***


 
winzip iconDownload code

Note: Due to the size or complexity of this submission, the author has submitted it as a .zip file to shorten your download time. Afterdownloading it, you will need a program like Winzip to decompress it.Virus note:All files are scanned once-a-day by Planet Source Code for viruses, but new viruses come out every day, so no prevention program can catch 100% of them. For your own safety, please:
  1. Re-scan downloaded files using your personal virus checker before using it.
  2. NEVER, EVER run compiled files (.exe's, .ocx's, .dll's etc.)--only run source code.
  3. Scan the source code with Minnow's Project Scanner

If you don't have a virus scanner, you can get one at many places on the net including:McAfee.com

 
Terms of Agreement:   
By using this code, you agree to the following terms...   
  1. You may use this code in your own programs (and may compile it into a program and distribute it in compiled format for languages that allow it) freely and with no charge.
  2. You MAY NOT redistribute this code (for example to a web site) without written permission from the original author. Failure to do so is a violation of copyright laws.   
  3. You may link to this code from another website, but ONLY if it is not wrapped in a frame. 
  4. You will abide by any additional copyright restrictions which the author may have placed in the code or code's description.


Other 1 submission(s) by this author

 


Report Bad Submission
Use this form to tell us if this entry should be deleted (i.e contains no code, is a virus, etc.).
This submission should be removed because:

Your Vote

What do you think of this code (in the Advanced category)?
(The code with your highest vote will win this month's coding contest!)
Excellent  Good  Average  Below Average  Poor (See voting log ...)
 

Other User Comments

8/6/2001 1:03:56 AMShawn Bullock (Author)

Please read the included Description.txt file. That is the key to getting this working. There are about 1500-2000 lines of textbook style, well written, interface-driven code here. This is the result of about 2 years of research and development in the area of plug-ins from consulting with VB.

I tried to be thorough. If you have problems, let me know. Have fun and happy coding.

Shawn
(If this comment was disrespectful, please report it.)

 
8/6/2001 5:40:21 AMC. Sibon

This project is awesome.
5 g. from me...
(If this comment was disrespectful, please report it.)

 
8/6/2001 7:30:09 AMJon

Shawn,

I have followed the instructions in the description.txt file and, with some adjustments to the reference of the utility DLL, successfully compiled the DynamicWord application and it's associated plugins. When I run the application, although it takes 100% CPU it does not do anything. Looking in the project and running from the IDE, the line at which it stops is the "Set Application = New Application".

As this is the only code in the startup module and does not call or create any other components, I cannot see how the application is will ever get displayed. I have probably missed something, any advice would be appreciated.
(If this comment was disrespectful, please report it.)

 
8/6/2001 11:51:36 PMShawn Bullock (Author)

I updated the files. Plugs are now early bound to app, FindText Plugin works, check the settings screen for a demo of how the settings manager works. Problem mentioned above should be corrected (because it's easier to get working). A few other enhancements.

Be sure to vote. If there's enough demand, I'll submit a much enhanced plug-in framework that does twice as much as this.

Thanks,
Shawn Bullock
(If this comment was disrespectful, please report it.)

 
8/7/2001 11:25:37 AMNathan

I had the same problems as Jon, was able to get around all of them except an infinate loop in Class_Initialize.

Do While (.AllPluginsLoaded = False)
DoEvents
Loop
(If this comment was disrespectful, please report it.)

 
8/7/2001 11:28:12 AMJun

I have the same problem as Jon.
It is this loop that hangs the computer:
(in Application class_initialize)
Do While (.AllPluginsLoaded = False)
DoEvents
Loop
Because it can never get out of the loop. When first time run it, the lnValueCount is 0 (not registered in the registry)

so the following line execute without set mbAllPlugsLoaded = True
(in LoadPlugIn function)
If (lnValueCount = 0) Then
LoadPlugin = PLUG_ERROR_REGISTRY_NOT_FOUND
Exit Function
End If

an easy fix is to set mbAllPlugsLoaded = True before exit the function.

HOpe this help
(If this comment was disrespectful, please report it.)

 
8/7/2001 11:30:08 AMJun

By the way, it worth a 5....
(If this comment was disrespectful, please report it.)

 
8/8/2001 1:17:05 AMShawn Bullock (Author)

Check the update 2. This corrected the lock up problem. Please Vote. Thanks, Shawn
(If this comment was disrespectful, please report it.)

 
8/8/2001 9:09:20 AMMichel Rutten

This is *VERY* professional source code!

I've been searching all over the net for some useful information on how to design such a framework, but without much luck... until now!
Looking at the source, it is not hard to see that these *relatively* few lines of code must have took a lot of thinking. This is much more than just a couple of technical tricks, as a lot of those other freely available source code examples are. Instead this framework offers a flexible, well designed and easily extendible object model to allow an application to dynamically load and execute compiled plugin modules. The plugin modules consist of compiled Visual Basic code, not run-time interpreted VB-Script code as some articles I've read suggest as a plugin solution.

Excellent work Shawn, respect is due!

You mention that you have extended the framework and are willing to post some further enhancements if there is any demand for it. Well, please consider this as a kind request for more...

Michel
(If this comment was disrespectful, please report it.)

 
8/8/2001 2:24:44 PMShawn Bullock (Author)

Many people have downloaded this. I don't know if people will return for more. But bookmark this because I'll be updating it about once or twice a week or more until version 2 is released next month or so. I'm working right now on a conflict resolution manager that managers conflicts with modules (you'll learn more about when this ocurrs later)... thanks for the support and keep checking back...

Thanks,
Shawn
(If this comment was disrespectful, please report it.)

 
8/14/2001 5:22:02 PMM. Boltendal

I already contacted you but forgot to vote. Well I've had a good look on the sourcecode as you know and there was no choice but to give you 5 g's...
I'll look every few days to look how the Plugin framework develops and ofcource to learn how everything works.
Keep up the good work!!!

Martin Boltendal
(If this comment was disrespectful, please report it.)

 
8/23/2001 12:24:29 PMXanth Nomeda

Excellent code, jsut what I was looking for.
5 globes from me
(If this comment was disrespectful, please report it.)

 
2/5/2002 2:13:50 PMJoe Fuentes

I would love to see a VB dot net version. I'm wondering how I could move this over to dot net and was wondering if you have already done this.
By the way you got a vote of 5 from me.

(If this comment was disrespectful, please report it.)

 
2/5/2002 4:17:21 PMShawn Bullock (Author)

Yes, there is a .NET version in the works... there are some things I'm working out because it's a rather different implementation which doesn't share much in common with this COM version. What I'm working out right now is a way to implement both in the same framework... stay tuned and I'll submit to PSC
(If this comment was disrespectful, please report it.)

 
2/7/2002 3:13:12 PMDavidzDog

Hrm nice code message me on aim i wanna tell you some stuff aim name = DavidzDog

or you can attempt battle.net: Cloaked-
(If this comment was disrespectful, please report it.)

 
5/14/2002 3:51:33 PMEdwin

Really useful, i've been looking for somthing like this for ages and ages. I'll tell you when I use it! Thanks SO SO SO SO SO MUCH!!!
(If this comment was disrespectful, please report it.)

 
5/14/2002 3:52:22 PMEdwin

(5gs!)
(If this comment was disrespectful, please report it.)

 
5/15/2002 8:28:06 PMDeathmoon

Great Code! 5 Globes!
(If this comment was disrespectful, please report it.)

 
5/15/2002 11:24:10 PMShawn Bullock

Wow... all of the sudden there's a flury of interest. Thank everyone.
(If this comment was disrespectful, please report it.)

 
5/16/2002 5:26:07 PMEdwin

I can't get it to work

Everytim I load a plugin it says that it is out of date or somthing. I've recompiled everything, and I think its all referenced properly. Whats wrong??
(If this comment was disrespectful, please report it.)

 
5/16/2002 6:15:49 PMShawn Bullock

Edwin: first the utility project must be compiled, project compatibility must be set, then the Dynamic_Word, project compatibility cannot be set on that one or binary (for unknown reason), then the plugins. If you are running the Dynamic_Word project in the IDE, you'll always get a "Bad Version". It must be executed from the compiled. However, the plugs can be run in the IDE, and the utility, but not in the project group with the Dynamic_Word project. If you are getting a version not supported, then set the version of the Dynamic_Word project to 1.5.0 or something. Let me know.
(If this comment was disrespectful, please report it.)

 
5/18/2002 3:11:46 PMDavid Fritts

Shawn, do you have aim, icq, or anything i can reach you on, if so leave it on a post ;p thanks
(If this comment was disrespectful, please report it.)

 
5/27/2002 7:44:20 AMgHost_44

I have not downloaded it yet but so far it looks awsome. I will try it out and then vote. If this can do what i hope it can do then you will definatly being getting some serious props from my application
(If this comment was disrespectful, please report it.)

 
6/5/2002 8:58:04 AMinvisager

Looks really nice. But i am not sure that my code will work with a plugin architecture, although i want it. It seems complicated for it to interface.

I am only a beginner so no wonder ;)

might have a play around, but looks nice
(If this comment was disrespectful, please report it.)

 
6/30/2002 7:22:34 PMBryan(Kital)

Very impressive, best open-source plugin framework ive seen.
(If this comment was disrespectful, please report it.)

 
7/8/2002 4:46:48 PMShawn Bullock

Thanks for the current feedback. Glad to know people are still downloading it and voting on it. I never thought I'd have 41 votes (even if it did take a year)... I've spent the last year updating it and refining it. I took feedback from the two people who actually emailed suggestions to me. The end result is that there is a user-customizable user-interface so you can make it blend with your apps. You can also add or remove functionality to the framework itself. I'm working out a few glitches with it right now. I've simplified the amount of work needed to load and initialize the library and made it a little more self-maintaining, but there's more rules to comply with to keep it "happy". It's being used in some large commercial applications, and a few smaller ones are working on incorporating it. I've got some unimaginable features going into it. Look for updates soon.

Thanks,
Shawn
(If this comment was disrespectful, please report it.)

 
9/19/2002 1:46:16 AMSlider

Shawn,

Just came across this submission and like your work. You mentioned that an update was around the corner - I'd be very interested in seeing the new Framework features that you've mentioned. Keep up the good work!
(If this comment was disrespectful, please report it.)

 
9/30/2002 4:26:33 AM

U MUST GET THE CODE OF THE MONTH!
(If this comment was disrespectful, please report it.)

 
10/29/2002 5:40:36 PMShannara

Sweetness! I cant wait until you post the next release, as I am anxiously waiting for it :)
(If this comment was disrespectful, please report it.)

 
12/11/2002 2:57:46 PMgridrun

yes :) please post the next release, this is awesome! :D
(If this comment was disrespectful, please report it.)

 
12/13/2002 11:47:46 PM

pulled down the code and looked at it...very nice work! Can't wait to see the .net version. 5gs from me
(If this comment was disrespectful, please report it.)

 
12/25/2002 12:24:03 AM

Excellent! I've used the code for 6 months now and I love it. It's made my project slick and easy to manage. I haven't touched the host code since I wrote it. I just keep adding plugins.

Many thanks!
(If this comment was disrespectful, please report it.)

 
12/28/2002 10:13:28 AMBl4d3R33f

i dont evan have that HostApplication when i click on New-Project , i have vb6 Enterprise too, please email me on how to veiw this ! Bl4d3r33f@hotmail.com thanks to who ever emails me. ^_^
(If this comment was disrespectful, please report it.)

 
12/28/2002 10:08:06 PMShawn Bullock

The HostApplication is a project template included with this download. You need to copy the HostApplication and Plugin project templates to where your Visual Basic 6 Project Templates are located and then restart the IDE and you should see them there.

Thanks,
Shawn
(If this comment was disrespectful, please report it.)

 
1/14/2003 6:42:57 PM

Shawn, nice job. Thanks much for taking the time to post it and answer all our questions.

Jeff
(If this comment was disrespectful, please report it.)

 
2/22/2003 12:37:19 PM

Nice code, rated 5, one slight problem i sent you an email about, i also saw a bug that crashed it when no modules where loaded which is a easy fix and its probably be done already. Thanks
(If this comment was disrespectful, please report it.)

 
7/27/2003 9:01:14 PMShawn Bullock

I'm wondering, its been 2 years since I released this to PSC. I attempted a new version for this COM framework and destroyed it about a year ago. I was later side tracked with work. Now, I'm ready to start version 3 (remember, 2 failed miserably, it was never released past beta 2).

Is anyone intereted in the next version, also, the next in addition to the COM version, I have a .NET version that I've already started and have tested and may release.

Let me know.

Thanks,
Shawn
(If this comment was disrespectful, please report it.)

 
8/24/2003 10:39:32 AMJames Richardson

Hi Shawn excellent job!! I would certainly be very interested in the new COM version and if you have .NET version, VB or C # that would be fantastic. You’ve got my 5 stars! Keep up the good work.
James.
(If this comment was disrespectful, please report it.)

 
8/24/2003 12:54:43 PMDaniel K Murphy

Shawn,

I actually started writing something very similar to this, and of course decided to go out to PSC to see if something was already written. This is GREAT! Although I plan continuing development on my version (just b/c I want to see what I can do with it), yours seems very well thought out and developed!

I'll use yours as a nice reference for when I get stuck! Thanks a LOT for submitting your code!

As for the .NET version, SEND it out! I would love to see what you came up with for that version!
(If this comment was disrespectful, please report it.)

 
11/8/2003 8:51:39 PMFutte

Either PSC has seriously altered their search/keyword functions during the past year or somethings wrong with patience - I think it's the last one :)

I've been looking for hints / tips on doing plugins and today I randomly stumble over this hidden gem - my 5 gems are on their way ***** along with me sincere respect.

I know that the .NET framework is the way to a better future but unfortunately some of us can't afford to go that way yet. Guess I'll have to go rob a bank or something and go .NET - or just wait and use the current release.

Let there be .NET :)
(If this comment was disrespectful, please report it.)

 
11/23/2003 8:08:20 AMvasanth

Wow Great Code !
The best i have ever seen...
can be easily customized...
sure 5gs from me...
can i reach u by e-mail i have few doubts ... mr.Shawn Bullock
(If this comment was disrespectful, please report it.)

 
11/23/2003 11:22:26 PMShawn Bullock

I got your email. I replied therein. Once we have the question answered, I'll post the concern and answer here so everyone can learn from it.

Thanks,
Shawn
(If this comment was disrespectful, please report it.)

 
11/26/2003 7:19:13 PMbrooklynb

Shawn,

This is phenomenal code. Posting it for free and updating it constantly is a great gift to all those who need this kind of functionality and for those new to COM programming in VB who want to see a real world example of how it is done (and done well). 5 stars, please keep up the good work. People like you and work like this benefit the whole VB development community. I can't say enough great things about this code.
(If this comment was disrespectful, please report it.)

 
11/27/2003 2:39:07 AMShawn Bullock

As per the concern above posted by Vasanth, the issue was resolved via email. He has customized this data layer to his application and modifed it to use XML instead of the Registry. Because he copy and pasted some of my code, there was a piece that he forgot to change accordingly. He discovered this and notified me and things work great now. Sorry that I don't have more details.

Thanks,
Shawn
(If this comment was disrespectful, please report it.)

 
3/29/2004 3:27:16 PMKele Wax

I am sure my comment wont change any thing, but I just want you to know that I downloaded this great work without knowing what it was about. But now that I understand VB alittle bit more I went through the code and I think you a just wonderful.
(If this comment was disrespectful, please report it.)

 
3/29/2004 3:36:48 PMKele Wax

Sorry I meant to say > I think you are just wonderful
(If this comment was disrespectful, please report it.)

 
6/24/2004 12:22:25 PM

Wow! This is professional work. You give me a rough idea how plug-in works.
(If this comment was disrespectful, please report it.)

 
7/26/2004 11:44:44 AMJan-Martin Ziem

really impressive code!
nice work, go on with it :-)
(If this comment was disrespectful, please report it.)

 
8/29/2004 11:36:46 PMShawn Bullock

Quick note to all those who are sending me emails from a Yahoo email account to my hotmail account: don't. I receive every one of them but whenever I reply it bounces back saying "undeliverable". So I can't reply. Send me an email from another account or you won't receive it until Yahoo (or Hotmail) correct the problem, it's been happening for about 4 weeks now that I'm aware of.

Thanks,
Shawn
(If this comment was disrespectful, please report it.)

 
2/3/2005 6:10:25 PM

Well I haven't d/l the code yet, but I'm about to. I always read the comments to give me a idea of wether to bother checking code out. It seems everyone is happy, and any problems were quickly answered, no matter wether you rate yourself beginner, intermediate, or advanced you respond as a professional. 5 globes
(If this comment was disrespectful, please report it.)

 
2/12/2005 10:03:48 AMMarclei V Silva

Very good job. Thanks for sharing
(If this comment was disrespectful, please report it.)

 
5/11/2005 6:48:00 AM

Impressive. I've used a couple of hours reviewing your code. I'm particulary interested in how you plug-in a graphical interface using forms.

I've developed a similar framework where my plugins are large size ActiveX controls. The controls are added dynamically using late binding (Controls.Add + CreateObject) to the hosting applications user interface.

But I found at least two problems in your project that I'm also having trouble with. The first and most important: How can a third party program AND DEBUG a plugin without having the source code for the hosting application?
The second problem is keyboard shortcuts. If the settings windows for
(If this comment was disrespectful, please report it.)

 
5/11/2005 6:53:05 AM

Some thing happend when submitting the previous comment. I'll continue.

The second problem is
keyboard shortcuts. If the settings
window for "DW Find All" is selected and the treeview has the focus, short cuts like Alt+S and Alt+T don't work. The same is the case the other way around (Alt+O doesn't work when the checkboxes has the focus).

Anyway thanks for publishing quality code.
(If this comment was disrespectful, please report it.)

 
5/13/2005 12:25:05 AMShawn Bullock

There actually is a way to debug and have plugins in the IDE at the same time. One of my "fans" pointed this out but the project itself isn't setup this way. Basically, you would have a dll that has only the interfaces for the Host Application, then you would have a seperate EXE with an object model that implements the interfaces, and the plugins would reference the DLL. The host would pass its main Application object into the plugin as it does now, but it is referencing the DLL and not the ActiveEXE (it isn't an ActiveX EXE, but a standard EXE at this point). Now, I built some form of automation into this project, so I would have to take that away to make it work as described here. But, indeed, it works well.

As for your keyboard shortcuts, I'll look into that. It would be "weird" to post an update after 4 year but I might just do that.

Thanks,
Shawn
(If this comment was disrespectful, please report it.)

 
12/29/2005 5:53:35 AMfrostbyte2k2

Excellent work, but i've some problem to compile your differents project :
1) I try to compil plugutilities without binary compatibilty (ok)
2) Set binary compatibility to plugutilies.dll (OK), recompile it (i can't replace it)...
3) Compile Dynamic_word without binary comp (ok, i can compile it), recompile it with binary comp to itself (dynamic_word.exe) i can't compile it (i try to replace it but i got an error message).
(If this comment was disrespectful, please report it.)

 
12/12/2007 8:28:46 AMWallonso

Giving you 5.
Great
Did you ever think of expanding it to MDI-Forms ?
(If this comment was disrespectful, please report it.)

 

Add Your Feedback
Your feedback will be posted below and an email sent to the author. Please remember that the author was kind enough to share this with you, so any criticisms must be stated politely, or they will be deleted. (For feedback not related to this particular code, please click here instead.)
 

To post feedback, first please login.