Solved

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

Posted on 2000-02-18
10
142 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
 
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
Enabling OSINT in Activity Based Intelligence

Activity based intelligence (ABI) requires access to all available sources of data. Recorded Future allows analysts to observe structured data on the open, deep, and dark web.

 
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

What Security Threats Are You Missing?

Enhance your security with threat intelligence from the web. Get trending threat insights on hackers, exploits, and suspicious IP addresses delivered to your inbox with our free Cyber Daily.

Join & Write a Comment

If you have ever used Microsoft Word then you know that it has a good spell checker and it may have occurred to you that the ability to check spelling might be a nice piece of functionality to add to certain applications of yours. Well the code that…
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…
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…
This lesson covers basic error handling code in Microsoft Excel using VBA. This is the first lesson in a 3-part series that uses code to loop through an Excel spreadsheet in VBA and then fix errors, taking advantage of error handling code. This l…

747 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

Need Help in Real-Time?

Connect with top rated Experts

12 Experts available now in Live!

Get 1:1 Help Now