diff options
author | sje <sje@4f64403b-2f21-0410-a795-97e2b3489a10> | 2006-11-01 14:57:13 +0000 |
---|---|---|
committer | sje <sje@4f64403b-2f21-0410-a795-97e2b3489a10> | 2006-11-01 14:57:13 +0000 |
commit | 610f48f080c6ae8c298a032cd92bb2ca9948aded (patch) | |
tree | fc8f9cdd046fa5219776dc2a9fc74cb6ed700e6a /worldtime/WorldTime.cpp | |
parent | 75c65a6f461f71e2c94aac46d3e08e4475e4a450 (diff) |
git-svn-id: https://server.scottellis.com.au/svn/mim_plugs@23 4f64403b-2f21-0410-a795-97e2b3489a10
Diffstat (limited to 'worldtime/WorldTime.cpp')
-rw-r--r-- | worldtime/WorldTime.cpp | 98 |
1 files changed, 98 insertions, 0 deletions
diff --git a/worldtime/WorldTime.cpp b/worldtime/WorldTime.cpp new file mode 100644 index 0000000..63bc7b7 --- /dev/null +++ b/worldtime/WorldTime.cpp @@ -0,0 +1,98 @@ +#include "common.h"
+#include "WorldTime.h"
+
+HINSTANCE hInst;
+PLUGINLINK *pluginLink;
+
+PLUGININFO pluginInfo={
+ sizeof(PLUGININFO),
+ "World Time",
+ PLUGIN_MAKE_VERSION(0, 2, 6, 7),
+ "Display world times.",
+ "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;
+}
+
+
+extern "C" BOOL WINAPI DllMain(HINSTANCE hinstDLL,DWORD fdwReason,LPVOID lpvReserved)
+{
+ hInst=hinstDLL;
+ return TRUE;
+}
+
+extern "C" WORLDTIME_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" WORLDTIME_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;
+ }
+*/
+
+ // ensure datetime picker is loaded
+ INITCOMMONCONTROLSEX ccx = {0};
+ ccx.dwSize = sizeof(ccx);
+ ccx.dwICC = ICC_DATE_CLASSES;
+ InitCommonControlsEx(&ccx);
+
+ if(build_timezone_list()) {
+
+ DuplicateHandle( GetCurrentProcess(), GetCurrentThread(), GetCurrentProcess(), &mainThread, THREAD_SET_CONTEXT, FALSE, 0 );
+ CreatePluginServices();
+
+ HookEvent(ME_SYSTEM_MODULESLOADED, OnModulesLoaded);
+
+ HookEvent( ME_OPT_INITIALISE, WorldTimeOptInit );
+ } else {
+ MessageBox(0, "Unable to read timezone information.\nPlugin disabled.", "World Time", MB_ICONERROR | MB_OK);
+ }
+
+ return 0;
+}
+
+extern "C" WORLDTIME_API int Unload(void)
+{
+ CloseHandle( mainThread );
+ plugwin_cleanup();
+ return 0;
+}
+
|