473,396 Members | 2,013 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,396 software developers and data experts.

Plugin-able application

m
Hi

I have read a lot of fragmentary explains of howto develop plugin-able
application under MSWin (main application + dll's as plugins). The
problem is that everything I found is fragmentary and I can't put it
together.

If you know how to develop such application please put here complete
source code. I think it will be VERY helpful for beginners like me and
for next generations ;)

Thanks in advance.
m@j3R ;)
Jul 22 '05 #1
4 1888
m@j3R ; wrote:
Hi

I have read a lot of fragmentary explains of howto develop plugin-able
application under MSWin (main application + dll's as plugins). The
problem is that everything I found is fragmentary and I can't put it
together.

If you know how to develop such application please put here complete
source code. I think it will be VERY helpful for beginners like me and
for next generations ;)

Thanks in advance.
m@j3R ;)


This is off-topic here. We do not discuss it here.

Probably this is more appropriate to a Windows
specific newsgroup.

--
Karthik.
' Remove _nospamplz from my email to mail me. '
Jul 22 '05 #2
m@j3R ; a écrit :
Hi

I have read a lot of fragmentary explains of howto develop plugin-able
application under MSWin (main application + dll's as plugins). The
problem is that everything I found is fragmentary and I can't put it
together.

If you know how to develop such application please put here complete
source code. I think it will be VERY helpful for beginners like me and
for next generations ;)

Thanks in advance.
m@j3R ;)


This could be somehow useful :

http://www.unitedbytes.de/go.php?site=spl
Jul 22 '05 #3
m@j3R ; wrote:
Hi

I have read a lot of fragmentary explains of howto develop plugin-able
application under MSWin (main application + dll's as plugins). The
problem is that everything I found is fragmentary and I can't put it
together.

If you know how to develop such application please put here complete
source code. I think it will be VERY helpful for beginners like me and
for next generations ;)


Austria C++ has a generic factory mechanism that will work with DLL's
(and dso's). You have to figure out how to load the DLL (or dso) at run
time.
Jul 22 '05 #4
m
> If you know how to develop such application please put here complete
source code. I think it will be VERY helpful for beginners like me and
for next generations ;)

I think I have found the solution, see below soure files in bcb6.

############ dll.cpp ###################
//---------------------------------------------------------------------------
#include <vcl.h>
#include <windows.h>
#include "MainUnit.h"
#pragma hdrstop
#pragma argsused

int WINAPI DllEntryPoint(HINSTANCE hinst, unsigned long reason, void* lpReserved)
{
return 1;
}
//---------------------------------------------------------------------------
class TriangleShape : public AbstractPolygonShape
{
public:
TriangleShape(){};
~TriangleShape(){};
virtual char* GetShapeName();
virtual char* GetShapeName2();
};

char* TriangleShape::GetShapeName()
{
return "triangle1";
}

char* TriangleShape::GetShapeName2()
{
return "triangle2";
}

extern "C" __declspec(dllexport)
void* __stdcall RegisterShape()
{
return (new TriangleShape());
}

############ END - dll.cpp #################

############ MainUnit.h ####################
//---------------------------------------------------------------------------

#ifndef MainUnitH
#define MainUnitH
//---------------------------------------------------------------------------
#include <Classes.hpp>
#include <Controls.hpp>
#include <StdCtrls.hpp>
#include <Forms.hpp>
//---------------------------------------------------------------------------
class TForm1 : public TForm
{
__published: // IDE-managed Components
TButton *Button1;
void __fastcall Button1Click(TObject *Sender);

private: // User declarations
public: // User declarations
__fastcall TForm1(TComponent* Owner);
};

class AbstractPolygonShape
{
public:
AbstractPolygonShape(){};
~AbstractPolygonShape(){};
virtual char* GetShapeName() = 0;
virtual char* GetShapeName2() = 0;
};
//---------------------------------------------------------------------------
extern PACKAGE TForm1 *Form1;
//---------------------------------------------------------------------------
#endif

############ END MainUnit.h ####################
############ MainUnit.cpp ##################
//---------------------------------------------------------------------------

#include <vcl.h>
#pragma hdrstop

#include "MainUnit.h"
//---------------------------------------------------------------------------
#pragma package(smart_init)
#pragma resource "*.dfm"
TForm1 *Form1;
//---------------------------------------------------------------------------
__fastcall TForm1::TForm1(TComponent* Owner)
: TForm(Owner)
{
}
//---------------------------------------------------------------------------

void __fastcall TForm1::Button1Click(TObject *Sender)
{
typedef void* (__stdcall *REGFUNCADDR)();
HINSTANCE DllInstance;
REGFUNCADDR regFunc;

AbstractPolygonShape *thisShape;

DllInstance = ::LoadLibrary("dll.dll");
if(DllInstance)
{
regFunc = (REGFUNCADDR) GetProcAddress(DllInstance, "RegisterShape");
if(regFunc)
{
thisShape = (AbstractPolygonShape *) regFunc();
}
if(thisShape)
{
char* ThisShapeName =thisShape->GetShapeName();
char* ThisShapeName2=thisShape->GetShapeName2();
ShowMessage((AnsiString)ThisShapeName);
ShowMessage((AnsiString)ThisShapeName2);
delete thisShape;
}
FreeLibrary(DllInstance);
}

}
//---------------------------------------------------------------------------

############ END - MainUnit.cpp ##############
Jul 22 '05 #5

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

3
by: Simon Roses Femerling | last post by:
Dear pythonnians :) Hopeful somebody can help me about implementing plugin support. I'm working on a python/wxpython app that needs plugin support. My problem is: The way my app works is a...
2
by: Rudolf | last post by:
Dear NG, I want to create a Plugin System in C# (WinForms). Has anybody experience about this, tips, tricks, or any links. Thank you very much The DotNetJunkie
2
by: Chua Wen Ching | last post by:
Hi there, I had some doubts on creatings plugins. As most example on the internet shows how to write plugins onto a plugin host which is normally a windows form program. 1) Can i replace...
1
by: GTi | last post by:
I'm developing a solution with ASP.NET 2.0 (beta) I need to create plugin modules into my project. I have a standard webpage like: - a header on top - menu/info bar on the left - main page...
0
by: sayalikulkarni | last post by:
Hello all, I have been trying to develop a security plugin for DB2 V8.2 using the GSS APIs. I have a library of GSS APIs implemented by a third party which I am using in my plugin. This plugin is...
0
by: Dan Dorey | last post by:
I'm in the midst of creating a plugin framework with the goal of making it as easy as possible for myself and other developers to both create new plugins and work with existing ones. Each plugin...
3
by: auad | last post by:
hi, I'm having a problem with plugins....as follows: I have 3 projects: 2 class libraries and 1 Windows App (Project 1: ClassLibrary) I have a plugin interface:...
8
by: Flavio | last post by:
Hi, Nowadays the addition of functionality to programs by means of plugins is very frequent. I want to know the opinions of experienced Python developers about the best practices when it...
1
by: =?Utf-8?B?TWFyaw==?= | last post by:
Hi... Apologies in advance if this isn't the right place for this question, but I didn't see another group that seemed more appropriate. One of my co-workers is trying to write a C# plugin for...
3
etiainen
by: etiainen | last post by:
Hi everyone! I'm in a bit of a problem here: I have to make a maven project for native (jni & C) code. I am using this plugin:...
0
by: Charles Arthur | last post by:
How do i turn on java script on a villaon, callus and itel keypad mobile phone
0
by: emmanuelkatto | last post by:
Hi All, I am Emmanuel katto from Uganda. I want to ask what challenges you've faced while migrating a website to cloud. Please let me know. Thanks! Emmanuel
0
BarryA
by: BarryA | last post by:
What are the essential steps and strategies outlined in the Data Structures and Algorithms (DSA) roadmap for aspiring data scientists? How can individuals effectively utilize this roadmap to progress...
1
by: nemocccc | last post by:
hello, everyone, I want to develop a software for my android phone for daily needs, any suggestions?
0
by: Hystou | last post by:
There are some requirements for setting up RAID: 1. The motherboard and BIOS support RAID configuration. 2. The motherboard has 2 or more available SATA protocol SSD/HDD slots (including MSATA, M.2...
0
marktang
by: marktang | last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However,...
0
jinu1996
by: jinu1996 | last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven...
0
by: Hystou | last post by:
Overview: Windows 11 and 10 have less user interface control over operating system update behaviour than previous versions of Windows. In Windows 11 and 10, there is no way to turn off the Windows...
0
agi2029
by: agi2029 | last post by:
Let's talk about the concept of autonomous AI software engineers and no-code agents. These AIs are designed to manage the entire lifecycle of a software development project—planning, coding, testing,...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.