summary refs log blame commit diff stats
path: root/plugins/sysinfo/sysinfo.vcxproj
blob: b1c7c8f078c7007a2c6bf6531387a9e263e650b5 (plain) (tree)
1
2
3
4
5
6
7
pre { line-height: 125%; } td.linenos .normal { color: inherit; background-color: transparent; padding-left: 5px; padding-right: 5px; } span.linenos { color: inherit; background-color: transparent; padding-left: 5px; padding-right: 5px; } td.linenos .special { color: #000000; background-color: #ffffc0; padding-left: 5px; padding-right: 5px; } span.linenos.special { color: #000000; background-color: #ffffc0; padding-left: 5px; padding-right: 5px; } .highlight .hll { background-color: #ffffcc } .highlight .c { color: #888888 } /* Comment */ .highlight .err { color: #a61717; background-color: #e3d2d2 } /* Error */ .highlight .k { color: #008800; font-weight: bold } /* Keyword */ .highlight .ch { color: #888888 } /* Comment.Hashbang */ .highlight .cm { color: #888888 } /* Comment.Multiline */ .highlight .cp { color: #cc0000; font-weight: bold } /* Comment.Preproc */ .highlight .cpf { color: #888888 } /* Comment.PreprocFile */ .highlight .c1 { color: #888888 } /* Comment.Single */ .highlight .cs { color: #cc0000; font-weight: bold; background-color: #fff0f0 } /* Comment.Special */ .highlight .gd { color: #000000; background-color: #ffdddd } /* Generic.Deleted */ .highlight .ge { font-style: italic } /* Generic.Emph */ .highlight .ges { font-weight: bold; font-style: italic } /* Generic.EmphStrong */ .highlight .gr { color: #aa0000 } /* Generic.Error */ .highlight .gh { color: #333333 } /* Generic.Heading */ .highlight .gi { color: #000000; background-color: #ddffdd } /* Generic.Inserted */ .highlight .go { color: #888888 } /* Generic.Output */ .highlight .gp { color: #555555 } /* Generic.Prompt */ .highlight .gs { font-weight: bold } /* Generic.Strong */ .highlight .gu { color: #666666 } /* Generic.Subheading */ .highlight .gt { color: #aa0000 } /* Generic.Traceback */ .highlight .kc { color: #008800; font-weight: bold } /* Keyword.Constant */ .highlight .kd { color: #008800; font-weight: bold } /* Keyword.Declaration */ .highlight .kn { color: #008800; font-weight: bold } /* Keyword.Namespace */ .highlight .kp { color: #008800 } /* Keyword.Pseudo */ .highlight .kr { color: #008800; font-weight: bold } /* Keyword.Reserved */ .highlight .kt { color: #888888; font-weight: bold } /* Keyword.Type */ .highlight .m { color: #0000DD; font-weight: bold } /* Literal.Number */ .highlight .s { color: #dd2200; background-color: #fff0f0 } /* Literal.String */ .highlight .na { color: #336699 } /* Name.Attribute */ .highlight .nb { color: #003388 } /* Name.Builtin */ .highlight .nc { color: #bb0066; font-weight: bold } /* Name.Class */ .highlight .no { color: #003366; font-weight: bold } /* Name.Constant */ .highlight .nd { color: #555555 } /* Name.Decorator */ .highlight .ne { color: #bb0066; font-weight: bold } /* Name.Exception */ .highlight .nf { color: #0066bb; font-weight: bold } /* Name.Function */ .highlight .nl { color: #336699; font-style: italic } /* Name.Label */ .highlight .nn { color: #bb0066; font-weight: bold } /* Name.Namespace */ .highlight .py { color: #336699; font-weight: bold } /* Name.Property */ .highlight .nt { color: #bb0066; font-weight: bold } /* Name.Tag */ .highlight .nv { color: #336699 } /* Name.Variable */ .highlight .ow { color: #008800 } /* Operator.Word */ .highlight .w { color: #bbbbbb } /* Text.Whitespace */ .highlight .mb { color: #0000DD; font-weight: bold } /* Literal.Number.Bin */ .highlight .mf { color: #0000DD; font-weight: bold } /* Literal.Number.Float */ .highlight .mh { color: #0000DD; font-weight: bold } /* Literal.Number.Hex */ .highlight .mi { color: #0000DD; font-weight: bold } /* Literal.Number.Integer */ .highlight .mo { color: #0000DD; font-weight: bold } /* Literal.Number.Oct */ .highlight .sa { color: #dd2200; background-color: #fff0f0 } /* Literal.String.Affix */ .highlight .sb { color: #dd2200; background-color: #fff0f0 } /* Literal.String.Backtick */ .highlight .sc { color: #dd2200; background-color: #fff0f0 } /* Literal.String.Char */ .highlight .dl { color: #dd2200; background-color: #fff0f0 } /* Literal.String.Delimiter */ .highlight .sd { color: #dd2200; background-color: #fff0f0 } /* Literal.String.Doc */ .highlight .s2 { color: #dd2200; background-color: #fff0f0 } /* Literal.String.Double */ .highlight .se { color: #0044dd; background-color: #fff0f0 } /* Literal.String.Escape */ .highlight .sh { color: #dd2200; background-color: #fff0f0 } /* Literal.String.Heredoc */ .highlight .si { color: #3333bb; background-color: #fff0f0 } /* Literal.String.Interpol */ .highlight .sx { color: #22bb22; background-color: #f0fff0 } /* Literal.String.Other */ .highlight .sr { color: #008800; background-color: #fff0ff } /* Literal.String.Regex */ .highlight .s1 { color: #dd2200; background-color: #fff0f0 } /* Literal.String.Single */ .highlight .ss { color: #aa6600; background-color: #fff0f0 } /* Literal.String.Symbol */ .highlight .bp { color: #003388 } /* Name.Builtin.Pseudo */ .highlight .fm { color: #0066bb; font-weight: bold } /* Name.Function.Magic */ .highlight .vc { color: #336699 } /* Name.Variable.Class */ .highlight .vg { color: #dd7700 } /* Name.Variable.Global */ .highlight .vi { color: #3333bb } /* Name.Variable.Instance */ .highlight .vm { color: #336699 } /* Name.Variable.Magic */ .highlight .il { color: #0000DD; font-weight: bold } /* Literal.Number.Integer.Long */
/* X-Tray
 * Copyright (C) 2005 Michael Hotaling <Mike.Hotaling@SinisterDevelopments.com>
 *
 * X-Tray is free software; you can redistribute it and/or modify
 * it under the terms of the GNU General Public License as published by
 * the Free Software Foundation; either version 2 of the License, or
 * (at your option) any later version.
 * 
 * X-Tray is distributed in the hope that it will be useful,
 * but WITHOUT ANY WARRANTY; without even the implied warranty of
 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
 * GNU General Public License for more details.
 * 
 * You should have received a copy of the GNU General Public License
 * along with X-Tray; if not, write to the Free Software
 * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307  USA
 */

#define _WIN32_IE 0x0601

#include <windows.h>
#include <stdio.h>
#include <commctrl.h>
#include <tchar.h>
#include "utility.h"
#include "plugin.h"
#include "xtray.h&q
<?xml version="1.0" encoding="utf-8"?>
<Project DefaultTargets="Build" ToolsVersion="12.0" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
  <PropertyGroup Label="Configuration">
    <PlatformToolset>v140</PlatformToolset>
    <ConfigurationType>DynamicLibrary</ConfigurationType>
    <CharacterSet>Unicode</CharacterSet>
  </PropertyGroup>
  <ItemGroup Label="ProjectConfigurations">
    <ProjectConfiguration Include="Release|Win32">
      <Configuration>Release</Configuration>
      <Platform>Win32</Platform>
    </ProjectConfiguration>
    <ProjectConfiguration Include="Release|x64">
      <Configuration>Release</Configuration>
      <Platform>x64</Platform>
    </ProjectConfiguration>
  </ItemGroup>
  <PropertyGroup Label="Globals">
    <ProjectGuid>{6C0CA980-97C5-427A-BE61-5BCECAFABBDA}</ProjectGuid>
    <Keyword>Win32Proj</Keyword>
    <RootNamespace>sysinfo</RootNamespace>
  </PropertyGroup>
  <Import Project="$(VCTargetsPath)\Microsoft.Cpp.Default.props" />
  <Import Project="$(VCTargetsPath)\Microsoft.Cpp.props" />
  <Import Project="$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props" Condition="exists('$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props')" Label="LocalAppDataPlatform" />
  <Import Project="..\..\win32\hexchat.props" />
  <PropertyGroup>
    <TargetName>hcsysinfo</TargetName>
    <OutDir>$(HexChatRel)plugins\</OutDir>
  </PropertyGroup>
  <ItemDefinitionGroup Condition="'$(Configuration)|$(Platform)'=='Release|Win32'">
    <ClCompile>
      <PreprocessorDefinitions>WIN32;NDEBUG;_WINDOWS;_USRDLL;SYSINFO_EXPORTS;%(PreprocessorDefinitions)</PreprocessorDefinitions>
      <AdditionalIncludeDirectories>..\..\src\common;$(DepsRoot)\include;$(Glib);$(HexChatLib);%(AdditionalIncludeDirectories)</AdditionalIncludeDirectories>
      <TreatWChar_tAsBuiltInType>false</TreatWChar_tAsBuiltInType>
    </ClCompile>
    <Link>
      <AdditionalLibraryDirectories>$(DepsRoot)\lib;%(AdditionalLibraryDirectories)</AdditionalLibraryDirectories>
      <AdditionalDependencies>$(HexChatLib)common.lib;wbemuuid.lib;comsupp.lib;$(DepLibs);%(AdditionalDependencies)</AdditionalDependencies>
      <IgnoreSpecificDefaultLibraries>comsupp.lib</IgnoreSpecificDefaultLibraries>
      <ModuleDefinitionFile>sysinfo.def</ModuleDefinitionFile>
    </Link>
  </ItemDefinitionGroup>
  <ItemDefinitionGroup Condition="'$(Configuration)|$(Platform)'=='Release|x64'">
    <ClCompile>
      <PreprocessorDefinitions>WIN32;_WIN64;_AMD64_;NDEBUG;_WINDOWS;_USRDLL;SYSINFO_EXPORTS;%(PreprocessorDefinitions)</PreprocessorDefinitions>
      <AdditionalIncludeDirectories>..\..\src\common;$(DepsRoot)\include;$(Glib);$(HexChatLib);%(AdditionalIncludeDirectories)</AdditionalIncludeDirectories>
      <TreatWChar_tAsBuiltInType>false</TreatWChar_tAsBuiltInType>
    </ClCompile>
    <Link>
      <AdditionalLibraryDirectories>$(DepsRoot)\lib;%(AdditionalLibraryDirectories)</AdditionalLibraryDirectories>
      <AdditionalDependencies>$(HexChatLib)common.lib;wbemuuid.lib;comsupp.lib;$(DepLibs);%(AdditionalDependencies)</AdditionalDependencies>
      <IgnoreSpecificDefaultLibraries>comsupp.lib</IgnoreSpecificDefaultLibraries>
      <ModuleDefinitionFile>sysinfo.def</ModuleDefinitionFile>
    </Link>
  </ItemDefinitionGroup>
  <ItemGroup>
    <None Include="sysinfo.def" />
  </ItemGroup>
  <ItemGroup>
    <ClCompile Include="format.c" />
    <ClCompile Include="sysinfo.c" />
    <ClCompile Include="win32\backend.c" />
  </ItemGroup>
  <ItemGroup>
    <ClInclude Include="format.h" />
    <ClInclude Include="sysinfo-backend.h" />
    <ClInclude Include="sysinfo.h" />
  </ItemGroup>
  <Import Project="$(VCTargetsPath)\Microsoft.Cpp.targets" />
</Project>
ass="s">"channel")); dwInfoFlags = NIIF_INFO; break; case CHAN_MESSAGE: _snprintf(szInfo, 512, "%s:\r\n%s", word[1], word[2]); _snprintf(szName, 64, "Channel Message: %s", xchat_get_info (ph, "channel")); dwInfoFlags = NIIF_INFO; break; case CHAN_TOPIC_CHANGE: _snprintf(szInfo, 512, "%s has changed the topic to %s", word[1], word[2]); _snprintf(szName, 64, "Topic Change: %s", word[3]); dwInfoFlags = NIIF_INFO; break; case CHAN_INVITE: _snprintf(szInfo, 512, "%s has invited you into %s", word[1], word[2]); _snprintf(szName, 64, "Invite"); dwInfoFlags = NIIF_INFO; break; case CHAN_KICKED: _snprintf(szInfo, 512, "Kicked from %s by %s:\r\n%s", word[2], word[3], word[4]); _snprintf(szName, 64, "Kick"); dwInfoFlags = NIIF_WARNING; break; case CHAN_BANNED: _snprintf(szInfo, 512, "Cannot join #%s You are banned.", word[1]); _snprintf(szName, 64, "Banned"); dwInfoFlags = NIIF_WARNING; break; case CTCP_GENERIC: _snprintf(szInfo, 512, "%s:\r\nCTCP %s", word[2], word[1]); _snprintf(szName, 64, "CTCP"); dwInfoFlags = NIIF_INFO; break; case PMSG_RECEIVE: _snprintf(szInfo, 512, "%s:\r\n%s", word[1], word[2]); _snprintf(szName, 64, "Private Message"); dwInfoFlags = NIIF_INFO; break; case SERV_DISCONNECT: _snprintf(szInfo, 512, "Disconnected\r\nError: %s", word[1]); _snprintf(szName, 64, "Disconnect"); dwInfoFlags = NIIF_ERROR; break; case SERV_KILLED: _snprintf(szInfo, 512, "Killed(%s(%s))", word[1], word[2]); _snprintf(szName, 64, "Server Admin has killed you"); dwInfoFlags = NIIF_ERROR; break; case SERV_NOTICE: _snprintf(szInfo, 512, "Notice:\r\n%s: %s", word[1], word[2]); _snprintf(szName, 64, "Notice"); dwInfoFlags = NIIF_INFO; break; case 11: _snprintf(szInfo, 512, ":\r\n%s: %s", word[1], word[2]); _snprintf(szName, 64, "Notice"); dwInfoFlags = NIIF_INFO; break; } /**************************************************************************************/ /***** Use windows instead of balloons, and if its a window should we keep it open ****/ /***** indefinately? ****/ /**************************************************************************************/ szTemp = xchat_strip_color(szInfo); if(g_dwPrefs & (1<<PREF_UWIOB)) { sdSystemAlert((HINSTANCE)g_hInstance, IDD_ALERT, szTemp, szName, iTime); } else { ShowBalloon(g_hXchatWnd, 1, szTemp, szName, iTime, dwInfoFlags); } free(szTemp); } if(g_dwPrefs & (1<<PREF_BLINK) && (g_dwPrefs & (1<<iEvent))) { BlinkIcon(g_hXchatWnd, 1, g_hIcons[0], g_hIcons[(iEvent+1)], 700, 5); } /***********************************/ /***** pass the events to xchat ****/ /***********************************/ return XCHAT_EAT_NONE; } int command_cb(char *word[], char *word_eol[], void *userdata) { char szInfo[512]; char *szTemp = NULL; int iTime = g_iTime*1000; _snprintf(szInfo, 512, word_eol[2]); szTemp = xchat_strip_color(szInfo); if(g_dwPrefs & (1<<PREF_KAOI)) { iTime = 0; } if(((g_iIsActive == 0) || !(g_dwPrefs & (1<<PREF_OSBWM))) && (g_dwPrefs & (1<<PREF_AMAE))) { if(g_dwPrefs & (1<<PREF_UWIOB)) { sdSystemAlert((HINSTANCE)g_hInstance, IDD_ALERT, szTemp, "Alert", iTime); } else { ShowBalloon(g_hXchatWnd, 1, szTemp, "Alert", iTime, NIIF_INFO); } } free(szTemp); return XCHAT_EAT_ALL; } LRESULT CALLBACK WindowProc(HWND hWnd, UINT msg, WPARAM wparam, LPARAM lparam) { switch(msg) { case WM_CLOSE: { if((g_dwPrefs & (1<<PREF_MIOC)) && (g_bCanQuit == false)) { /*******************************************/ /**** to autoaway or not to autoaway... ***/ /*******************************************/ if(g_dwPrefs & (1<<PREF_AOM)) { xchat_globally_away(g_szAway); } /**************************************************/ /**** Win32 API call to hide the window and **/ /**** save the fact that its minimized for later **/ /**************************************************/ g_iIsActive = 0; ShowWindow(hWnd, SW_HIDE); return 0; } else { if(g_hPrefDlg != NULL) { DestroyWindow(g_hPrefDlg); } StopBlink(hWnd, 1, g_hIcons[0]); if(sdAlertNum()) { sdCloseAlerts(); HoldClose(); return 0; } } } break; case WM_SIZE: { /******************************************/ /***** User wants to minimize xChat, ******/ /***** are we allowed to go to tray? ******/ /******************************************/ if((g_dwPrefs & (1<<PREF_TOT)) && (wparam == SIZE_MINIMIZED)) { /*******************************************/ /**** to autoaway or not to autoaway... ***/ /*******************************************/ if(g_dwPrefs & (1<<PREF_AOM)) { xchat_globally_away(g_szAway); } /**************************************************/ /**** Win32 API call to hide the window and **/ /**** save the fact that its minimized for later **/ /**************************************************/ g_iIsActive = 0; ShowWindow(hWnd, SW_HIDE); } } break; /**********************************/ /*** user clicked the tray icon ***/ /**********************************/ case WM_TRAYMSG: { switch(lparam) { case WM_LBUTTONDOWN: { if(!g_iIsActive) { /*********************************************************/ /*** 0: its hiden, restore it and show it, if autoaway ***/ /*** is on, set us as back ***/ /*********************************************************/ SendMessage(hWnd, WM_SYSCOMMAND, SC_RESTORE, 0); SetForegroundWindow(hWnd); g_iIsActive = 1; if(g_dwPrefs & (1<<PREF_AOM)) { xchat_globally_back(); } } else { SendMessage(hWnd, WM_SYSCOMMAND, SC_MINIMIZE, 0); } } break; case WM_RBUTTONDOWN: { /******************************************/ /*** user wants to see the menu find out **/ /*** where the mouse is and show it **/ /******************************************/ POINT pt; int iRet; GetCursorPos(&pt); SetForegroundWindow(hWnd); ModifyMenu(g_hTrayMenu, 2, (MF_POPUP | MF_BYPOSITION), (UINT)setServerMenu(), _T("Away")); Sleep(175); iRet = TrackPopupMenuEx(g_hTrayMenu, (TPM_RETURNCMD | TPM_LEFTALIGN), pt.x, pt.y, hWnd, NULL); /***********************************/ /*** nRet is the users selection, **/ /*** process it **/ /***********************************/ sdTrayProc(hWnd, iRet); } break; } } break; default: { /*****************************************************/ /*** the taskbar has been restarted, re-add our icon */ /*****************************************************/ if(msg == RegisterWindowMessage(_T("TaskbarCreated"))) { char szVersion[64]; _snprintf(szVersion, 64, "XChat-WDK [%s]", xchat_get_info(ph, "version")); AddIcon(g_hXchatWnd, 1, g_hIcons[0], szVersion, (NIF_ICON | NIF_MESSAGE | NIF_TIP), WM_TRAYMSG); } } break; } return CallWindowProc(g_hOldProc, hWnd, msg, wparam, lparam); } /****************************************************/ /*** process messages from the tray menu ************/ /****************************************************/ LRESULT CALLBACK sdTrayProc(HWND hWnd, int msg) { switch(msg) { case ACT_EXIT: { g_bCanQuit = true; PostMessage(hWnd, WM_CLOSE, 0, 0); } break; case ACT_RESTORE: { /***********************************************/ /** user wants us to restore the xchat window **/ /** and of autoaway is on, set as back **/ /***********************************************/ SendMessage(g_hXchatWnd, WM_SYSCOMMAND, SC_RESTORE, 0); SetForegroundWindow(hWnd); if((!g_iIsActive) && (g_dwPrefs & (1<<PREF_AOM))) { xchat_globally_back(); g_iIsActive = 1; } } break; case ACT_SETTINGS: { ShowWindow(g_hPrefDlg, SW_SHOW); } break; case ACT_AWAY: { xchat_globally_away(g_szAway); } break; case ACT_BACK: { xchat_globally_back(); } break; default: { if(msg > 0) { xchat_set_context(ph, xchat_find_server(msg-1)); if(!xchat_get_info(ph, "away")) { xchat_away(g_szAway); } else { xchat_back(); } } } break; } return 1; } int CALLBACK PrefProc(HWND hWnd, UINT msg, WPARAM wparam, LPARAM lparam) { switch(msg) { case WM_INITDIALOG: { TCITEM tci1; TCITEM tci2; TCITEM tci3; TCITEM tci4; tci1.mask = TCIF_TEXT; tci1.pszText = _T("Settings"); tci1.cchTextMax = strlen("Settings"); SendDlgItemMessage(hWnd, IDC_TAB_CONTROL, TCM_INSERTITEM, 0, (LPARAM)&tci1); tci2.mask = TCIF_TEXT; tci2.pszText = _T("Alerts"); tci2.cchTextMax = strlen("Alerts"); SendDlgItemMessage(hWnd, IDC_TAB_CONTROL, TCM_INSERTITEM, 1, (LPARAM)&tci2); tci3.mask = TCIF_TEXT; tci3.pszText = _T("Events"); tci3.cchTextMax = strlen("Events"); SendDlgItemMessage(hWnd, IDC_TAB_CONTROL, TCM_INSERTITEM, 2, (LPARAM)&tci3); tci4.mask = TCIF_TEXT; tci4.pszText = _T("About"); tci4.cchTextMax = strlen("About"); SendDlgItemMessage(hWnd, IDC_TAB_CONTROL, TCM_INSERTITEM, 3, (LPARAM)&tci4); /***********************************************************************************/ /***********************************************************************************/ /***********************************************************************************/ g_hPrefTabSettings = CreateDialog((HINSTANCE)g_hInstance, MAKEINTRESOURCE(IDD_SETTINGS), hWnd, (DLGPROC)SettingsProc); SetDialog(g_hPrefTabSettings, IDD_SETTINGS); g_hPrefTabAlerts = CreateDialog((HINSTANCE)g_hInstance, MAKEINTRESOURCE(IDD_ALERTS), hWnd, (DLGPROC)AlertsProc); SetDialog(g_hPrefTabAlerts, IDD_ALERTS); g_hPrefTabEvents = CreateDialog((HINSTANCE)g_hInstance, MAKEINTRESOURCE(IDD_EVENTS), hWnd, (DLGPROC)EventsProc); SetDialog(g_hPrefTabEvents, IDD_EVENTS); g_hPrefTabAbout = CreateDialog((HINSTANCE)g_hInstance, MAKEINTRESOURCE(IDD_ABOUT), hWnd, (DLGPROC)AboutProc); } break; case WM_SHOWWINDOW: { if(wparam) { SendDlgItemMessage(hWnd, IDC_TAB_CONTROL, TCM_SETCURSEL, 0, 0); ShowWindow(g_hPrefTabSettings, SW_SHOW); ShowWindow(g_hPrefTabAlerts, SW_HIDE); ShowWindow(g_hPrefTabEvents, SW_HIDE); ShowWindow(g_hPrefTabAbout, SW_HIDE); } } break; case WM_NOTIFY: { NMHDR *pData = (NMHDR *)lparam; switch(pData->code) { case TCN_SELCHANGE: { switch(SendDlgItemMessage(hWnd, IDC_TAB_CONTROL, TCM_GETCURSEL, 0, 0)) { case 0: { ShowWindow(g_hPrefTabSettings, SW_SHOW); ShowWindow(g_hPrefTabAlerts, SW_HIDE); ShowWindow(g_hPrefTabEvents, SW_HIDE); ShowWindow(g_hPrefTabAbout, SW_HIDE); } break; case 1: { ShowWindow(g_hPrefTabSettings, SW_HIDE); ShowWindow(g_hPrefTabAlerts, SW_SHOW); ShowWindow(g_hPrefTabEvents, SW_HIDE); ShowWindow(g_hPrefTabAbout, SW_HIDE); } break; case 2: { ShowWindow(g_hPrefTabSettings, SW_HIDE); ShowWindow(g_hPrefTabAlerts, SW_HIDE); ShowWindow(g_hPrefTabEvents, SW_SHOW); ShowWindow(g_hPrefTabAbout, SW_HIDE); } break; case 3: { ShowWindow(g_hPrefTabSettings, SW_HIDE); ShowWindow(g_hPrefTabAlerts, SW_HIDE); ShowWindow(g_hPrefTabEvents, SW_HIDE); ShowWindow(g_hPrefTabAbout, SW_SHOW); } break; } } break; } } break; case WM_CLOSE: { ShowWindow(g_hPrefTabEvents, SW_HIDE); ShowWindow(g_hPrefTabSettings, SW_HIDE); ShowWindow(g_hPrefTabAlerts, SW_HIDE); ShowWindow(g_hPrefTabAbout, SW_HIDE); ShowWindow(hWnd, SW_HIDE); return TRUE; } break; case WM_COMMAND: { switch(wparam) { case IDC_PREF_OK: { CheckPrefs(g_hPrefTabEvents, IDD_EVENTS); CheckPrefs(g_hPrefTabSettings, IDD_SETTINGS); CheckPrefs(g_hPrefTabAlerts, IDD_ALERTS); SavePrefs(0); ShowWindow(g_hPrefTabEvents, SW_HIDE); ShowWindow(g_hPrefTabSettings, SW_HIDE); ShowWindow(g_hPrefTabAlerts, SW_HIDE); ShowWindow(g_hPrefTabAbout, SW_HIDE); ShowWindow(hWnd, SW_HIDE); return TRUE; } break; case IDC_PREF_CANCEL: { ShowWindow(g_hPrefTabEvents, SW_HIDE); ShowWindow(g_hPrefTabSettings, SW_HIDE); ShowWindow(g_hPrefTabAlerts, SW_HIDE); ShowWindow(g_hPrefTabAbout, SW_HIDE); ShowWindow(hWnd, SW_HIDE); return TRUE; } break; case IDC_PREF_APPLY: { CheckPrefs(g_hPrefTabEvents, IDD_EVENTS); CheckPrefs(g_hPrefTabSettings, IDD_SETTINGS); CheckPrefs(g_hPrefTabAlerts, IDD_ALERTS); SavePrefs(0); return FALSE; } break; } } break; case WM_DESTROY: { SendMessage(g_hPrefTabEvents, WM_CLOSE, 0, 0); SendMessage(g_hPrefTabSettings, WM_CLOSE, 0, 0); SendMessage(g_hPrefTabAbout, WM_CLOSE, 0, 0); SendMessage(g_hPrefTabAlerts, WM_CLOSE, 0, 0); } break; } return FALSE; } /****************************************************/ /****************************************************/ /****************************************************/ LRESULT CALLBACK AlertsProc(HWND hWnd, UINT msg, WPARAM wparam, LPARAM lparam) { switch(msg) { case WM_CLOSE: { DestroyWindow(hWnd); return TRUE; break; } break; case WM_COMMAND: { switch(LOWORD(wparam)) { case PREF_AMAE: { SetToggle(hWnd, PREF_OSBWM, PREF_AMAE, TRUE); SetToggle(hWnd, PREF_UWIOB, PREF_AMAE, TRUE); SetToggle(hWnd, PREF_KAOI, PREF_AMAE, TRUE); if(IsDlgButtonChecked(hWnd, PREF_AMAE)) { SetToggle(hWnd, IDC_ALERT_HOTKEY, PREF_UWIOB, TRUE); SetToggle(hWnd, IDC_ALERT_HOTKEY_TEXT, PREF_UWIOB, TRUE); SetToggle(hWnd, IDC_ALERT_TIME, PREF_KAOI, FALSE); SetToggle(hWnd, IDC_ALERT_TIME_TEXT, PREF_KAOI, FALSE); } else { SetToggle(hWnd, IDC_ALERT_HOTKEY, PREF_AMAE, TRUE); SetToggle(hWnd, IDC_ALERT_HOTKEY_TEXT, PREF_AMAE, TRUE); SetToggle(hWnd, IDC_ALERT_TIME, PREF_AMAE, TRUE); SetToggle(hWnd, IDC_ALERT_TIME_TEXT, PREF_AMAE, TRUE); } } break; case PREF_UWIOB: { SetToggle(hWnd, IDC_ALERT_HOTKEY, PREF_UWIOB, TRUE); SetToggle(hWnd, IDC_ALERT_HOTKEY_TEXT, PREF_UWIOB, TRUE); } break; case PREF_KAOI: { SetToggle(hWnd, IDC_ALERT_TIME, PREF_KAOI, FALSE); SetToggle(hWnd, IDC_ALERT_TIME_TEXT, PREF_KAOI, FALSE); } break; } break; } } return FALSE; } /****************************************************/ /****************************************************/ /****************************************************/ LRESULT CALLBACK AboutProc(HWND hWnd, UINT msg, WPARAM wparam, LPARAM lparam) { if(msg == WM_CLOSE) { DestroyWindow(hWnd); return true; } return FALSE; } /*****************************************************/ /** Process the events for our event dialog **********/ /*****************************************************/ LRESULT CALLBACK EventsProc(HWND hWnd, UINT msg, WPARAM wparam, LPARAM lparam) { if(msg == WM_CLOSE) { DestroyWindow(hWnd); return true; } return FALSE; } /*****************************************************/ /** Process the events for our settings dialog this **/ /** is alot more complicated because options are **/ /** enabled/disabled based on the state of others **/ /*****************************************************/ LRESULT CALLBACK SettingsProc(HWND hWnd, UINT msg, WPARAM wparam, LPARAM lparam) { if(msg == WM_CLOSE) { DestroyWindow(hWnd); return true; } return FALSE; } /*****************************************************/ /** this is the hotkey message processing function **/ /** this window is always open and ready to be told **/ /** if someone has hit the hotkey, if they did, we **/ /** need to close out all of the tray alerts, for **/ /** this I wrote sdCloseAlerts, more info there **/ /*****************************************************/ LRESULT CALLBACK HotKeyProc(HWND hWnd, UINT msg, WPARAM wparam, LPARAM lparam) { if(msg == WM_CLOSE) { DestroyWindow(hWnd); return true; } else if(msg == WM_HOTKEY) { sdCloseAlerts(); } return FALSE; }