From eb0858ffd81df8d02e0db4cca6ce7f6765322952 Mon Sep 17 00:00:00 2001 From: sje Date: Wed, 1 Nov 2006 14:55:16 +0000 Subject: git-svn-id: https://server.scottellis.com.au/svn/mim_plugs@19 4f64403b-2f21-0410-a795-97e2b3489a10 --- internet_time/InternetTime.cpp | 90 ++++++++++++++++++++++++++++++++++++++++++ 1 file changed, 90 insertions(+) create mode 100644 internet_time/InternetTime.cpp (limited to 'internet_time/InternetTime.cpp') diff --git a/internet_time/InternetTime.cpp b/internet_time/InternetTime.cpp new file mode 100644 index 0000000..4d8a558 --- /dev/null +++ b/internet_time/InternetTime.cpp @@ -0,0 +1,90 @@ +#include "stdafx.h" +#include "InternetTime.h" + +HINSTANCE hInst; +PLUGINLINK *pluginLink; + +PLUGININFO pluginInfo={ + sizeof(PLUGININFO), + "Internet Time", + PLUGIN_MAKE_VERSION(0, 0, 0, 9), + "Display Swatch Internet Time.", + "Scott Ellis", + "mail@scottellis.com.au", + "© 2004 Scott Ellis", + "http://scottellis.com.au/", + 0, //not transient + 0 //doesn't replace anything built-in +}; + +int winver = 0; + +#define VER_9X 1 +#define VER_NT40 2 +#define VER_2KXP 3 + +void detect_win_version() { + OSVERSIONINFO version; + + version.dwOSVersionInfoSize = sizeof(version); + GetVersionEx(&version); + + winver = (version.dwPlatformId == VER_PLATFORM_WIN32_WINDOWS) ? VER_9X + : (version.dwMajorVersion == 4) ? VER_NT40 : VER_2KXP; +} + + +BOOL WINAPI DllMain(HINSTANCE hinstDLL,DWORD fdwReason,LPVOID lpvReserved) +{ + hInst=hinstDLL; + return TRUE; +} + +extern "C" INTERNETTIME_API PLUGININFO* MirandaPluginInfo(DWORD mirandaVersion) +{ + return &pluginInfo; +} + +void CreatePluginServices() { +} + +static int OnModulesLoaded(WPARAM wParam, LPARAM lParam) { + + HWND contact_list_hwnd = (HWND)CallService(MS_CLUI_GETHWND, 0, 0); + addmypluginwindow1(contact_list_hwnd); + + return 0; +} + +extern "C" INTERNETTIME_API int Load(PLUGINLINK *link) +{ + pluginLink=link; + +/* + detect_win_version(); + if(winver < 2) { + MessageBox(0, "Sorry, this plugin does not work on Win9x (yet).\nPlugin disabled.", "World Time", MB_ICONERROR | MB_OK); + return 0; + } +*/ + if(build_timezone_list()) { + DuplicateHandle( GetCurrentProcess(), GetCurrentThread(), GetCurrentProcess(), &mainThread, THREAD_SET_CONTEXT, FALSE, 0 ); + + + CreatePluginServices(); + + HookEvent(ME_SYSTEM_MODULESLOADED, OnModulesLoaded); + } else { + MessageBox(0, "Unable to read timezone information.\nPlugin disabled.", "World Time", MB_ICONERROR | MB_OK); + } + + return 0; +} + +extern "C" INTERNETTIME_API int Unload(void) +{ + CloseHandle( mainThread ); + plugwin_cleanup(); + return 0; +} + -- cgit v1.2.3