Solved

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

Posted on 2000-02-18
10
147 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 20 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
Gigs: Get Your Project Delivered by an Expert

Select from freelancers specializing in everything from database administration to programming, who have proven themselves as experts in their field. Hire the best, collaborate easily, pay securely and get projects done right.

 
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

Courses: Start Training Online With Pros, Today

Brush up on the basics or master the advanced techniques required to earn essential industry certifications, with Courses. Enroll in a course and start learning today. Training topics range from Android App Dev to the Xen Virtualization Platform.

Question has a verified solution.

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

Introduction While answering a recent question (http://www.experts-exchange.com/Q_27402310.html) in the VB classic zone, I wrote some VB code in the (Office) VBA environment, rather than fire up my older PC.  I didn't post completely correct code o…
Enums (shorthand for ‘enumerations’) are not often used by programmers but they can be quite valuable when they are.  What are they? An Enum is just a type of variable like a string or an Integer, but in this case one that you create that contains…
Show developers how to use a criteria form to limit the data that appears on an Access report. It is a common requirement that users can specify the criteria for a report at runtime. The easiest way to accomplish this is using a criteria form that a…
The purpose of this video is to demonstrate how to set up the WordPress backend so that each page automatically generates a Mailchimp signup form in the sidebar. This will be demonstrated using a Windows 8 PC. Tools Used are Photoshop, Awesome…

776 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