home
***
CD-ROM
|
disk
|
FTP
|
other
***
search
/
PC World 2002 July & August
/
PCWorld_2002-07-08_cd.bin
/
Software
/
Topware
/
hackman
/
_SETUP.1
/
SPlugin.cpp
< prev
next >
Wrap
C/C++ Source or Header
|
2000-07-09
|
6KB
|
234 lines
/****************************************************************************************
*Simple Plugin - coded by Jegrede the Black.
* Please send all bug reports to shuriken13@hotmail.com.
*
****************************************************************************************/
#include <windows.h>
#include <ole2.h>
#include "pinfo.h" //for SPLUGININFO
#include "splugin.h" //for other crap...
/*****DEFINES******************/
#define EXECWVARIABLES 1
#define ABOUTBOX 1
#define CONFIGUREMENU 1
#define LANGUAGEPACK 1
/*****DEFINES******************/
#if LANGUAGEPACK
#include "lpack.h"
#include "ltables.h"
#include "language.cpp"
#endif
#if EXECWVARIABLES
#include "varbinds.h"
#include "utils.h"
#endif
//*****PUBLIC VARIABLES
const LPSTR PluginName="Simple Plugin";
#if LANGUAGEPACK
const int nLangTables=3;
int cLanguage=0;
CLANGUAGEPACK cLanguages[nLangTables];
#endif
//*****PUBLIC VARIABLES
/***********************************[CODE FOR LANGUAGE TRANSLATION]******************************/
#if LANGUAGEPACK
LPSTR _TL(LPSTR a)
{ return (cLanguage==0?a:cLanguages[cLanguage].Translate(a));
}
#else
LPSTR _TL(LPSTR a)
{return a;
}
#endif
/***********************************[CODE FOR LANGUAGE TRANSLATION]******************************/
/***********************************[CODE FOR PLUGIN INITIALIZATION]*****************************/
SPLUGINTYPE _stdcall InitializePlugin(void)
{
#if LANGUAGEPACK
cLanguages[0]= CLANGUAGEPACK(deflang,numentries);
cLanguages[1]= CLANGUAGEPACK(newlang,numentries);
cLanguages[2]= CLANGUAGEPACK(hicklang,numentries);
#endif
SPLUGINTYPE thisPlugin;
thisPlugin.pname = _TL("Simple Plugin"); //the name fo the plugin
thisPlugin.pType = _TL("dev"); //not used by DLL Deity _yet_
thisPlugin.pVersion = 1.6; //the plugin's version
thisPlugin.verHackman.hVersion = 5.4; //Hackman high version (5.0▀4)
thisPlugin.verHackman.lVersion = 5.4; //Hackman low version (v5.0▀4)
thisPlugin.verDLLdeity.hVersion =.6; //▀5.0 DLL Deity high version
thisPlugin.verDLLdeity.lVersion =.6; //▀3.0 DLL Deity low version
thisPlugin.fname = "SPlugin.dll"; //the DLL's name
thisPlugin.lExtra = ABOUT+ //about box
EXECWITHVARIABLES+ //variables passed to ExecutePlugin() fucntion
CONFIGURE+ //configure menu
LANGUAGEPACKSUPPORT; //language pack support
return thisPlugin;
//variable creation and initialization should go here.
}
/***********************************[CODE FOR PLUGIN INITIALIZATION]*****************************/
/***********************************[CODE FOR PLUGIN EXECUTION]**********************************/
#if EXECWVARIABLES
void _stdcall ExecutePlugin(CVARBINDS *pBinds)
//declaration for a ExecutePlugin() w/variables
{typedef void (_stdcall*DDEType)(BSTR);
MessageBox(0,_TL("Execute Plugin w/ Variables has been called!"),_TL(PluginName),0);
//get variables that Hackman registered
// LPSTR curfile=pBinds->GetString("HM_CURRENTFILE"),
// lpBuff=pBinds->GetString("HM_CURRENTSELECTION");
// long selsize=pBinds->GetLong("HM_SELECTIONSIZE"),
// selstart=pBinds->GetLong("HM_SELECTIONSTART");
long cposition = pBinds->GetLong("HM_CURSORPOSITION");
// DDEType defunc= DDEType(pBinds->GetFunc("HM_DDECOMMAND"));
// DDEType(SysAllocString(OLESTR("WOW!")));
// DLLMain(0,0,0,0);
}
#else
void _stdcall ExecutePlugin()
//***declaration for a no parameter ExecutePlugin() function
{//TODO: insert code that actually does something.
MessageBox(0,_TL("Execute Plugin has been called."),_TL(PluginName),0);
}
#endif
/***********************************[CODE FOR PLUGIN EXECUTION]**********************************/
/***********************************[CODE FOR PLUGIN TERMINATION]********************************/
void _stdcall TerminatePlugin(void)
{
//no messy cleanup, just a Message box.
MessageBox(0,_TL("Terminate Plugin has been called."),_TL(PluginName),0);
//clean up code goes here
}
/***********************************[CODE FOR PLUGIN TERMINATION]********************************/
/***********************************[CODE FOR ABOUT BOX]*****************************************/
#if ABOUTBOX
void _stdcall AboutPlugin(void)
{
MessageBox(0,_TL("Simple Plugin\nVersion:1.6\nCoded by Jegrede the Black."),_TL("Simple Plugin About Box"),0);
//about box should go here
}
#endif
/***********************************[CODE FOR ABOUT BOX]*****************************************/
/***********************************[CODE FOR CONFIGURATION MENU]********************************/
#if CONFIGUREMENU
void _stdcall ConfigurePlugin(void)
{
MessageBox(0,_TL("Configure Plugin has been called."),_TL(PluginName),0);
//configure messsages/menu should go here
}
#endif
/***********************************[CODE FOR CONFIGURATION MENU]********************************/
/***********************************[CODE FOR LANGUAGE PACK SUPPORT]*****************************/
#if LANGUAGEPACK
bool _stdcall ChangePluginLanguage(LPSTR lang)
{int i,sizealloc=0;
if(!strcmp(lang,"REQUEST_PLUGIN_LANGUAGES_BECAUSE_I_WANT_THEM"))
{
for(i=0;i<nLangTables;i++)
sizealloc+=strlen(cLanguages[i].GetPackData()->language)+1;
LPSTR xlangs;
xlangs=cLanguages[0].GetPackData()->language;
for(i=1;i<nLangTables;i++)
{
xlangs=UTIL_StrCombine(xlangs,"|");
xlangs=UTIL_StrCombine(xlangs,cLanguages[i].GetPackData()->language);
}
UTIL_CopyThis(xlangs,lang);
return true;
}
else
{
for(i=0;i<nLangTables;i++)
{
if(!strcmp(cLanguages[i].GetPackData()->language,lang))
{
cLanguage=i;
return true;
}
}
return false;
}
}
#else
bool _stdcall ChangePluginLanguage(LPSTR lang)
{
MessageBox(0,"Language Packs are NOT supported in this module","ERROR",0);
return false;
}
#endif
/***********************************[CODE FOR LANGUAGE PACK SUPPORT]*****************************/