?
Solved

Who can give me a entire example of this,please?

Posted on 2000-02-18
10
Medium Priority
?
173 Views
Last Modified: 2013-11-18
I want to write a program that support plugins, but I don't know how to do this. The program will like Winamp, if I copy some new DLL(Plugins) into the plugin directory, the program will get some new feature in itself, and I needn't to amend the program.
I'm sorry that I can only give you such few points,but I'm new, my points is less and less. I'll thank all who can help me this.Thanks!
0
Comment
Question by:prefix
  • 5
  • 2
  • 2
  • +1
10 Comments
 
LVL 6

Expert Comment

by:Marine
ID: 2537373
Putting that programms dll won't help you. You will need to enhance your Interface to do so. Meaning that without changig your code to implement the dll functions your programm won't be using these methods. There is no way of you doing this without always enhancning the interface,adding something and then recompling it.
0
 
LVL 14

Accepted Solution

by:
mcrider earned 40 total points
ID: 2537780
See the following EE questions:

Plugins for VB programs... - 20 points
http://www.experts-exchange.com/jsp/qShow.jsp?ta=visualbasic&qid=10247806 

winamp plug - 5 points
http://www.experts-exchange.com/jsp/qShow.jsp?ta=visualbasic&qid=10097648 


Cheers!
0
 
LVL 1

Author Comment

by:prefix
ID: 2537856
Thanks! Did you make a program like this? Do you mind posting it or the part about this question of your program to me,please? Thank you.
0
Concerto Cloud for Software Providers & ISVs

Can Concerto Cloud Services help you focus on evolving your application offerings, while delivering the best cloud experience to your customers? From DevOps to revenue models and customer support, the answer is yes!

Learn how Concerto can help you.

 
LVL 14

Expert Comment

by:mcrider
ID: 2537862
Sorry, I didn't write the program... Just passing on information to you.

Cheers!
0
 
LVL 1

Author Comment

by:prefix
ID: 2537877
I don't mind.
0
 
LVL 1

Author Comment

by:prefix
ID: 2568453
Oh~~~it's a long time since then.
Can I make a program with a open plugin port like winamp? For example(only example): I make a winamp, but the plugin port how I can do? The winamp we can copy the plugins into the directory where the winamp plugins in,and then choose a plugin(and its name can also be shown to us),then press Ctrl+Shift+K,the plugin can be activated,but before I copy the plugin into,winamp didn't know there's a plugin there,and didn't know when and how to send message to active the plugin.How to make it possible??
Thanks very much. This is important to me.


0
 

Expert Comment

by:d_hottes
ID: 2609776
It is possible to write a plugin interface for VB.

1. You need to build the Plugins. therefor build a new activex dll Project and create a class named "clsPlugin" (this is the interface, and has to be public). Put as many Properties and Methods in this class, but remember, that you have to put this Methods and Properties in every Plugin. For e.g. we will put two functions called "Start" and "Stop" in this module.

2. Name the Project "Plugin1" and compile it to "Plugin1.dll". Warning the Projectname, has to be the same like the filename without the extension.

3. Now you can build a second Plugin called "Plugin2" and so on.

Now you need to extend your application with a module, wich will do the following:

4. Check a specified directory for the *.dll files

5. Fill an array of objects, with the following method

set objPlugin(intI) = CreateObject(strPluginClass)

strPluginClass = Filename without Extension (e.g. Plugin1.dll = Plugin1) and ".clsPlugin"

strPluginClass will be "Plugin1.clsPlugin" for our first sample and "Plugin2.clsPlugin" for our second sample.

6. You can call the Methods, with the following Line

objPlugin(intI).Start or
objPlugin(intI).Stop
0
 
LVL 1

Author Comment

by:prefix
ID: 2612063
Great!
Thank You VERY MUCH.

Cheers!!!
0
 

Expert Comment

by:d_hottes
ID: 2612660
BUILD THE APPLICATION

1. Create a Standard-Exe Project

2. Create a Form and place three command buttons on it (command1, command2 and command3). After that place the following code into the module:

Private objPlugin() as Object

Private Sub Command1_Click
  Dim strFile as String

  strFile = Dir(App.Path & "\Plugins\*.dll")
  Do Until strFile = ""
    ReDim Preserve objPlugin(UBound(objPlugin()+1))
    Set objPlugin(UBound(objPlugin())) = CreateObject(Left(strFile, Len(strFile) - 4) & ".clsPlugin")
    strFile = Dir()
  Loop
end Sub

Private Sub Command2_Click
  Dim intI as Integer

  For intI = 1 to ubound(objPlugin())
    Msgbox "My Name is " & objPlugin(intI).Title
  Next
End Sub

Private Sub Command3_Click
  Dim intI as Integer

  For intI = 1 to ubound(objPlugin())
    Call objPlugin(intI).SaySomething
  Next
End Sub

3. Compile it and copy Project1.exe to "c:\test"

4. Create a subdirectory called "Plugins"


BUILD THE PLUGIN

5. Create an ActiveX-DLL Project and name the Project "Plugin1"

6. Create a class called "clsPlugin"

7. Put the following code into the class

Public Function Title() as String
  Title = "Billy"
End Function

Public Sub SaySomething
  Msgbox "There is nothing to say"
End Sub

8. Save it and compile it to "Plugin1.dll"

9. Copy the file "Plugin1.dll" into "c:\test\Plugins" and start "Project1.exe"

That's it. If you want to create another Plugin step 5 to 9 again and give them an unique name and the same filename.


I hope, that that code will help you ;-)

Dirk
0
 
LVL 1

Author Comment

by:prefix
ID: 2615675
d hottes:
I feel very happy.
Yes, thank you again...again. (~O~)..
0

Featured Post

Concerto Cloud for Software Providers & ISVs

Can Concerto Cloud Services help you focus on evolving your application offerings, while delivering the best cloud experience to your customers? From DevOps to revenue models and customer support, the answer is yes!

Learn how Concerto can help you.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Have you ever wanted to restrict the users input in a textbox to numbers, and while doing that make sure that they can't 'cheat' by pasting in non-numeric text? Of course you can do that with code you write yourself but it's tedious and error-prone …
You can of course define an array to hold data that is of a particular type like an array of Strings to hold customer names or an array of Doubles to hold customer sales, but what do you do if you want to coordinate that data? This article describes…
Get people started with the process of using Access VBA to control Excel using automation, Microsoft Access can control other applications. An example is the ability to programmatically talk to Excel. Using automation, an Access application can laun…
Get people started with the utilization of class modules. Class modules can be a powerful tool in Microsoft Access. They allow you to create self-contained objects that encapsulate functionality. They can easily hide the complexity of a process from…
Suggested Courses

862 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question