From 9a1b2f988762967da30e6f4d2575dc2dfe99a21a Mon Sep 17 00:00:00 2001 From: sje Date: Wed, 1 Nov 2006 14:58:17 +0000 Subject: git-svn-id: https://server.scottellis.com.au/svn/mim_plugs@25 4f64403b-2f21-0410-a795-97e2b3489a10 --- xframes/xframes.cpp | 109 ++++++++++++++++++++++++++++++++++++++++++++++++++++ 1 file changed, 109 insertions(+) create mode 100644 xframes/xframes.cpp (limited to 'xframes/xframes.cpp') diff --git a/xframes/xframes.cpp b/xframes/xframes.cpp new file mode 100644 index 0000000..fae3cef --- /dev/null +++ b/xframes/xframes.cpp @@ -0,0 +1,109 @@ +// xframes.cpp : Defines the entry point for the DLL application. +// + +#include "common.h" +#include "xframes.h" +#include "options.h" +#include "frames.h" + +HINSTANCE hInst; +PLUGINLINK *pluginLink; + +HANDLE mainThread; + +bool metacontacts_installed; +bool unicode_system; + +int code_page = CP_ACP; + +HANDLE popupWindowList; + +DWORD focusTimerId = 0; + +PLUGININFO pluginInfo={ + sizeof(PLUGININFO), + "XFrames", + PLUGIN_MAKE_VERSION(0,0,1,2), + "External frames support", + "Scott Ellis", + "mail@scottellis.com.au", + "© 2005 Scott Ellis", + "http://www.scottellis.com.au/", + 0, //not transient + 0 //doesn't replace anything built-in +}; + + +extern "C" BOOL WINAPI DllMain(HINSTANCE hinstDLL,DWORD fdwReason,LPVOID lpvReserved) +{ + hInst=hinstDLL; + DisableThreadLibraryCalls(hInst); + return TRUE; +} + +extern "C" __declspec(dllexport) PLUGININFO* MirandaPluginInfo(DWORD mirandaVersion) +{ + return &pluginInfo; +} + +int OnModulesLoaded(WPARAM wParam, LPARAM lParam) { + if(ServiceExists(MS_UPDATE_REGISTER)) { + // register with updater + Update update = {0}; + char szVersion[16]; + + update.cbSize = sizeof(Update); + + update.szComponentName = pluginInfo.shortName; + update.pbVersion = (BYTE *)CreateVersionString(pluginInfo.version, szVersion); + update.cpbVersion = strlen((char *)update.pbVersion); + + update.szUpdateURL = UPDATER_AUTOREGISTER; + + update.szBetaUpdateURL = "http://www.scottellis.com.au/miranda_plugins/xframes.zip"; + update.szBetaVersionURL = "http://www.scottellis.com.au/miranda_plugins/ver_xframes.html"; + update.pbBetaVersionPrefix = (BYTE *)"XFrames version "; + update.cpbBetaVersionPrefix = strlen((char *)update.pbBetaVersionPrefix); + + CallService(MS_UPDATE_REGISTER, 0, (WPARAM)&update); + } + + return 0; +} + +int OnPreShutdown(WPARAM wParam, LPARAM lParam) { + return 0; +} + +extern "C" int __declspec(dllexport) Load(PLUGINLINK *link) +{ + if(GetModuleHandle(_T("clist_modern")) || GetModuleHandle(_T("clist_nicer")) || GetModuleHandle(_T("clist_mw"))) + return 1; + + pluginLink = link; + DuplicateHandle( GetCurrentProcess(), GetCurrentThread(), GetCurrentProcess(), &mainThread, THREAD_SET_CONTEXT, FALSE, 0 ); + + char szVer[128]; + unicode_system = (CallService(MS_SYSTEM_GETVERSIONTEXT, (WPARAM)sizeof(szVer), (LPARAM)szVer) == 0 && strstr(szVer, "Unicode")); + if(ServiceExists(MS_LANGPACK_GETCODEPAGE)) code_page = CallService(MS_LANGPACK_GETCODEPAGE, 0, 0); + + // Ensure that the common control DLL is loaded (for listview) + INITCOMMONCONTROLSEX icex; + icex.dwSize = sizeof(INITCOMMONCONTROLSEX); + icex.dwICC = ICC_LISTVIEW_CLASSES; + InitCommonControlsEx(&icex); + + LoadOptions(); + InitFrames(); + + HookEvent(ME_OPT_INITIALISE, OptInit); + HookEvent(ME_SYSTEM_MODULESLOADED, OnModulesLoaded); + + return 0; +} + +extern "C" int __declspec(dllexport) Unload(void) +{ + DeinitFrames(); + return 0; +} -- cgit v1.2.3