diff options
Diffstat (limited to 'modules/example')
-rw-r--r-- | modules/example/Makefile | 20 | ||||
-rw-r--r-- | modules/example/main.cpp | 71 |
2 files changed, 0 insertions, 91 deletions
diff --git a/modules/example/Makefile b/modules/example/Makefile deleted file mode 100644 index 3686d9c..0000000 --- a/modules/example/Makefile +++ /dev/null @@ -1,20 +0,0 @@ -CFLAGS=-g -mdll -mwindows -I../../api/ -D DEBUG -CXXFLAGS=${CFLAGS} -LDFLAGS=-static-libgcc -Wl,-O1 -shared -CPPFLAGS = -CC=i686-pc-mingw32-gcc -CXX=i686-pc-mingw32-g++ -STRIP=i686-pc-mingw32-strip -LD=i686-pc-mingw32-ld -LNK_COMMON=-lkernel32 -MAINOBJS=main.o - -all: main -main: $(MAINOBJS) - $(CXX) $(MAINOBJS) $(LNK_COMMON) $(LDFLAGS) -o example.dll - #$(STRIP) example.dll - #upx -9 example.dll -clean: - rm *.o - rm example.dll - diff --git a/modules/example/main.cpp b/modules/example/main.cpp deleted file mode 100644 index acc8eae..0000000 --- a/modules/example/main.cpp +++ /dev/null @@ -1,71 +0,0 @@ -#include <windows.h> -#include <list> - -#include <pluginapi.h> //this is necessary, PLUGININFO structure, other related to load/unload plugin code -#include <plugin_helper.h> //just helper, not necessary -#include <core_services.h> //services implemented in core -#include <db.h> //database support - - -PLUGINLINK *pluginLink; - -HINSTANCE hInst; -BOOL WINAPI DllMain( HINSTANCE hinstDLL, DWORD fdwReason, LPVOID lpvReserved ) //default dll entry point -{ - hInst = hinstDLL; - return TRUE; -} - -PLUGININFO pluginInfo = -{ - sizeof(PLUGININFO), //size of structure - (char*)"example plugin", //short name - 0, //description - 0, //author - 0, //author email - PLUGIN_MAKE_VERSION(0,0,0,1), //version - F_GLOBAL_ACCESS //flags -}; - -extern "C" __declspec(dllexport) PLUGININFO* SetPluginInfo() -{ - return &pluginInfo; //necessary -} - -extern "C" int __declspec(dllexport) Load(PLUGINLINK *link) //basic initialisation, registering new functions, do other basic initialisation, you can create infinite loop, or other code which use many time here, only fast basic initialisation -{ - pluginLink = link; //necessary - //some basic initialisation code - MessageBoxA(0, "Simple plugin initialisation done", "INFO", MB_OK); - TestService(); //only core servisec avaible in load - return 0; //all ok, retrun 0 -} - -extern "C" int __declspec(dllexport) OnModulesLoaded() //load main code from here, all services from other plugins must be avaible here -{ - MessageBoxA(0, "Advanced plugin features needed services from other plugins are working from now", "INFO", MB_OK); - //some code -// TestService(); //same as CallService("Core/Test", 0, 0); - Shutdown(); //same as CallService("Core/Shutdown", 0, 0); ,this will shutdown program - DATA dat; - dat.wType = D_INT; - dat.pData = (void*)123; - dat.szSetting = (char*)"some_name"; - dbSetSetting((WPARAM)&pluginInfo, (LPARAM)&dat); //write integer to db - dat.szSetting = (char*)"useless"; - dbDeleteSetting((WPARAM)&pluginInfo, (LPARAM)&dat); //delete "useless" from db - dat.wType = D_STRING; - dat.szSetting = (char*)"some_string"; - dat.szModule = (char*)"some module shortName"; - dbGetSetting(0, (LPARAM)&dat); //retrieve "some_string" from "some modules shortName", or retrieve "some_string" from self if dat.szModules = 0 and WPARAM is PLUGININFO link (currently unimplemented in db plugin) - return 0; -} -extern "C" int __declspec(dllexport) Unload() -{ - - //close open files, databases, save settings in memory to db, e.t.c. here. - //some code - MessageBoxA(0, "Plugin Sucesfully unloaded", "INFO", MB_OK); - return 0; -} - |