Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people, just like you, are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
Solved

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

Posted on 2000-02-18
10
151 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
Free Tool: Path Explorer

An intuitive utility to help find the CSS path to UI elements on a webpage. These paths are used frequently in a variety of front-end development and QA automation tasks.

One of a set of tools we're offering as a way of saying thank you for being a part of the community.

 
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

Announcing the Most Valuable Experts of 2016

MVEs are more concerned with the satisfaction of those they help than with the considerable points they can earn. They are the types of people you feel privileged to call colleagues. Join us in honoring this amazing group of Experts.

Question has a verified solution.

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

Suggested Solutions

Most everyone who has done any programming in VB6 knows that you can do something in code like Debug.Print MyVar and that when the program runs from the IDE, the value of MyVar will be displayed in the Immediate Window. Less well known is Debug.Asse…
Since upgrading to Office 2013 or higher installing the Smart Indenter addin will fail. This article will explain how to install it so it will work regardless of the Office version installed.
As developers, we are not limited to the functions provided by the VBA language. In addition, we can call the functions that are part of the Windows operating system. These functions are part of the Windows API (Application Programming Interface). U…
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…

860 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