diff options
author | sje <sje@4f64403b-2f21-0410-a795-97e2b3489a10> | 2006-11-13 14:48:02 +0000 |
---|---|---|
committer | sje <sje@4f64403b-2f21-0410-a795-97e2b3489a10> | 2006-11-13 14:48:02 +0000 |
commit | b01805cbb22c14e9a3cd83f5c49c97e6ecb80074 (patch) | |
tree | 528be3fc573c62e086c93cab31918e0cf91483b2 | |
parent | c6d2c013851f3337ab59a4413f7c7447af27142a (diff) |
git-svn-id: https://server.scottellis.com.au/svn/mim_plugs@45 4f64403b-2f21-0410-a795-97e2b3489a10
-rw-r--r-- | last_contact/LastContact.cpp | 195 | ||||
-rw-r--r-- | last_contact/LastContact.mdsp | 94 | ||||
-rw-r--r-- | last_contact/LastContact_8.sln | 20 | ||||
-rw-r--r-- | last_contact/LastContact_8.vcproj | 295 | ||||
-rw-r--r-- | last_contact/common.h | 34 | ||||
-rw-r--r-- | last_contact/docs/licence_LastContact.txt | 6 | ||||
-rw-r--r-- | last_contact/options.cpp | 82 | ||||
-rw-r--r-- | last_contact/options.h | 16 | ||||
-rw-r--r-- | last_contact/resource.h | 20 | ||||
-rw-r--r-- | last_contact/resource.rc | 110 |
10 files changed, 872 insertions, 0 deletions
diff --git a/last_contact/LastContact.cpp b/last_contact/LastContact.cpp new file mode 100644 index 0000000..3cce9bd --- /dev/null +++ b/last_contact/LastContact.cpp @@ -0,0 +1,195 @@ +/*
+Miranda plugin template, originally by Richard Hughes
+http://miranda-icq.sourceforge.net/
+
+This file is placed in the public domain. Anybody is free to use or
+modify it as they wish with no restriction.
+There is no warranty.
+*/
+
+#include "common.h"
+#include "options.h"
+
+HINSTANCE hInst;
+PLUGINLINK *pluginLink;
+MM_INTERFACE mmi;
+
+HANDLE hEventWindow;
+
+//typedef LRESULT (CALLBACK *WNDPROC)(HWND, UINT, WPARAM, LPARAM);
+
+HANDLE hLastContact = 0;
+HWND hWndLastContact = 0;
+
+int vk = 'M', mod = VK_MENU;
+
+PLUGININFO pluginInfo={
+ sizeof(PLUGININFO),
+ MODULE,
+ PLUGIN_MAKE_VERSION(0,0,0,1),
+ "Re-open the last open message window using a configurable hot key.",
+ "Scott Ellis",
+ "mail@scottellis.com.au",
+ "© 2006 Scott Ellis",
+ "http://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;
+ return TRUE;
+}
+
+extern "C" __declspec(dllexport) PLUGININFO* MirandaPluginInfo(DWORD mirandaVersion)
+{
+ return &pluginInfo;
+}
+
+void PlaceOnTop(HWND hwnd) {
+ // set window style
+ LONG ex_style = GetWindowLong(hwnd, GWL_EXSTYLE);
+ ex_style |= WS_EX_TOPMOST;
+ SetWindowLong(hwnd, GWL_EXSTYLE, ex_style);
+
+ if(DBGetContactSettingByte(0, MODULE, "MakeChildFullScreen", 0)) {
+ // make window child of any full-screen topmost windows
+ int w = GetSystemMetrics(SM_CXSCREEN);
+ int h = GetSystemMetrics(SM_CYSCREEN);
+
+ HWND hWnd = 0;
+ while (hWnd = FindWindowEx(NULL, hWnd, NULL, NULL)) {
+ if(!IsWindowVisible(hWnd) || IsIconic(hWnd))
+ continue;
+
+ if (!(GetWindowLong(hWnd, GWL_EXSTYLE) & WS_EX_TOPMOST))
+ continue;
+
+ // not sure if this could be done more simply using 'IsZoomed'?
+ RECT WindowRect;
+ GetWindowRect(hWnd, &WindowRect);
+ if ((w != (WindowRect.right - WindowRect.left)) || (h != (WindowRect.bottom - WindowRect.top)))
+ continue;
+
+ SetParent(hwnd, hWnd);
+ break;
+ }
+ }
+}
+
+int WindowEvent(WPARAM wParam, LPARAM lParam) {
+ MessageWindowEventData *ed = (MessageWindowEventData *)lParam;
+
+ /*
+ // ignore chat room contacts?
+ char *proto = (char *)CallService(MS_PROTO_GETCONTACTBASEPROTO, (WPARAM)ed->hContact, 0);
+ if(proto && DBGetContactSettingByte(ed->hContact, proto, "ChatRoom", 0)) return 0;
+ */
+
+ switch(ed->uType) {
+ case MSG_WINDOW_EVT_OPENING:
+ hLastContact = ed->hContact;
+ break;
+ case MSG_WINDOW_EVT_OPEN:
+ // if there's a full-screen app running, make the window its child
+ hWndLastContact = ed->hwndWindow;
+ if(options.make_topmost) {
+ HWND hwnd = hWndLastContact, parent = 0;
+ while((parent = GetParent(hwnd)) != 0) hwnd = parent;
+ PlaceOnTop(hwnd);
+ }
+ break;
+ case MSG_WINDOW_EVT_CLOSING:
+ case MSG_WINDOW_EVT_CLOSE:
+ // care factor?
+ break;
+ }
+
+ return 0;
+}
+
+int ModulesLoaded(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;
+
+ // these are the three lines that matter - the archive, the page containing the version string, and the text (or data)
+ // before the version that we use to locate it on the page
+ // (note that if the update URL and the version URL point to standard file listing entries, the backend xml
+ // data will be used to check for updates rather than the actual web page - this is not true for beta urls)
+ update.szBetaUpdateURL = "http://www.scottellis.com.au/miranda_plugins/last_contact.zip";
+ update.szBetaVersionURL = "http://www.scottellis.com.au/miranda_plugins/ver_last_contact.html";
+ update.pbBetaVersionPrefix = (BYTE *)MODULE " version ";
+
+ update.cpbBetaVersionPrefix = strlen((char *)update.pbBetaVersionPrefix);
+
+ CallService(MS_UPDATE_REGISTER, 0, (WPARAM)&update);
+ }
+
+ hEventWindow = HookEvent(ME_MSG_WINDOWEVENT, WindowEvent);
+
+ return 0;
+}
+
+int Shutdown(WPARAM wParam, LPARAM lParam) {
+ if(hEventWindow) UnhookEvent(hEventWindow);
+ return 0;
+}
+
+void CALLBACK TimerProc(HWND, UINT, UINT_PTR, DWORD) {
+ if(GetAsyncKeyState(vk)
+ && (options.mod_alt == false || GetAsyncKeyState(VK_MENU))
+ && (options.mod_shift == false || GetAsyncKeyState(VK_SHIFT))
+ && (options.mod_ctrl == false || GetAsyncKeyState(VK_CONTROL))
+ && hLastContact)
+ {
+ if(options.hide_if_visible && IsWindow(hWndLastContact) && IsWindowVisible(hWndLastContact)) {
+ PostMessage(hWndLastContact, WM_COMMAND, 1023, 0); // chat close tab
+ PostMessage(hWndLastContact, WM_COMMAND, IDCANCEL, 0); // srmm/scriver close session button
+ PostMessage(hWndLastContact, WM_COMMAND, 1025, 0); // tabsrmm close session button
+ } else {
+ CallService(MS_MSG_SENDMESSAGE, (WPARAM)hLastContact, 0);
+ }
+ }
+}
+
+UINT_PTR timer_id;
+
+extern "C" int __declspec(dllexport) Load(PLUGINLINK *link)
+{
+ pluginLink = link;
+
+ mir_getMMI(&mmi);
+
+ HookEvent(ME_SYSTEM_MODULESLOADED, ModulesLoaded);
+ HookEvent(ME_SYSTEM_PRESHUTDOWN, Shutdown);
+
+ InitOptions();
+
+ // clear the key pressed flags
+ GetAsyncKeyState(vk);
+ if(options.mod_alt) GetAsyncKeyState(VK_MENU);
+ if(options.mod_shift) GetAsyncKeyState(VK_SHIFT);
+ if(options.mod_ctrl) GetAsyncKeyState(VK_CONTROL);
+
+ timer_id = SetTimer(0, 0, 500, TimerProc);
+
+ return 0;
+}
+
+extern "C" int __declspec(dllexport) Unload(void)
+{
+ KillTimer(0, timer_id);
+ return 0;
+}
+
diff --git a/last_contact/LastContact.mdsp b/last_contact/LastContact.mdsp new file mode 100644 index 0000000..fc950a0 --- /dev/null +++ b/last_contact/LastContact.mdsp @@ -0,0 +1,94 @@ +[Project]
+name=LastContact
+type=2
+defaultConfig=0
+
+
+[Debug]
+// compiler
+workingDirectory=
+arguments=
+intermediateFilesDirectory=Debug
+outputFilesDirectory=Debug
+compilerPreprocessor=
+extraCompilerOptions=
+compilerIncludeDirectory=..\..\include
+noWarning=0
+defaultWarning=0
+allWarning=1
+extraWarning=0
+isoWarning=0
+warningsAsErrors=0
+debugType=1
+debugLevel=2
+exceptionEnabled=1
+runtimeTypeEnabled=1
+optimizeLevel=0
+
+// linker
+libraryPath=
+outputFilename=Debug\LastContact.dll
+libraries=gdi32, comctl32
+extraLinkerOptions=
+ignoreStartupFile=0
+ignoreDefaultLibs=0
+stripExecutableFile=0
+
+// archive
+extraArchiveOptions=
+
+//resource
+resourcePreprocessor=
+resourceIncludeDirectory=
+extraResourceOptions=
+
+[Release]
+// compiler
+workingDirectory=
+arguments=
+intermediateFilesDirectory=Release
+outputFilesDirectory=Release
+compilerPreprocessor=
+extraCompilerOptions=
+compilerIncludeDirectory=..\..\include
+noWarning=0
+defaultWarning=0
+allWarning=1
+extraWarning=0
+isoWarning=0
+warningAsErrors=0
+debugType=0
+debugLevel=1
+exceptionEnabled=0
+runtimeTypeEnabled=0
+optimizeLevel=4
+
+// linker
+libraryPath=
+outputFilename=Release\LastContact.dll
+libraries=gdi32, comctl32
+extraLinkerOptions=
+ignoreStartupFile=0
+ignoreDefaultLibs=0
+stripExecutableFile=1
+
+// archive
+extraArchiveOptions=
+
+//resource
+resourcePreprocessor=
+resourceIncludeDirectory=
+extraResourceOptions=
+
+[Source]
+1=LastContact.cpp
+3=options.cpp
+[Header]
+1=resource.h
+2=common.h
+3=options.h
+[Resource]
+1=resource.rc
+[Other]
+[History]
+LastContact.cpp,555
diff --git a/last_contact/LastContact_8.sln b/last_contact/LastContact_8.sln new file mode 100644 index 0000000..1cb8884 --- /dev/null +++ b/last_contact/LastContact_8.sln @@ -0,0 +1,20 @@ +
+Microsoft Visual Studio Solution File, Format Version 9.00
+# Visual Studio 2005
+Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "LastContact", "LastContact_8.vcproj", "{3B858A66-7A23-4EB1-9440-605B96717F06}"
+EndProject
+Global
+ GlobalSection(SolutionConfigurationPlatforms) = preSolution
+ Debug|Win32 = Debug|Win32
+ Release|Win32 = Release|Win32
+ EndGlobalSection
+ GlobalSection(ProjectConfigurationPlatforms) = postSolution
+ {3B858A66-7A23-4EB1-9440-605B96717F06}.Debug|Win32.ActiveCfg = Debug|Win32
+ {3B858A66-7A23-4EB1-9440-605B96717F06}.Debug|Win32.Build.0 = Debug|Win32
+ {3B858A66-7A23-4EB1-9440-605B96717F06}.Release|Win32.ActiveCfg = Release|Win32
+ {3B858A66-7A23-4EB1-9440-605B96717F06}.Release|Win32.Build.0 = Release|Win32
+ EndGlobalSection
+ GlobalSection(SolutionProperties) = preSolution
+ HideSolutionNode = FALSE
+ EndGlobalSection
+EndGlobal
diff --git a/last_contact/LastContact_8.vcproj b/last_contact/LastContact_8.vcproj new file mode 100644 index 0000000..7063ed4 --- /dev/null +++ b/last_contact/LastContact_8.vcproj @@ -0,0 +1,295 @@ +<?xml version="1.0" encoding="Windows-1252"?>
+<VisualStudioProject
+ ProjectType="Visual C++"
+ Version="8.00"
+ Name="LastContact"
+ ProjectGUID="{3B858A66-7A23-4EB1-9440-605B96717F06}"
+ RootNamespace="LastContact"
+ Keyword="MFCProj"
+ >
+ <Platforms>
+ <Platform
+ Name="Win32"
+ />
+ </Platforms>
+ <ToolFiles>
+ </ToolFiles>
+ <Configurations>
+ <Configuration
+ Name="Release|Win32"
+ OutputDirectory=".\Release"
+ IntermediateDirectory=".\Release"
+ ConfigurationType="2"
+ InheritedPropertySheets="$(VCInstallDir)VCProjectDefaults\UpgradeFromVC60.vsprops"
+ UseOfMFC="2"
+ ATLMinimizesCRunTimeLibraryUsage="false"
+ CharacterSet="2"
+ >
+ <Tool
+ Name="VCPreBuildEventTool"
+ />
+ <Tool
+ Name="VCCustomBuildTool"
+ />
+ <Tool
+ Name="VCXMLDataGeneratorTool"
+ />
+ <Tool
+ Name="VCWebServiceProxyGeneratorTool"
+ />
+ <Tool
+ Name="VCMIDLTool"
+ PreprocessorDefinitions="NDEBUG"
+ MkTypLibCompatible="true"
+ SuppressStartupBanner="true"
+ TargetEnvironment="1"
+ TypeLibraryName=".\Release/LastContact.tlb"
+ HeaderFileName=""
+ />
+ <Tool
+ Name="VCCLCompilerTool"
+ Optimization="2"
+ InlineFunctionExpansion="1"
+ AdditionalIncludeDirectories="../../include"
+ PreprocessorDefinitions="WIN32;NDEBUG;_WINDOWS;_USRDLL;LASTCONTACT_EXPORTS"
+ StringPooling="true"
+ RuntimeLibrary="0"
+ EnableFunctionLevelLinking="true"
+ UsePrecompiledHeader="2"
+ PrecompiledHeaderThrough="common.h"
+ PrecompiledHeaderFile=".\Release/LastContact.pch"
+ AssemblerListingLocation=".\Release/"
+ ObjectFile=".\Release/"
+ ProgramDataBaseFileName=".\Release/"
+ WarningLevel="3"
+ SuppressStartupBanner="true"
+ DisableSpecificWarnings="4996"
+ />
+ <Tool
+ Name="VCManagedResourceCompilerTool"
+ />
+ <Tool
+ Name="VCResourceCompilerTool"
+ PreprocessorDefinitions="NDEBUG"
+ Culture="2057"
+ />
+ <Tool
+ Name="VCPreLinkEventTool"
+ />
+ <Tool
+ Name="VCLinkerTool"
+ AdditionalDependencies="gdi32.lib user32.lib opengl32.lib glu32.lib comctl32.lib"
+ OutputFile="../../bin/release/plugins/LastContact.dll"
+ LinkIncremental="1"
+ SuppressStartupBanner="true"
+ ProgramDatabaseFile=".\Release/LastContact.pdb"
+ ImportLibrary=".\Release/LastContact.lib"
+ TargetMachine="1"
+ />
+ <Tool
+ Name="VCALinkTool"
+ />
+ <Tool
+ Name="VCManifestTool"
+ />
+ <Tool
+ Name="VCXDCMakeTool"
+ />
+ <Tool
+ Name="VCBscMakeTool"
+ SuppressStartupBanner="true"
+ OutputFile=".\Release/LastContact.bsc"
+ />
+ <Tool
+ Name="VCFxCopTool"
+ />
+ <Tool
+ Name="VCAppVerifierTool"
+ />
+ <Tool
+ Name="VCWebDeploymentTool"
+ />
+ <Tool
+ Name="VCPostBuildEventTool"
+ />
+ </Configuration>
+ <Configuration
+ Name="Debug|Win32"
+ OutputDirectory=".\Debug"
+ IntermediateDirectory=".\Debug"
+ ConfigurationType="2"
+ InheritedPropertySheets="$(VCInstallDir)VCProjectDefaults\UpgradeFromVC60.vsprops"
+ UseOfMFC="2"
+ ATLMinimizesCRunTimeLibraryUsage="false"
+ CharacterSet="2"
+ >
+ <Tool
+ Name="VCPreBuildEventTool"
+ />
+ <Tool
+ Name="VCCustomBuildTool"
+ />
+ <Tool
+ Name="VCXMLDataGeneratorTool"
+ />
+ <Tool
+ Name="VCWebServiceProxyGeneratorTool"
+ />
+ <Tool
+ Name="VCMIDLTool"
+ PreprocessorDefinitions="_DEBUG"
+ MkTypLibCompatible="true"
+ SuppressStartupBanner="true"
+ TargetEnvironment="1"
+ TypeLibraryName=".\Debug/LastContact.tlb"
+ HeaderFileName=""
+ />
+ <Tool
+ Name="VCCLCompilerTool"
+ Optimization="0"
+ AdditionalIncludeDirectories="../../include"
+ PreprocessorDefinitions="WIN32;_DEBUG;_WINDOWS;_USRDLL;LASTCONTACT_EXPORTS"
+ MinimalRebuild="true"
+ BasicRuntimeChecks="3"
+ RuntimeLibrary="1"
+ UsePrecompiledHeader="2"
+ PrecompiledHeaderThrough="common.h"
+ PrecompiledHeaderFile=".\Debug/LastContact.pch"
+ AssemblerListingLocation=".\Debug/"
+ ObjectFile=".\Debug/"
+ ProgramDataBaseFileName=".\Debug/"
+ WarningLevel="3"
+ SuppressStartupBanner="true"
+ DebugInformationFormat="4"
+ DisableSpecificWarnings="4996"
+ />
+ <Tool
+ Name="VCManagedResourceCompilerTool"
+ />
+ <Tool
+ Name="VCResourceCompilerTool"
+ PreprocessorDefinitions="_DEBUG"
+ Culture="2057"
+ />
+ <Tool
+ Name="VCPreLinkEventTool"
+ />
+ <Tool
+ Name="VCLinkerTool"
+ AdditionalDependencies="gdi32.lib user32.lib opengl32.lib glu32.lib comctl32.lib"
+ OutputFile="../../bin/debug/plugins/LastContact.dll"
+ LinkIncremental="2"
+ SuppressStartupBanner="true"
+ GenerateDebugInformation="true"
+ ProgramDatabaseFile=".\Debug/LastContact.pdb"
+ ImportLibrary=".\Debug/LastContact.lib"
+ TargetMachine="1"
+ />
+ <Tool
+ Name="VCALinkTool"
+ />
+ <Tool
+ Name="VCManifestTool"
+ />
+ <Tool
+ Name="VCXDCMakeTool"
+ />
+ <Tool
+ Name="VCBscMakeTool"
+ SuppressStartupBanner="true"
+ OutputFile=".\Debug/LastContact.bsc"
+ />
+ <Tool
+ Name="VCFxCopTool"
+ />
+ <Tool
+ Name="VCAppVerifierTool"
+ />
+ <Tool
+ Name="VCWebDeploymentTool"
+ />
+ <Tool
+ Name="VCPostBuildEventTool"
+ />
+ </Configuration>
+ </Configurations>
+ <References>
+ </References>
+ <Files>
+ <Filter
+ Name="Source Files"
+ Filter="cpp;c;cxx;rc;def;r;odl;idl;hpj;bat"
+ >
+ <File
+ RelativePath="LastContact.cpp"
+ >
+ <FileConfiguration
+ Name="Release|Win32"
+ >
+ <Tool
+ Name="VCCLCompilerTool"
+ PreprocessorDefinitions=""
+ UsePrecompiledHeader="1"
+ />
+ </FileConfiguration>
+ <FileConfiguration
+ Name="Debug|Win32"
+ >
+ <Tool
+ Name="VCCLCompilerTool"
+ PreprocessorDefinitions=""
+ UsePrecompiledHeader="1"
+ />
+ </FileConfiguration>
+ </File>
+ <File
+ RelativePath=".\options.cpp"
+ >
+ </File>
+ </Filter>
+ <Filter
+ Name="Header Files"
+ Filter="h;hpp;hxx;hm;inl"
+ >
+ <File
+ RelativePath=".\common.h"
+ >
+ </File>
+ <File
+ RelativePath=".\options.h"
+ >
+ </File>
+ <File
+ RelativePath="resource.h"
+ >
+ </File>
+ </Filter>
+ <Filter
+ Name="Resource Files"
+ Filter="ico;cur;bmp;dlg;rc2;rct;bin;rgs;gif;jpg;jpeg;jpe"
+ >
+ <File
+ RelativePath="resource.rc"
+ >
+ <FileConfiguration
+ Name="Release|Win32"
+ >
+ <Tool
+ Name="VCResourceCompilerTool"
+ PreprocessorDefinitions=""
+ />
+ </FileConfiguration>
+ <FileConfiguration
+ Name="Debug|Win32"
+ >
+ <Tool
+ Name="VCResourceCompilerTool"
+ PreprocessorDefinitions=""
+ />
+ </FileConfiguration>
+ </File>
+ </Filter>
+ </Files>
+ <Globals>
+ </Globals>
+</VisualStudioProject>
diff --git a/last_contact/common.h b/last_contact/common.h new file mode 100644 index 0000000..7201202 --- /dev/null +++ b/last_contact/common.h @@ -0,0 +1,34 @@ +#ifndef _COMMON_H
+#define _COMMON_H
+
+#define _WIN32_IE 0x400
+
+#include <windows.h>
+#include <commctrl.h>
+
+#include "resource.h"
+#include <stdio.h>
+
+#include <newpluginapi.h>
+#include <m_system.h>
+#include <m_database.h>
+#include <m_options.h>
+#include <m_langpack.h>
+#include <m_popup.h>
+#include <m_skin.h>
+#include <m_clist.h>
+#include <m_clui.h>
+#include <m_message.h>
+#include <m_utils.h>
+#include <m_protocols.h>
+#include <m_updater.h>
+#include <win2k.h>
+
+#include <m_popup.h>
+
+#define MODULE "LastContact"
+
+extern HWND pluginwind;
+extern HINSTANCE hInst;
+
+#endif
diff --git a/last_contact/docs/licence_LastContact.txt b/last_contact/docs/licence_LastContact.txt new file mode 100644 index 0000000..c23c973 --- /dev/null +++ b/last_contact/docs/licence_LastContact.txt @@ -0,0 +1,6 @@ +The LastContact plugin for Miranda-IM is Copyright (c) 2006 Scott Ellis (mail@scottellis.com.au)
+
+http://www.scottellis.com.au
+
+It is released under the General Public Licence, available here:
+http://www.gnu.org/copyleft/gpl.html
\ No newline at end of file diff --git a/last_contact/options.cpp b/last_contact/options.cpp new file mode 100644 index 0000000..940019b --- /dev/null +++ b/last_contact/options.cpp @@ -0,0 +1,82 @@ +#include "common.h"
+#include "options.h"
+
+Options options;
+
+static BOOL CALLBACK DlgProcOpts(HWND hwndDlg, UINT msg, WPARAM wParam, LPARAM lParam) {
+
+ switch ( msg ) {
+ case WM_INITDIALOG: {
+ TranslateDialogDefault( hwndDlg );
+ WORD mod = 0;
+ if(options.mod_alt) mod |= HOTKEYF_ALT;
+ if(options.mod_shift) mod |= HOTKEYF_SHIFT;
+ if(options.mod_ctrl) mod |= HOTKEYF_CONTROL;
+
+ SendDlgItemMessage(hwndDlg, IDC_HOTKEY, HKM_SETHOTKEY, (mod << 8) + options.vk, 0);
+
+ CheckDlgButton(hwndDlg, IDC_CHK_HIDE, options.hide_if_visible ? TRUE : FALSE);
+ CheckDlgButton(hwndDlg, IDC_CHK_ONTOP, options.make_topmost ? TRUE : FALSE);
+
+ return TRUE;
+ }
+ case WM_COMMAND:
+ if(HIWORD(wParam) == BN_CLICKED) {
+ SendMessage(GetParent(hwndDlg), PSM_CHANGED, 0, 0);
+ }
+ if ( HIWORD( wParam ) == EN_CHANGE && ( HWND )lParam == GetFocus()) {
+ SendMessage(GetParent(hwndDlg), PSM_CHANGED, 0, 0);
+ }
+ return TRUE;
+ case WM_NOTIFY:
+ if (((LPNMHDR)lParam)->code == (unsigned)PSN_APPLY ) {
+ WORD hkcode = (WORD)SendDlgItemMessage(hwndDlg, IDC_HOTKEY, HKM_GETHOTKEY, 0, 0);
+ options.vk = LOBYTE(hkcode);
+ options.mod_alt = (HIBYTE(hkcode) & HOTKEYF_ALT) != 0;
+ options.mod_shift = (HIBYTE(hkcode) & HOTKEYF_SHIFT) != 0;
+ options.mod_ctrl = (HIBYTE(hkcode) & HOTKEYF_CONTROL) != 0;
+
+ DBWriteContactSettingByte(0, MODULE, "VK", (BYTE)options.vk);
+ DBWriteContactSettingByte(0, MODULE, "MOD_ALT", options.mod_alt ? 1 : 0);
+ DBWriteContactSettingByte(0, MODULE, "MOD_SHIFT", options.mod_shift ? 1 : 0);
+ DBWriteContactSettingByte(0, MODULE, "MOD_CTRL", options.mod_ctrl ? 1 : 0);
+
+ options.hide_if_visible = IsDlgButtonChecked(hwndDlg, IDC_CHK_HIDE) ? true : false;
+ DBWriteContactSettingByte(0, MODULE, "HideIfVisible", options.hide_if_visible ? 1 : 0);
+ options.make_topmost = IsDlgButtonChecked(hwndDlg, IDC_CHK_ONTOP) ? true : false;
+ DBWriteContactSettingByte(0, MODULE, "MakeTopmost", options.make_topmost ? 1 : 0);
+ }
+ return TRUE;
+ }
+
+ return FALSE;
+}
+
+
+int OptInit(WPARAM wParam,LPARAM lParam)
+{
+ OPTIONSDIALOGPAGE odp = { 0 };
+ odp.cbSize = sizeof(odp);
+ odp.position = -790000000;
+ odp.hInstance = hInst;
+ odp.pszTemplate = MAKEINTRESOURCE(IDD_OPT1);
+ odp.pszTitle = Translate("Last Contact");
+ odp.pszGroup = Translate("Events");
+ odp.flags = ODPF_BOLDGROUPS;
+ odp.nIDBottomSimpleControl = 0;
+ odp.pfnDlgProc = DlgProcOpts;
+ CallService( MS_OPT_ADDPAGE, wParam,( LPARAM )&odp );
+
+ return 0;
+}
+
+void InitOptions() {
+ options.vk = DBGetContactSettingByte(0, MODULE, "VK", (BYTE)'M');
+ options.mod_alt = (DBGetContactSettingByte(0, MODULE, "MOD_ALT", 1) == 1);
+ options.mod_shift = (DBGetContactSettingByte(0, MODULE, "MOD_SHIFT", 0) == 1);
+ options.mod_ctrl = (DBGetContactSettingByte(0, MODULE, "MOD_CTRL", 0) == 1);
+
+ options.hide_if_visible = (DBGetContactSettingByte(0, MODULE, "HideIfVisible", 1) == 1);
+ options.make_topmost = (DBGetContactSettingByte(0, MODULE, "MakeTopmost", 0) == 1);
+ HookEvent(ME_OPT_INITIALISE, OptInit);
+}
diff --git a/last_contact/options.h b/last_contact/options.h new file mode 100644 index 0000000..8e428c6 --- /dev/null +++ b/last_contact/options.h @@ -0,0 +1,16 @@ +#ifndef _OPTIONS_INC
+#define _OPTIONS_INC
+
+typedef struct {
+ int vk;
+ bool mod_shift, mod_alt, mod_ctrl;
+
+ bool hide_if_visible;
+ bool make_topmost;
+} Options;
+
+extern Options options;
+
+void InitOptions();
+
+#endif
diff --git a/last_contact/resource.h b/last_contact/resource.h new file mode 100644 index 0000000..aad97c5 --- /dev/null +++ b/last_contact/resource.h @@ -0,0 +1,20 @@ +//{{NO_DEPENDENCIES}}
+// Microsoft Visual C++ generated include file.
+// Used by resource.rc
+//
+#define IDD_OPT1 101
+#define IDC_HOTKEY 1009
+#define IDC_CHK_HIDE 1010
+#define IDC_CHK_HIDE2 1011
+#define IDC_CHK_ONTOP 1011
+
+// Next default values for new objects
+//
+#ifdef APSTUDIO_INVOKED
+#ifndef APSTUDIO_READONLY_SYMBOLS
+#define _APS_NEXT_RESOURCE_VALUE 102
+#define _APS_NEXT_COMMAND_VALUE 40001
+#define _APS_NEXT_CONTROL_VALUE 1011
+#define _APS_NEXT_SYMED_VALUE 101
+#endif
+#endif
diff --git a/last_contact/resource.rc b/last_contact/resource.rc new file mode 100644 index 0000000..cd79237 --- /dev/null +++ b/last_contact/resource.rc @@ -0,0 +1,110 @@ +// Microsoft Visual C++ generated resource script.
+//
+#include "resource.h"
+
+#define APSTUDIO_READONLY_SYMBOLS
+/////////////////////////////////////////////////////////////////////////////
+//
+// Generated from the TEXTINCLUDE 2 resource.
+//
+#include "afxres.h"
+
+/////////////////////////////////////////////////////////////////////////////
+#undef APSTUDIO_READONLY_SYMBOLS
+
+/////////////////////////////////////////////////////////////////////////////
+// Neutral resources
+
+#if !defined(AFX_RESOURCE_DLL) || defined(AFX_TARG_NEU)
+#ifdef _WIN32
+LANGUAGE LANG_NEUTRAL, SUBLANG_NEUTRAL
+#pragma code_page(1252)
+#endif //_WIN32
+
+/////////////////////////////////////////////////////////////////////////////
+//
+// Dialog
+//
+
+IDD_OPT1 DIALOGEX 0, 0, 246, 179
+STYLE DS_SETFONT | WS_POPUP
+FONT 8, "MS Sans Serif", 0, 0, 0x0
+BEGIN
+ CONTROL "",IDC_HOTKEY,"msctls_hotkey32",WS_BORDER | WS_TABSTOP,110,59,80,14
+ RTEXT "Hot key:",IDC_STATIC,48,63,55,8
+ CONTROL "Hide window if already visible",IDC_CHK_HIDE,"Button",BS_AUTOCHECKBOX | WS_TABSTOP,77,91,108,10
+ CONTROL "Make window topmost",IDC_CHK_ONTOP,"Button",BS_AUTOCHECKBOX | WS_TABSTOP,77,108,87,10
+END
+
+
+/////////////////////////////////////////////////////////////////////////////
+//
+// DESIGNINFO
+//
+
+#ifdef APSTUDIO_INVOKED
+GUIDELINES DESIGNINFO
+BEGIN
+ IDD_OPT1, DIALOG
+ BEGIN
+ LEFTMARGIN, 7
+ RIGHTMARGIN, 239
+ TOPMARGIN, 7
+ BOTTOMMARGIN, 172
+ END
+END
+#endif // APSTUDIO_INVOKED
+
+#endif // Neutral resources
+/////////////////////////////////////////////////////////////////////////////
+
+
+/////////////////////////////////////////////////////////////////////////////
+// English (Australia) resources
+
+#if !defined(AFX_RESOURCE_DLL) || defined(AFX_TARG_ENA)
+#ifdef _WIN32
+LANGUAGE LANG_ENGLISH, SUBLANG_ENGLISH_AUS
+#pragma code_page(1252)
+#endif //_WIN32
+
+#ifdef APSTUDIO_INVOKED
+/////////////////////////////////////////////////////////////////////////////
+//
+// TEXTINCLUDE
+//
+
+1 TEXTINCLUDE
+BEGIN
+ "resource.h\0"
+END
+
+2 TEXTINCLUDE
+BEGIN
+ "#include ""afxres.h""\r\n"
+ "\0"
+END
+
+3 TEXTINCLUDE
+BEGIN
+ "\r\n"
+ "\0"
+END
+
+#endif // APSTUDIO_INVOKED
+
+#endif // English (Australia) resources
+/////////////////////////////////////////////////////////////////////////////
+
+
+
+#ifndef APSTUDIO_INVOKED
+/////////////////////////////////////////////////////////////////////////////
+//
+// Generated from the TEXTINCLUDE 3 resource.
+//
+
+
+/////////////////////////////////////////////////////////////////////////////
+#endif // not APSTUDIO_INVOKED
+
|