diff options
-rw-r--r-- | plugins/IEHistory/IEHistory_10.vcxproj | 9 | ||||
-rw-r--r-- | plugins/IEHistory/IEHistory_10.vcxproj.filters | 3 | ||||
-rw-r--r-- | plugins/IEHistory/IEHistory_12.vcxproj | 9 | ||||
-rw-r--r-- | plugins/IEHistory/IEHistory_12.vcxproj.filters | 3 | ||||
-rw-r--r-- | plugins/IEHistory/src/IEHistory.cpp | 25 | ||||
-rw-r--r-- | plugins/IEHistory/src/commonheaders.h | 85 | ||||
-rw-r--r-- | plugins/IEHistory/src/dlgHandlers.cpp | 1000 | ||||
-rw-r--r-- | plugins/IEHistory/src/dlgHandlers.h | 2 | ||||
-rw-r--r-- | plugins/IEHistory/src/events.cpp | 1 | ||||
-rw-r--r-- | plugins/IEHistory/src/events.h | 2 | ||||
-rw-r--r-- | plugins/IEHistory/src/services.cpp | 1 | ||||
-rw-r--r-- | plugins/IEHistory/src/services.h | 2 | ||||
-rw-r--r-- | plugins/IEHistory/src/stdafx.cpp | 1 | ||||
-rw-r--r-- | plugins/IEHistory/src/stdafx.h | 83 | ||||
-rw-r--r-- | plugins/IEHistory/src/utils.cpp | 2 | ||||
-rw-r--r-- | plugins/IEHistory/src/utils.h | 4 |
16 files changed, 533 insertions, 699 deletions
diff --git a/plugins/IEHistory/IEHistory_10.vcxproj b/plugins/IEHistory/IEHistory_10.vcxproj index 1b1c293e5c..29284e30df 100644 --- a/plugins/IEHistory/IEHistory_10.vcxproj +++ b/plugins/IEHistory/IEHistory_10.vcxproj @@ -79,7 +79,7 @@ <Optimization>Full</Optimization> <FavorSizeOrSpeed>Size</FavorSizeOrSpeed> <PrecompiledHeader>Use</PrecompiledHeader> - <PrecompiledHeaderFile>commonheaders.h</PrecompiledHeaderFile> + <PrecompiledHeaderFile>stdafx.h</PrecompiledHeaderFile> </ClCompile> <Link> <AdditionalDependencies>comctl32.lib;User32.lib;%(AdditionalDependencies)</AdditionalDependencies> @@ -106,7 +106,7 @@ <WarningLevel>Level3</WarningLevel> <DebugInformationFormat>EditAndContinue</DebugInformationFormat> <PrecompiledHeader>Use</PrecompiledHeader> - <PrecompiledHeaderFile>commonheaders.h</PrecompiledHeaderFile> + <PrecompiledHeaderFile>stdafx.h</PrecompiledHeaderFile> </ClCompile> <Link> <AdditionalDependencies>comctl32.lib;User32.lib;%(AdditionalDependencies)</AdditionalDependencies> @@ -129,7 +129,7 @@ <Optimization>Full</Optimization> <FavorSizeOrSpeed>Size</FavorSizeOrSpeed> <PrecompiledHeader>Use</PrecompiledHeader> - <PrecompiledHeaderFile>commonheaders.h</PrecompiledHeaderFile> + <PrecompiledHeaderFile>stdafx.h</PrecompiledHeaderFile> </ClCompile> <Link> <AdditionalDependencies>comctl32.lib;User32.lib;%(AdditionalDependencies)</AdditionalDependencies> @@ -155,7 +155,7 @@ <RuntimeLibrary>MultiThreadedDebugDLL</RuntimeLibrary> <WarningLevel>Level3</WarningLevel> <PrecompiledHeader>Use</PrecompiledHeader> - <PrecompiledHeaderFile>commonheaders.h</PrecompiledHeaderFile> + <PrecompiledHeaderFile>stdafx.h</PrecompiledHeaderFile> </ClCompile> <Link> <AdditionalDependencies>comctl32.lib;User32.lib;%(AdditionalDependencies)</AdditionalDependencies> @@ -182,7 +182,6 @@ </ItemGroup> <ItemGroup> <ClInclude Include="src\stdafx.h" /> - <ClInclude Include="src\commonheaders.h" /> <ClInclude Include="src\dlgHandlers.h" /> <ClInclude Include="src\events.h" /> <ClInclude Include="src\resource.h" /> diff --git a/plugins/IEHistory/IEHistory_10.vcxproj.filters b/plugins/IEHistory/IEHistory_10.vcxproj.filters index f9596b23a8..32ace60313 100644 --- a/plugins/IEHistory/IEHistory_10.vcxproj.filters +++ b/plugins/IEHistory/IEHistory_10.vcxproj.filters @@ -36,9 +36,6 @@ <ClInclude Include="src\stdafx.h"> <Filter>Header Files</Filter> </ClInclude> - <ClInclude Include="src\commonheaders.h"> - <Filter>Header Files</Filter> - </ClInclude> <ClInclude Include="src\dlgHandlers.h"> <Filter>Header Files</Filter> </ClInclude> diff --git a/plugins/IEHistory/IEHistory_12.vcxproj b/plugins/IEHistory/IEHistory_12.vcxproj index 04b87f4e94..84016efa7d 100644 --- a/plugins/IEHistory/IEHistory_12.vcxproj +++ b/plugins/IEHistory/IEHistory_12.vcxproj @@ -83,7 +83,7 @@ <Optimization>Full</Optimization> <FavorSizeOrSpeed>Size</FavorSizeOrSpeed> <PrecompiledHeader>Use</PrecompiledHeader> - <PrecompiledHeaderFile>commonheaders.h</PrecompiledHeaderFile> + <PrecompiledHeaderFile>stdafx.h</PrecompiledHeaderFile> </ClCompile> <Link> <AdditionalDependencies>comctl32.lib;User32.lib;%(AdditionalDependencies)</AdditionalDependencies> @@ -109,7 +109,7 @@ <WarningLevel>Level3</WarningLevel> <DebugInformationFormat>EditAndContinue</DebugInformationFormat> <PrecompiledHeader>Use</PrecompiledHeader> - <PrecompiledHeaderFile>commonheaders.h</PrecompiledHeaderFile> + <PrecompiledHeaderFile>stdafx.h</PrecompiledHeaderFile> </ClCompile> <Link> <AdditionalDependencies>comctl32.lib;User32.lib;%(AdditionalDependencies)</AdditionalDependencies> @@ -133,7 +133,7 @@ <Optimization>Full</Optimization> <FavorSizeOrSpeed>Size</FavorSizeOrSpeed> <PrecompiledHeader>Use</PrecompiledHeader> - <PrecompiledHeaderFile>commonheaders.h</PrecompiledHeaderFile> + <PrecompiledHeaderFile>stdafx.h</PrecompiledHeaderFile> </ClCompile> <Link> <AdditionalDependencies>comctl32.lib;User32.lib;%(AdditionalDependencies)</AdditionalDependencies> @@ -158,7 +158,7 @@ <RuntimeLibrary>MultiThreadedDebugDLL</RuntimeLibrary> <WarningLevel>Level3</WarningLevel> <PrecompiledHeader>Use</PrecompiledHeader> - <PrecompiledHeaderFile>commonheaders.h</PrecompiledHeaderFile> + <PrecompiledHeaderFile>stdafx.h</PrecompiledHeaderFile> </ClCompile> <Link> <AdditionalDependencies>comctl32.lib;User32.lib;%(AdditionalDependencies)</AdditionalDependencies> @@ -185,7 +185,6 @@ </ItemGroup> <ItemGroup> <ClInclude Include="src\stdafx.h" /> - <ClInclude Include="src\commonheaders.h" /> <ClInclude Include="src\dlgHandlers.h" /> <ClInclude Include="src\events.h" /> <ClInclude Include="src\resource.h" /> diff --git a/plugins/IEHistory/IEHistory_12.vcxproj.filters b/plugins/IEHistory/IEHistory_12.vcxproj.filters index f9596b23a8..32ace60313 100644 --- a/plugins/IEHistory/IEHistory_12.vcxproj.filters +++ b/plugins/IEHistory/IEHistory_12.vcxproj.filters @@ -36,9 +36,6 @@ <ClInclude Include="src\stdafx.h"> <Filter>Header Files</Filter> </ClInclude> - <ClInclude Include="src\commonheaders.h"> - <Filter>Header Files</Filter> - </ClInclude> <ClInclude Include="src\dlgHandlers.h"> <Filter>Header Files</Filter> </ClInclude> diff --git a/plugins/IEHistory/src/IEHistory.cpp b/plugins/IEHistory/src/IEHistory.cpp index 86f93ed20c..b12c216810 100644 --- a/plugins/IEHistory/src/IEHistory.cpp +++ b/plugins/IEHistory/src/IEHistory.cpp @@ -19,8 +19,6 @@ Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. */ #include "stdafx.h" - -#include "commonheaders.h" #include "services.h" int hLangpack;//Miranda NG langpack used by translate functions, filled by mir_getLP() @@ -32,12 +30,6 @@ HANDLE hOpenWindowsList = NULL; HMODULE hUxTheme = 0; BOOL (WINAPI *MyEnableThemeDialogTexture)(HANDLE, DWORD) = NULL; -#ifdef _UNICODE -#define IEHISTORY_PLUGININFO_SUFFIX " (Unicode)" -#else -#define IEHISTORY_PLUGININFO_SUFFIX "" -#endif - PLUGININFOEX pluginInfo = { sizeof(PLUGININFOEX), __PLUGIN_DISPLAY_NAME, @@ -55,15 +47,13 @@ extern "C" __declspec(dllexport) PLUGININFOEX *MirandaPluginInfoEx(DWORD miranda return &pluginInfo; } -static const MUUID interfaces[] = {MIID_UIHISTORY, MIID_LAST}; +static const MUUID interfaces[] = { MIID_UIHISTORY, MIID_LAST }; extern "C" __declspec(dllexport) const MUUID *MirandaPluginInterfaces() { return interfaces; } -#include <commctrl.h> - extern "C" int __declspec(dllexport) Load(void) { mir_getLP(&pluginInfo); @@ -73,16 +63,15 @@ extern "C" int __declspec(dllexport) Load(void) icex.dwICC = ICC_DATE_CLASSES; InitCommonControlsEx(&icex); - - if((hUxTheme = LoadLibraryA("uxtheme.dll")) != 0){ - MyEnableThemeDialogTexture = (BOOL (WINAPI *)(HANDLE, DWORD))GetProcAddress(hUxTheme, "EnableThemeDialogTexture"); - } + + if ((hUxTheme = LoadLibraryA("uxtheme.dll")) != 0) + MyEnableThemeDialogTexture = (BOOL(WINAPI *)(HANDLE, DWORD))GetProcAddress(hUxTheme, "EnableThemeDialogTexture"); //all initialization here hIcon = LoadIcon(hInstance, MAKEINTRESOURCE(IDI_HISTORYICON)); InitServices(); - + HookEvents(); return 0; } @@ -90,7 +79,7 @@ extern "C" int __declspec(dllexport) Load(void) extern "C" int __declspec(dllexport) Unload() { DestroyServices(); - + WindowList_Broadcast(hOpenWindowsList, WM_CLOSE, 0, 0); return 0; } @@ -98,7 +87,7 @@ extern "C" int __declspec(dllexport) Unload() BOOL WINAPI DllMain(HINSTANCE hinstDLL, DWORD fdwReason, LPVOID lpvReserved) { hInstance = hinstDLL; - if(fdwReason == DLL_PROCESS_ATTACH){ + if (fdwReason == DLL_PROCESS_ATTACH) { DisableThreadLibraryCalls(hinstDLL); LogInit(); } diff --git a/plugins/IEHistory/src/commonheaders.h b/plugins/IEHistory/src/commonheaders.h deleted file mode 100644 index 322932f1e4..0000000000 --- a/plugins/IEHistory/src/commonheaders.h +++ /dev/null @@ -1,85 +0,0 @@ -/* -IEView history viewer plugin for Miranda IM - -Copyright © 2005-2006 Cristian Libotean - -This program 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. - -This program 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 this program; if not, write to the Free Software -Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. -*/ - -#ifndef M_COMMON_HEADERS_H -#define M_COMMON_HEADERS_H - - -#define EVENTTYPE_STATUS 25368 //tabsrmm status events - -#include "stdafx.h" -#include <malloc.h> -#include <stdio.h> -#include <stdlib.h> -#include <uxtheme.h> - -#include "resource.h" -#include "version.h" - -#include "utils.h" -#include "events.h" -#include "dlgHandlers.h" - -#include <newpluginapi.h> -#include <m_database.h> -#include <m_utils.h> -#include <m_system.h> -#include <m_skin.h> -#include <m_options.h> -#include <m_clist.h> -#include <m_langpack.h> -#include <m_history.h> -#include <m_contacts.h> -#include <m_metacontacts.h> -#include <m_protocols.h> -//#include <m_utils.h> -#include <m_popup.h> -#include <m_ieview.h> - -static FILE* fopen_s2(const char* file,const char* mode){ - FILE* ret=NULL; fopen_s(&ret,file,mode); - return ret; -} -#define fopen fopen_s2 -#define strcat strcat_s -#define _vsnprintf _vsnprintf_s -#define snprintf _snprintf_s -#define snwprintf _snwprintf_s -#define sprintf sprintf_s -#define itow _itow_s -#ifndef _UNICODE -# define itot itoa -# define sntprintf snprintf -#else -# define itot itow -# define sntprintf snwprintf -#endif - -extern HICON hIcon; //history icon -extern int hLangpack; -extern char ModuleName[]; -extern HINSTANCE hInstance; //dll instance -extern HANDLE hOpenWindowsList; - -extern PLUGININFOEX pluginInfo; - -extern BOOL (WINAPI *MyEnableThemeDialogTexture)(HANDLE, DWORD); - -#endif diff --git a/plugins/IEHistory/src/dlgHandlers.cpp b/plugins/IEHistory/src/dlgHandlers.cpp index abc185cac5..2f9b645692 100644 --- a/plugins/IEHistory/src/dlgHandlers.cpp +++ b/plugins/IEHistory/src/dlgHandlers.cpp @@ -18,9 +18,8 @@ along with this program; if not, write to the Free Software Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. */ +#include "stdafx.h" #include "dlgHandlers.h" -#include "math.h" -#include <commctrl.h> //#define GAP_SIZE 2 #define GAP_SIZE 0 @@ -51,22 +50,22 @@ HANDLE GetNeededEvent(HANDLE hLastFirstEvent, int num, int direction); int CalcIEViewPos(IEVIEWWINDOW *ieWnd, HWND hMainWindow) { RECT rect; - GetWindowRect(GetDlgItem(hMainWindow,IDC_IEVIEW_PLACEHOLDER), &rect); - rect.right-=rect.left; rect.bottom-=rect.top; + GetWindowRect(GetDlgItem(hMainWindow, IDC_IEVIEW_PLACEHOLDER), &rect); + rect.right -= rect.left; rect.bottom -= rect.top; ScreenToClient(hMainWindow, (POINT*)&rect); /// @todo : find out why -1/+1 is required... or why IEView uses a border... - ieWnd->x = -1+rect.left + GAP_SIZE; - ieWnd->y = -1+rect.top + GAP_SIZE; - ieWnd->cx = 2+rect.right - (2 * GAP_SIZE); - ieWnd->cy = 2+rect.bottom - (2 * GAP_SIZE); + ieWnd->x = -1 + rect.left + GAP_SIZE; + ieWnd->y = -1 + rect.top + GAP_SIZE; + ieWnd->cx = 2 + rect.right - (2 * GAP_SIZE); + ieWnd->cy = 2 + rect.bottom - (2 * GAP_SIZE); return 0; } void LoadName(HWND hWnd) { - HistoryWindowData *data = (HistoryWindowData *) GetWindowLongPtr(hWnd, DWLP_USER); - if(!data->contact){ + HistoryWindowData *data = (HistoryWindowData *)GetWindowLongPtr(hWnd, DWLP_USER); + if (!data->contact) { SetWindowText(hWnd, TranslateT("System History")); return; } @@ -79,140 +78,131 @@ void LoadName(HWND hWnd) int LoadIEView(HWND hWnd) { - IEVIEWWINDOW ieWnd = {sizeof(ieWnd)}; + IEVIEWWINDOW ieWnd = { sizeof(ieWnd) }; ieWnd.iType = IEW_CREATE; ieWnd.dwMode = IEWM_HISTORY; ieWnd.dwFlags = 0; ieWnd.parent = hWnd; CalcIEViewPos(&ieWnd, hWnd); - - CallService(MS_IEVIEW_WINDOW, 0, (LPARAM) &ieWnd); - HistoryWindowData *data = (HistoryWindowData *) GetWindowLongPtr(hWnd, DWLP_USER); + + CallService(MS_IEVIEW_WINDOW, 0, (LPARAM)&ieWnd); + HistoryWindowData *data = (HistoryWindowData *)GetWindowLongPtr(hWnd, DWLP_USER); data->hIEView = ieWnd.hwnd; return 0; } int MoveIeView(HWND hWnd) { - HistoryWindowData *data = (HistoryWindowData *) GetWindowLongPtr(hWnd, DWLP_USER); - if (data) - { - IEVIEWWINDOW ieWnd = {0}; - ieWnd.cbSize = sizeof(ieWnd); - ieWnd.parent = hWnd; - ieWnd.hwnd = data->hIEView; - ieWnd.iType = IEW_SETPOS; - CalcIEViewPos(&ieWnd, hWnd); - CallService(MS_IEVIEW_WINDOW, 0, (LPARAM) &ieWnd); - } + HistoryWindowData *data = (HistoryWindowData *)GetWindowLongPtr(hWnd, DWLP_USER); + if (data) { + IEVIEWWINDOW ieWnd = { 0 }; + ieWnd.cbSize = sizeof(ieWnd); + ieWnd.parent = hWnd; + ieWnd.hwnd = data->hIEView; + ieWnd.iType = IEW_SETPOS; + CalcIEViewPos(&ieWnd, hWnd); + CallService(MS_IEVIEW_WINDOW, 0, (LPARAM)&ieWnd); + } return 0; } int DestroyIEView(HWND hWnd) { - HistoryWindowData *data = (HistoryWindowData *) GetWindowLongPtr(hWnd, DWLP_USER); - IEVIEWWINDOW ieWnd = {0}; + HistoryWindowData *data = (HistoryWindowData *)GetWindowLongPtr(hWnd, DWLP_USER); + IEVIEWWINDOW ieWnd = { 0 }; ieWnd.cbSize = sizeof(ieWnd); ieWnd.parent = hWnd; ieWnd.hwnd = data->hIEView; ieWnd.iType = IEW_DESTROY; - CallService(MS_IEVIEW_WINDOW, 0, (LPARAM) &ieWnd); + CallService(MS_IEVIEW_WINDOW, 0, (LPARAM)&ieWnd); return 0; } void FillIEViewInfo(IEVIEWEVENTDATA *fillData, DBEVENTINFO dbInfo, PBYTE blob) { - switch (dbInfo.eventType) - { - case EVENTTYPE_MESSAGE: - fillData->iType = IEED_EVENT_MESSAGE; - break; - case EVENTTYPE_STATUS: - fillData->iType = IEED_EVENT_STATUSCHANGE; - break; - case EVENTTYPE_FILE: - fillData->iType = IEED_EVENT_FILE; - break; - case EVENTTYPE_URL: - fillData->iType = IEED_EVENT_URL; - break; - } + switch (dbInfo.eventType) { + case EVENTTYPE_MESSAGE: + fillData->iType = IEED_EVENT_MESSAGE; + break; + case EVENTTYPE_STATUS: + fillData->iType = IEED_EVENT_STATUSCHANGE; + break; + case EVENTTYPE_FILE: + fillData->iType = IEED_EVENT_FILE; + break; + case EVENTTYPE_URL: + fillData->iType = IEED_EVENT_URL; + break; + } fillData->pszNick = "<nick here>"; fillData->bIsMe = (dbInfo.flags & DBEF_SENT); fillData->dwFlags = (dbInfo.flags & DBEF_SENT) ? IEEDF_SENT : 0; fillData->time = dbInfo.timestamp; - size_t len = strlen((char *) blob) + 1; + size_t len = strlen((char *)blob) + 1; PBYTE pos; - - fillData->pszText = (char *) blob; -// fillData.pszText2 = (char *) blob; - if (len < dbInfo.cbBlob) - { - pos = blob + len; - fillData->pszTextW = (wchar_t *) pos; -// fillData->pszText2W = (wchar_t *) pos; - fillData->dwFlags |= IEEDF_UNICODE_TEXT; - } + + fillData->pszText = (char *)blob; + // fillData.pszText2 = (char *) blob; + if (len < dbInfo.cbBlob) { + pos = blob + len; + fillData->pszTextW = (wchar_t *)pos; + // fillData->pszText2W = (wchar_t *) pos; + fillData->dwFlags |= IEEDF_UNICODE_TEXT; + } } DWORD WINAPI WorkerThread(LPVOID lpvData) { Log("%s", "Inside worker thread ..."); - WorkerThreadData *data = (WorkerThreadData *) lpvData; + WorkerThreadData *data = (WorkerThreadData *)lpvData; EnableWindow(GetDlgItem(data->hWnd, IDC_CLOSE), FALSE); const int LOAD_COUNT = 10; int count = 0; int target = data->ieEvent.count; int cLoad = LOAD_COUNT; int i; - IEVIEWEVENTDATA ieData[LOAD_COUNT] = {0}; - PBYTE messages[LOAD_COUNT] = {0}; + IEVIEWEVENTDATA ieData[LOAD_COUNT] = { 0 }; + PBYTE messages[LOAD_COUNT] = { 0 }; HANDLE dbEvent = data->ieEvent.hDbEventFirst; - for (i = 0; i < LOAD_COUNT; i++) - { - ieData[i].cbSize = sizeof(IEVIEWEVENTDATA); //set the cbsize here, no need to do it every time - ieData[i].next = &ieData[i + 1]; //it's a vector, so v[i]'s next element is v[i + 1] - } + for (i = 0; i < LOAD_COUNT; i++) { + ieData[i].cbSize = sizeof(IEVIEWEVENTDATA); //set the cbsize here, no need to do it every time + ieData[i].next = &ieData[i + 1]; //it's a vector, so v[i]'s next element is v[i + 1] + } ieData[LOAD_COUNT - 1].next = NULL; IEVIEWEVENT ieEvent = data->ieEvent; ieEvent.iType = IEE_LOG_MEM_EVENTS; ieEvent.eventData = ieData; - DBEVENTINFO dbInfo = {0}; + DBEVENTINFO dbInfo = { 0 }; dbInfo.cbSize = sizeof(DBEVENTINFO); PBYTE buffer = NULL; int newSize, oldSize = 0; - while (count < target) - { - cLoad = (count + LOAD_COUNT > target) ? target - count : LOAD_COUNT; - ieEvent.count = -1; - - for (i = 0; i < cLoad; i++) - { - newSize = db_event_getBlobSize(dbEvent); - if (newSize > oldSize) - { - buffer = (PBYTE) realloc(buffer, newSize); - dbInfo.pBlob = buffer; - oldSize = newSize; - } - messages[i] = (PBYTE) realloc(messages[i], newSize); - dbInfo.cbBlob = newSize; - if (!db_event_get(dbEvent,&dbInfo)) - { - memmove(messages[i], dbInfo.pBlob, newSize); - FillIEViewInfo(&ieData[i], dbInfo, messages[i]); - } - //FillIEViewEventData(&ieData[i], dbEvent); - dbEvent = db_event_next(0,dbEvent); - } - ieData[cLoad - 1].next = NULL; //cLoad < LOAD_COUNT will only happen once, at the end - CallService(MS_IEVIEW_EVENT, 0, (LPARAM) &ieEvent); - count += cLoad; + while (count < target) { + cLoad = (count + LOAD_COUNT > target) ? target - count : LOAD_COUNT; + ieEvent.count = -1; + + for (i = 0; i < cLoad; i++) { + newSize = db_event_getBlobSize(dbEvent); + if (newSize > oldSize) { + buffer = (PBYTE)realloc(buffer, newSize); + dbInfo.pBlob = buffer; + oldSize = newSize; + } + messages[i] = (PBYTE)realloc(messages[i], newSize); + dbInfo.cbBlob = newSize; + if (!db_event_get(dbEvent, &dbInfo)) { + memmove(messages[i], dbInfo.pBlob, newSize); + FillIEViewInfo(&ieData[i], dbInfo, messages[i]); + } + //FillIEViewEventData(&ieData[i], dbEvent); + dbEvent = db_event_next(0, dbEvent); } + ieData[cLoad - 1].next = NULL; //cLoad < LOAD_COUNT will only happen once, at the end + CallService(MS_IEVIEW_EVENT, 0, (LPARAM)&ieEvent); + count += cLoad; + } for (i = 0; i < LOAD_COUNT; i++) - { - free(messages[i]); - } + free(messages[i]); + free(buffer); EnableWindow(GetDlgItem(data->hWnd, IDC_CLOSE), TRUE); free(data); @@ -224,42 +214,41 @@ DWORD WINAPI WorkerThread(LPVOID lpvData) int DoLoadEvents(HWND hWnd, HistoryWindowData *data, IEVIEWEVENT ieEvent) { ieEvent.iType = IEE_CLEAR_LOG; - CallService(MS_IEVIEW_EVENT, 0, (LPARAM) &ieEvent); - if (data->loadMethod == LOAD_IN_BACKGROUND) + CallService(MS_IEVIEW_EVENT, 0, (LPARAM)&ieEvent); + if (data->loadMethod == LOAD_IN_BACKGROUND) { + WorkerThreadData *threadData = (WorkerThreadData *)malloc(sizeof(WorkerThreadData)); + threadData->data = data; + threadData->hWnd = hWnd; + threadData->ieEvent = ieEvent; + WorkerThread(threadData); + /* + DWORD threadID; + HANDLE thread = CreateThread(NULL, 0, WorkerThread, threadData, 0, &threadID); + if (!thread) { - WorkerThreadData *threadData = (WorkerThreadData *) malloc(sizeof(WorkerThreadData)); - threadData->data = data; - threadData->hWnd = hWnd; - threadData->ieEvent = ieEvent; - WorkerThread(threadData); - /* - DWORD threadID; - HANDLE thread = CreateThread(NULL, 0, WorkerThread, threadData, 0, &threadID); - if (!thread) - { - MessageBox(hWnd, TranslateT("An error occured while trying to create the worker thread (%m)"), TranslateT("Error"), MB_OK | MB_ICONERROR); - } */ - } - else{ - ieEvent.iType = IEE_LOG_DB_EVENTS; - CallService(MS_IEVIEW_EVENT, 0, (LPARAM) &ieEvent); - ScrollToBottom(hWnd); - - TCHAR buffer[256]; - itot(data->index + 1, buffer, 10); - SendDlgItemMessage(hWnd, IDC_STATUSBAR, SB_SETTEXT, 0 | SBT_POPOUT, (LPARAM) buffer); - itot(data->index + ieEvent.count, buffer, 10); - SendDlgItemMessage(hWnd, IDC_STATUSBAR, SB_SETTEXT, 1 | SBT_POPOUT, (LPARAM) buffer); - itot(data->count, buffer, 10); - SendDlgItemMessage(hWnd, IDC_STATUSBAR, SB_SETTEXT, 3 | SBT_POPOUT, (LPARAM) buffer); - RefreshButtonStates(hWnd); - } + MessageBox(hWnd, TranslateT("An error occured while trying to create the worker thread (%m)"), TranslateT("Error"), MB_OK | MB_ICONERROR); + } */ + } + else { + ieEvent.iType = IEE_LOG_DB_EVENTS; + CallService(MS_IEVIEW_EVENT, 0, (LPARAM)&ieEvent); + ScrollToBottom(hWnd); + + TCHAR buffer[256]; + itot(data->index + 1, buffer, 10); + SendDlgItemMessage(hWnd, IDC_STATUSBAR, SB_SETTEXT, 0 | SBT_POPOUT, (LPARAM)buffer); + itot(data->index + ieEvent.count, buffer, 10); + SendDlgItemMessage(hWnd, IDC_STATUSBAR, SB_SETTEXT, 1 | SBT_POPOUT, (LPARAM)buffer); + itot(data->count, buffer, 10); + SendDlgItemMessage(hWnd, IDC_STATUSBAR, SB_SETTEXT, 3 | SBT_POPOUT, (LPARAM)buffer); + RefreshButtonStates(hWnd); + } return 0; } int LoadEvents(HWND hWnd) { - HistoryWindowData *data = (HistoryWindowData *) GetWindowLongPtr(hWnd, DWLP_USER); + HistoryWindowData *data = (HistoryWindowData *)GetWindowLongPtr(hWnd, DWLP_USER); int count = db_event_count(data->contact); int bLastFirst = db_get_b(NULL, ModuleName, "ShowLastPageFirst", 0); int bRTL = db_get_b(NULL, ModuleName, "EnableRTL", 0); @@ -267,74 +256,67 @@ int LoadEvents(HWND hWnd) data->bEnableRTL = bRTL; data->count = count; if (data->itemsPerPage > count) - { - data->itemsPerPage = count; - } - IEVIEWEVENT ieEvent = {sizeof(ieEvent)}; + data->itemsPerPage = count; + + IEVIEWEVENT ieEvent = { sizeof(ieEvent) }; ieEvent.hwnd = data->hIEView; ieEvent.hContact = data->contact; ieEvent.count = (data->itemsPerPage <= 0) ? count : data->itemsPerPage; - + HANDLE hFirstEvent = db_event_first(data->contact); int num = 0; - if ((data->itemsPerPage > 0) && (bLastFirst)) - { - num = data->count - data->itemsPerPage; - hFirstEvent = GetNeededEvent(hFirstEvent, num, DIRECTION_FORWARD); - } + if ((data->itemsPerPage > 0) && (bLastFirst)) { + num = data->count - data->itemsPerPage; + hFirstEvent = GetNeededEvent(hFirstEvent, num, DIRECTION_FORWARD); + } data->index = num; data->hLastFirstEvent = hFirstEvent; ieEvent.hDbEventFirst = hFirstEvent; if (data->bEnableRTL) - { - ieEvent.dwFlags |= IEEF_RTL; - } + ieEvent.dwFlags |= IEEF_RTL; + DoLoadEvents(hWnd, data, ieEvent); return 0; } int LoadPage(HWND hWnd, HANDLE hFirstEvent, long index, long shiftCount, long readCount, int direction) { - HistoryWindowData *data = (HistoryWindowData *) GetWindowLongPtr(hWnd, DWLP_USER); + HistoryWindowData *data = (HistoryWindowData *)GetWindowLongPtr(hWnd, DWLP_USER); int count = shiftCount; int newIndex = index; - IEVIEWEVENT ieEvent = {sizeof(ieEvent)}; + IEVIEWEVENT ieEvent = { sizeof(ieEvent) }; ieEvent.hwnd = data->hIEView; ieEvent.hContact = data->contact; - - if (direction == DIRECTION_BACK) - { - newIndex -= shiftCount; - if (newIndex < 0) - { - newIndex = 0; - count = index; - } + + if (direction == DIRECTION_BACK) { + newIndex -= shiftCount; + if (newIndex < 0) { + newIndex = 0; + count = index; } - else{ - newIndex += shiftCount; - if (newIndex + readCount > data->count) - { - count = data->count - newIndex; - newIndex = data->count - readCount; - } + } + else { + newIndex += shiftCount; + if (newIndex + readCount > data->count) { + count = data->count - newIndex; + newIndex = data->count - readCount; } + } data->index = newIndex; HANDLE hEvent = GetNeededEvent(hFirstEvent, count, direction); data->hLastFirstEvent = hEvent; ieEvent.hDbEventFirst = hEvent; ieEvent.count = readCount; if (data->bEnableRTL) - { - ieEvent.dwFlags |= IEEF_RTL; - } + ieEvent.dwFlags |= IEEF_RTL; + DoLoadEvents(hWnd, data, ieEvent); return 0; } int LoadPrev(HWND hWnd) { - HistoryWindowData *data = (HistoryWindowData *) GetWindowLongPtr(hWnd, DWLP_USER); + HistoryWindowData *data = (HistoryWindowData *)GetWindowLongPtr(hWnd, DWLP_USER); LoadPage(hWnd, data->hLastFirstEvent, data->index, data->itemsPerPage, data->itemsPerPage, DIRECTION_BACK); int finish = data->index <= 0; return finish; @@ -342,7 +324,7 @@ int LoadPrev(HWND hWnd) int LoadNext(HWND hWnd) { - HistoryWindowData *data = (HistoryWindowData *) GetWindowLongPtr(hWnd, DWLP_USER); + HistoryWindowData *data = (HistoryWindowData *)GetWindowLongPtr(hWnd, DWLP_USER); LoadPage(hWnd, data->hLastFirstEvent, data->index, data->itemsPerPage, data->itemsPerPage, DIRECTION_FORWARD); int finish = data->index + data->itemsPerPage >= data->count; return finish; @@ -350,13 +332,13 @@ int LoadNext(HWND hWnd) int ScrollToBottom(HWND hWnd) { - HistoryWindowData *data = (HistoryWindowData *) GetWindowLongPtr(hWnd, DWLP_USER); - IEVIEWWINDOW ieWnd = {0}; + HistoryWindowData *data = (HistoryWindowData *)GetWindowLongPtr(hWnd, DWLP_USER); + IEVIEWWINDOW ieWnd = { 0 }; ieWnd.cbSize = sizeof(ieWnd); ieWnd.iType = IEW_SCROLLBOTTOM; ieWnd.hwnd = data->hIEView; ieWnd.parent = hWnd; - CallService(MS_IEVIEW_WINDOW, 0, (LPARAM) &ieWnd); + CallService(MS_IEVIEW_WINDOW, 0, (LPARAM)&ieWnd); return 0; } @@ -368,7 +350,7 @@ void AddAnchorWindowToDeferList(HDWP &hdWnds, HWND window, RECT *rParent, WINDOW void RefreshButtonStates(HWND hWnd) { - HistoryWindowData *data = (HistoryWindowData *) GetWindowLongPtr(hWnd, DWLP_USER); + HistoryWindowData *data = (HistoryWindowData *)GetWindowLongPtr(hWnd, DWLP_USER); int bPrev = data->index > 0; int bNext = data->index + data->itemsPerPage < data->count; EnableWindow(GetDlgItem(hWnd, IDC_PREV), bPrev); @@ -379,415 +361,325 @@ void RefreshButtonStates(HWND hWnd) INT_PTR CALLBACK HistoryDlgProc(HWND hWnd, UINT msg, WPARAM wParam, LPARAM lParam) { - switch (msg) + HistoryWindowData *data = (HistoryWindowData *)GetWindowLongPtr(hWnd, DWLP_USER); + + switch (msg) { + case WM_INITDIALOG: + Log("Inside WM_INITDIALOG ..."); + TranslateDialogDefault(hWnd); + SendMessage(hWnd, WM_SETICON, ICON_BIG, (LPARAM)hIcon); { - case WM_INITDIALOG: - { - Log("Inside WM_INITDIALOG ..."); - TranslateDialogDefault(hWnd); - SendMessage(hWnd, WM_SETICON, ICON_BIG, (LPARAM) hIcon); - //SetWindowPos(hWnd, HWND_NOTOPMOST, 0, 0, 0, 0, SWP_NOMOVE | SWP_NOSIZE); - int bRTL = db_get_b(NULL, ModuleName, "EnableRTL", 0); - if (bRTL) - { - SetWindowLongPtr(hWnd, GWL_EXSTYLE, WS_EX_RTLREADING); - } - //InitCommonControls(); - HWND hStatusBar = CreateWindow(STATUSCLASSNAME, //class - _T("-"), //title - WS_CHILD | WS_VISIBLE | SBARS_TOOLTIPS | SBARS_SIZEGRIP, //style - 0, 0, //x, y - 0, 0, //width, height - hWnd, //parent - (HMENU) IDC_STATUSBAR, //menu - hInstance, //instance - NULL); //lpParam - int x; - int widths[] = {x = 50, x += 50, x += 150, -1}; - int count = sizeof(widths) / sizeof(widths[0]); - SendMessage(hStatusBar, SB_SETPARTS, count, (LPARAM) widths); - //SendMessage(hStatusBar, SB_SETTIPTEXT, 1, (LPARAM) TranslateT("First event shown in page")); - //SendMessage(hStatusBar, SB_SETTIPTEXT, 2, (LPARAM) TranslateT("Last event shown in page")); - SendMessage(hStatusBar, SB_SETTEXT, 2 | SBT_POPOUT, (LPARAM) TranslateT("Out of a total of")); - return TRUE; - } - case WM_SHOWWINDOW: - { - Log("Inside WM_SHOWWINDOW ..."); - LoadName(hWnd); - LoadIEView(hWnd); - LoadEvents(hWnd); - - HistoryWindowData *data = (HistoryWindowData *) GetWindowLongPtr(hWnd, DWLP_USER); - bool bAll = (data->itemsPerPage <= 0) || (data->itemsPerPage >= data->count); - int bLastFirst = db_get_b(NULL, ModuleName, "ShowLastPageFirst", 0); - if (!bLastFirst) - { - EnableWindow(GetDlgItem(hWnd, IDC_PREV), FALSE); - EnableWindow(GetDlgItem(hWnd, IDC_NEXT), !bAll); - } - else{ - EnableWindow(GetDlgItem(hWnd, IDC_PREV), !bAll); - EnableWindow(GetDlgItem(hWnd, IDC_NEXT), FALSE); - } - //ShowWindow(GetDlgItem(hWnd, IDC_PAGE_NUMBER), !bAll); - EnableWindow(GetDlgItem(hWnd, IDC_SEARCH), !bAll); - - break; - } - case WM_DESTROY: - { - HistoryWindowData *data = (HistoryWindowData *) GetWindowLongPtr(hWnd, DWLP_USER); - DestroyIEView(hWnd); - free(data); - WindowList_Remove(hOpenWindowsList, hWnd); - break; - } - case WM_CLOSE: - { - if (IsWindowEnabled(GetDlgItem(hWnd, IDC_CLOSE))) - { - DestroyWindow(hWnd); - } - else{ - MessageBox(hWnd, TranslateT("You can't close the window now, wait for all events to load."), TranslateT("Error"), MB_OK | MB_ICONERROR); - } - break; - } - case WM_WINDOWPOSCHANGING: - { - HDWP hdWnds = BeginDeferWindowPos(6); - RECT rParent; - HWND hStatusBar = GetDlgItem(hWnd, IDC_STATUSBAR); - WINDOWPOS *wndPos = (WINDOWPOS *) lParam; - GetWindowRect(hWnd, &rParent); - - //hdWnds = DeferWindowPos(hdWnds, hStatusBar, HWND_NOTOPMOST, wndPos->x, wndPos->y + wndPos->cy - statusHeight, statusWidth, statusHeight, SWP_NOZORDER); - SendMessage(hStatusBar, WM_SIZE, 0, 0); - if (wndPos->cx < MIN_HISTORY_WIDTH) - { - wndPos->cx = MIN_HISTORY_WIDTH; - } - if (wndPos->cy < MIN_HISTORY_HEIGHT) - { - wndPos->cy = MIN_HISTORY_HEIGHT; - } - //MoveWindow(hStatusBar, wndPos->x, wndPos->y + wndPos->cy - statusHeight - 2, statusWidth - 2, statusHeight, TRUE); - AddAnchorWindowToDeferList(hdWnds, GetDlgItem(hWnd, IDC_STATUSBAR), &rParent, wndPos, ANCHOR_BOTTOM); - AddAnchorWindowToDeferList(hdWnds, GetDlgItem(hWnd, IDC_CLOSE), &rParent, wndPos, ANCHOR_RIGHT | ANCHOR_BOTTOM); - AddAnchorWindowToDeferList(hdWnds, GetDlgItem(hWnd, IDC_IEVIEW_PLACEHOLDER), &rParent, wndPos, ANCHOR_ALL); - AddAnchorWindowToDeferList(hdWnds, GetDlgItem(hWnd, IDC_PREV), &rParent, wndPos, ANCHOR_LEFT | ANCHOR_BOTTOM); - AddAnchorWindowToDeferList(hdWnds, GetDlgItem(hWnd, IDC_NEXT), &rParent, wndPos, ANCHOR_LEFT | ANCHOR_BOTTOM); - //AddAnchorWindowToDeferList(hdWnds, GetDlgItem(hWnd, IDC_PAGE_NUMBER), &rParent, wndPos, ANCHOR_LEFT | ANCHOR_BOTTOM); - AddAnchorWindowToDeferList(hdWnds, GetDlgItem(hWnd, IDC_SEARCH), &rParent, wndPos, ANCHOR_RIGHT | ANCHOR_BOTTOM); - - EndDeferWindowPos(hdWnds); - MoveIeView(hWnd); - break; - } - case WM_COMMAND: - { - switch (LOWORD(wParam)) - { - case IDC_CLOSE: - { - SendMessage(hWnd, WM_CLOSE, 0, 0); - break; - } - case IDC_PREV: - { - int finished = LoadPrev(hWnd); - //EnableWindow(GetDlgItem(hWnd, IDC_PREV), !finished); - //EnableWindow(GetDlgItem(hWnd, IDC_NEXT), TRUE); - break; - } - case IDC_NEXT: - { - int finished = LoadNext(hWnd); - //EnableWindow(GetDlgItem(hWnd, IDC_NEXT), !finished); - //EnableWindow(GetDlgItem(hWnd, IDC_PREV), TRUE); - break; - } - case IDC_SEARCH: - { - HWND hSearch = CreateDialog(hInstance, MAKEINTRESOURCE(IDD_SEARCH), hWnd, SearchDlgProc); - if (hSearch == NULL) - { - char buffer[1024]; - sprintf(buffer, "Error #%d", GetLastError()); - MessageBoxA(0, buffer, "Error", MB_OK); - } - HistoryWindowData *data = (HistoryWindowData *) GetWindowLongPtr(hWnd, DWLP_USER); - SearchWindowData *searchData = (SearchWindowData *) malloc(sizeof(SearchWindowData)); - searchData->contact = data->contact; - searchData->hHistoryWindow = hWnd; - searchData->hLastFoundEvent = NULL; - searchData->index = 0; - SetWindowLongPtr(hSearch, DWLP_USER, (LONG_PTR)searchData); - ShowWindow(hSearch, SW_SHOW); - //sprintf(buffer, "Error #%d", GetLastError()); - //MessageBoxA(0, buffer, "Error", MB_OK); - break; - } - } - break; - } - default: - { - break; - } + int bRTL = db_get_b(NULL, ModuleName, "EnableRTL", 0); + if (bRTL) + SetWindowLongPtr(hWnd, GWL_EXSTYLE, WS_EX_RTLREADING); + + HWND hStatusBar = CreateWindow(STATUSCLASSNAME, //class + _T("-"), //title + WS_CHILD | WS_VISIBLE | SBARS_TOOLTIPS | SBARS_SIZEGRIP, //style + 0, 0, //x, y + 0, 0, //width, height + hWnd, //parent + (HMENU)IDC_STATUSBAR, //menu + hInstance, //instance + NULL); //lpParam + int x; + int widths[] = { x = 50, x += 50, x += 150, -1 }; + int count = sizeof(widths) / sizeof(widths[0]); + SendMessage(hStatusBar, SB_SETPARTS, count, (LPARAM)widths); + //SendMessage(hStatusBar, SB_SETTIPTEXT, 1, (LPARAM) TranslateT("First event shown in page")); + //SendMessage(hStatusBar, SB_SETTIPTEXT, 2, (LPARAM) TranslateT("Last event shown in page")); + SendMessage(hStatusBar, SB_SETTEXT, 2 | SBT_POPOUT, (LPARAM)TranslateT("Out of a total of")); } + return TRUE; + + case WM_SHOWWINDOW: + Log("Inside WM_SHOWWINDOW ..."); + LoadName(hWnd); + LoadIEView(hWnd); + LoadEvents(hWnd); + { + bool bAll = (data->itemsPerPage <= 0) || (data->itemsPerPage >= data->count); + int bLastFirst = db_get_b(NULL, ModuleName, "ShowLastPageFirst", 0); + if (!bLastFirst) { + EnableWindow(GetDlgItem(hWnd, IDC_PREV), FALSE); + EnableWindow(GetDlgItem(hWnd, IDC_NEXT), !bAll); + } + else { + EnableWindow(GetDlgItem(hWnd, IDC_PREV), !bAll); + EnableWindow(GetDlgItem(hWnd, IDC_NEXT), FALSE); + } + EnableWindow(GetDlgItem(hWnd, IDC_SEARCH), !bAll); + } + break; + + case WM_DESTROY: + DestroyIEView(hWnd); + free(data); + WindowList_Remove(hOpenWindowsList, hWnd); + break; + + case WM_CLOSE: + if (IsWindowEnabled(GetDlgItem(hWnd, IDC_CLOSE))) + DestroyWindow(hWnd); + else + MessageBox(hWnd, TranslateT("You can't close the window now, wait for all events to load."), TranslateT("Error"), MB_OK | MB_ICONERROR); + break; + + case WM_WINDOWPOSCHANGING: + { + HDWP hdWnds = BeginDeferWindowPos(6); + RECT rParent; + HWND hStatusBar = GetDlgItem(hWnd, IDC_STATUSBAR); + WINDOWPOS *wndPos = (WINDOWPOS *)lParam; + GetWindowRect(hWnd, &rParent); + + //hdWnds = DeferWindowPos(hdWnds, hStatusBar, HWND_NOTOPMOST, wndPos->x, wndPos->y + wndPos->cy - statusHeight, statusWidth, statusHeight, SWP_NOZORDER); + SendMessage(hStatusBar, WM_SIZE, 0, 0); + if (wndPos->cx < MIN_HISTORY_WIDTH) + wndPos->cx = MIN_HISTORY_WIDTH; + if (wndPos->cy < MIN_HISTORY_HEIGHT) + wndPos->cy = MIN_HISTORY_HEIGHT; + + //MoveWindow(hStatusBar, wndPos->x, wndPos->y + wndPos->cy - statusHeight - 2, statusWidth - 2, statusHeight, TRUE); + AddAnchorWindowToDeferList(hdWnds, GetDlgItem(hWnd, IDC_STATUSBAR), &rParent, wndPos, ANCHOR_BOTTOM); + AddAnchorWindowToDeferList(hdWnds, GetDlgItem(hWnd, IDC_CLOSE), &rParent, wndPos, ANCHOR_RIGHT | ANCHOR_BOTTOM); + AddAnchorWindowToDeferList(hdWnds, GetDlgItem(hWnd, IDC_IEVIEW_PLACEHOLDER), &rParent, wndPos, ANCHOR_ALL); + AddAnchorWindowToDeferList(hdWnds, GetDlgItem(hWnd, IDC_PREV), &rParent, wndPos, ANCHOR_LEFT | ANCHOR_BOTTOM); + AddAnchorWindowToDeferList(hdWnds, GetDlgItem(hWnd, IDC_NEXT), &rParent, wndPos, ANCHOR_LEFT | ANCHOR_BOTTOM); + //AddAnchorWindowToDeferList(hdWnds, GetDlgItem(hWnd, IDC_PAGE_NUMBER), &rParent, wndPos, ANCHOR_LEFT | ANCHOR_BOTTOM); + AddAnchorWindowToDeferList(hdWnds, GetDlgItem(hWnd, IDC_SEARCH), &rParent, wndPos, ANCHOR_RIGHT | ANCHOR_BOTTOM); + + EndDeferWindowPos(hdWnds); + MoveIeView(hWnd); + } + break; + + case WM_COMMAND: + switch (LOWORD(wParam)) { + case IDC_CLOSE: + SendMessage(hWnd, WM_CLOSE, 0, 0); + break; + + case IDC_PREV: + { + int finished = LoadPrev(hWnd); + //EnableWindow(GetDlgItem(hWnd, IDC_PREV), !finished); + //EnableWindow(GetDlgItem(hWnd, IDC_NEXT), TRUE); + break; + } + case IDC_NEXT: + { + int finished = LoadNext(hWnd); + //EnableWindow(GetDlgItem(hWnd, IDC_NEXT), !finished); + //EnableWindow(GetDlgItem(hWnd, IDC_PREV), TRUE); + break; + } + case IDC_SEARCH: + HWND hSearch = CreateDialog(hInstance, MAKEINTRESOURCE(IDD_SEARCH), hWnd, SearchDlgProc); + if (hSearch == NULL) { + char buffer[1024]; + sprintf(buffer, "Error #%d", GetLastError()); + MessageBoxA(0, buffer, "Error", MB_OK); + } + SearchWindowData *searchData = (SearchWindowData *)malloc(sizeof(SearchWindowData)); + searchData->contact = data->contact; + searchData->hHistoryWindow = hWnd; + searchData->hLastFoundEvent = NULL; + searchData->index = 0; + SetWindowLongPtr(hSearch, DWLP_USER, (LONG_PTR)searchData); + ShowWindow(hSearch, SW_SHOW); + break; + } + break; + } return 0; } -#include "prsht.h" //PSN_APPLY - INT_PTR CALLBACK OptionsDlgProc(HWND hWnd, UINT msg, WPARAM wParam, LPARAM lParam) { - switch (msg) + switch (msg) { + case WM_INITDIALOG: + TranslateDialogDefault(hWnd); { - case WM_INITDIALOG: - { - TranslateDialogDefault(hWnd); - int count = db_get_dw(NULL, ModuleName, "EventsToLoad", 0); - EnableWindow(GetDlgItem(hWnd, IDC_EVENTS_COUNT), count > 0); - EnableWindow(GetDlgItem(hWnd, IDC_SHOW_LAST_FIRST), count > 0); - - CheckDlgButton(hWnd, IDC_LOAD_ALL, count <= 0); - CheckDlgButton(hWnd, IDC_LOAD_NUMBER, count > 0); - CheckDlgButton(hWnd, IDC_ENABLE_RTL, (BOOL) db_get_b(NULL, ModuleName, "EnableRTL", 0)); - CheckDlgButton(hWnd, IDC_SHOW_LAST_FIRST, (BOOL) db_get_b(NULL, ModuleName, "ShowLastPageFirst", 0)); - CheckDlgButton(hWnd, IDC_LOAD_BACKGROUND, (BOOL) db_get_b(NULL, ModuleName, "UseWorkerThread", 0)); + int count = db_get_dw(NULL, ModuleName, "EventsToLoad", 0); + EnableWindow(GetDlgItem(hWnd, IDC_EVENTS_COUNT), count > 0); + EnableWindow(GetDlgItem(hWnd, IDC_SHOW_LAST_FIRST), count > 0); + + CheckDlgButton(hWnd, IDC_LOAD_ALL, count <= 0); + CheckDlgButton(hWnd, IDC_LOAD_NUMBER, count > 0); + CheckDlgButton(hWnd, IDC_ENABLE_RTL, (BOOL)db_get_b(NULL, ModuleName, "EnableRTL", 0)); + CheckDlgButton(hWnd, IDC_SHOW_LAST_FIRST, (BOOL)db_get_b(NULL, ModuleName, "ShowLastPageFirst", 0)); + CheckDlgButton(hWnd, IDC_LOAD_BACKGROUND, (BOOL)db_get_b(NULL, ModuleName, "UseWorkerThread", 0)); + + TCHAR buffer[40]; + _itot_s(count, buffer, 10); + SetWindowText(GetDlgItem(hWnd, IDC_EVENTS_COUNT), buffer); + } + break; + + case WM_COMMAND: + switch (LOWORD(wParam)) { + case IDC_LOAD_ALL: + EnableWindow(GetDlgItem(hWnd, IDC_EVENTS_COUNT), FALSE); + EnableWindow(GetDlgItem(hWnd, IDC_SHOW_LAST_FIRST), FALSE); + SendMessage(GetParent(hWnd), PSM_CHANGED, 0, 0); + break; + + case IDC_LOAD_NUMBER: + EnableWindow(GetDlgItem(hWnd, IDC_EVENTS_COUNT), TRUE); + EnableWindow(GetDlgItem(hWnd, IDC_SHOW_LAST_FIRST), TRUE); + SendMessage(GetParent(hWnd), PSM_CHANGED, 0, 0); + break; + + case IDC_ENABLE_RTL: + case IDC_SHOW_LAST_FIRST: + case IDC_EVENTS_COUNT: + case IDC_LOAD_BACKGROUND: + SendMessage(GetParent(hWnd), PSM_CHANGED, 0, 0); + break; + } + break; + + case WM_NOTIFY: + switch (((LPNMHDR)lParam)->idFrom) { + case 0: + switch (((LPNMHDR)lParam)->code) { + case PSN_APPLY: + long count; + if (IsDlgButtonChecked(hWnd, IDC_LOAD_ALL)) + count = 0; + else { TCHAR buffer[1024]; - itot(count, buffer, 10); - SetWindowText(GetDlgItem(hWnd, IDC_EVENTS_COUNT), buffer); - - break; - } - case WM_COMMAND: - { - switch (LOWORD(wParam)) - { - case IDC_LOAD_ALL: - { - EnableWindow(GetDlgItem(hWnd, IDC_EVENTS_COUNT), FALSE); - EnableWindow(GetDlgItem(hWnd, IDC_SHOW_LAST_FIRST), FALSE); - SendMessage(GetParent(hWnd), PSM_CHANGED, 0, 0); - break; - } - case IDC_LOAD_NUMBER: - { - EnableWindow(GetDlgItem(hWnd, IDC_EVENTS_COUNT), TRUE); - EnableWindow(GetDlgItem(hWnd, IDC_SHOW_LAST_FIRST), TRUE); - SendMessage(GetParent(hWnd), PSM_CHANGED, 0, 0); - break; - } - case IDC_ENABLE_RTL: - case IDC_SHOW_LAST_FIRST: - case IDC_EVENTS_COUNT: - case IDC_LOAD_BACKGROUND: - { - SendMessage(GetParent(hWnd), PSM_CHANGED, 0, 0); - break; - } - } - break; - } - case WM_NOTIFY: - { - switch(((LPNMHDR)lParam)->idFrom) - { - case 0: - { - switch (((LPNMHDR)lParam)->code) - { - case PSN_APPLY: - { - long count; - if (IsDlgButtonChecked(hWnd, IDC_LOAD_ALL)) - { - count = 0; - } - else{ - TCHAR buffer[1024]; - GetWindowText(GetDlgItem(hWnd, IDC_EVENTS_COUNT), buffer, sizeof(buffer)); - count = _tstol(buffer); - count = (count < 0) ? 0 : count; - } - db_set_b(NULL, ModuleName, "ShowLastPageFirst", IsDlgButtonChecked(hWnd, IDC_SHOW_LAST_FIRST)); - db_set_b(NULL, ModuleName, "EnableRTL", IsDlgButtonChecked(hWnd, IDC_ENABLE_RTL)); - db_set_b(NULL, ModuleName, "UseWorkerThread", IsDlgButtonChecked(hWnd, IDC_LOAD_BACKGROUND)); - db_set_dw(NULL, ModuleName, "EventsToLoad", count); - - break; - } - } - break; - } - } - break; - } - default: - { - break; + GetWindowText(GetDlgItem(hWnd, IDC_EVENTS_COUNT), buffer, sizeof(buffer)); + count = _tstol(buffer); + count = (count < 0) ? 0 : count; } + db_set_b(NULL, ModuleName, "ShowLastPageFirst", IsDlgButtonChecked(hWnd, IDC_SHOW_LAST_FIRST)); + db_set_b(NULL, ModuleName, "EnableRTL", IsDlgButtonChecked(hWnd, IDC_ENABLE_RTL)); + db_set_b(NULL, ModuleName, "UseWorkerThread", IsDlgButtonChecked(hWnd, IDC_LOAD_BACKGROUND)); + db_set_dw(NULL, ModuleName, "EventsToLoad", count); + } } + break; + } return 0; } - -#include "commctrl.h" //tab control - INT_PTR CALLBACK SearchDlgProc(HWND hWnd, UINT msg, WPARAM wParam, LPARAM lParam) { - switch (msg) + SearchWindowData *data = (SearchWindowData *)GetWindowLongPtr(hWnd, DWLP_USER); + + switch (msg) { + case WM_INITDIALOG: + if (MyEnableThemeDialogTexture) + MyEnableThemeDialogTexture((HWND)hWnd, ETDT_ENABLETAB); + + TranslateDialogDefault(hWnd); { - case WM_INITDIALOG: - { - if (MyEnableThemeDialogTexture) - { - MyEnableThemeDialogTexture((HWND) hWnd, ETDT_ENABLETAB); - } - TranslateDialogDefault(hWnd); - TCITEM tabItem = {0}; - tabItem.pszText = TranslateT("Text search"); - tabItem.mask = TCIF_TEXT; - //MessageBoxA(0, "Before TCM_INSERTITEM 1", "Error", MB_OK); - SendMessage(GetDlgItem(hWnd, IDC_TABS), TCM_INSERTITEM, 0, (LPARAM) &tabItem); - tabItem.pszText = TranslateT("Time search"); - //MessageBoxA(0, "Before TCM_INSERTITEM 2", "Error", MB_OK); - SendMessage(GetDlgItem(hWnd, IDC_TABS), TCM_INSERTITEM, 1, (LPARAM) &tabItem); - //SendMessage(GetDlgItem(hWnd, IDC_SEARCH_TIME), DTM_SETFORMAT, 0, (LPARAM) "HH:mm"); - //MessageBoxA(0, "Before CheckDlgButton", "Error", MB_OK); - CheckDlgButton(hWnd, IDC_DIRECTION_DOWN, TRUE); - return TRUE; - break; - } - case WM_SHOWWINDOW: - { - SetFocus(GetDlgItem(hWnd, IDC_SEARCH_TEXT)); - break; - } - case WM_DESTROY: - { - SearchWindowData *data = (SearchWindowData *) GetWindowLongPtr(hWnd, DWLP_USER); - free(data); - //DestroyWindow(hWnd); - break; - } - case WM_CLOSE: - { - DestroyWindow(hWnd); - break; - } - case WM_NOTIFY: - { - switch (((LPNMHDR) lParam)->idFrom) - { - case IDC_SEARCH_DATE: - case IDC_SEARCH_TIME: - { - SearchWindowData *data = (SearchWindowData *) GetWindowLongPtr(hWnd, DWLP_USER); - data->hLastFoundEvent = NULL; //start from top if changes occur - break; - } - case IDC_TABS: - { - switch (((LPNMHDR) lParam)->code) - { - case TCN_SELCHANGE: - { - int tab = SendMessage(GetDlgItem(hWnd, IDC_TABS), TCM_GETCURSEL, 0, 0); - ShowWindow(GetDlgItem(hWnd, IDC_SEARCH_DATE), (tab == 1) ? SW_SHOW : SW_HIDE); - ShowWindow(GetDlgItem(hWnd, IDC_SEARCH_TIME), (tab == 1) ? SW_SHOW : SW_HIDE); - ShowWindow(GetDlgItem(hWnd, IDC_SEARCH_TEXT), (tab == 0) ? SW_SHOW : SW_HIDE); - SendMessage(GetDlgItem(hWnd, IDC_SEARCH_TEXT_STATIC), WM_SETTEXT, 0, (LPARAM) ((tab == 0) ? _T("Text :") : _T("Time :"))); - break; - } - } - break; - } - } - break; - } - case WM_COMMAND: - { - switch (LOWORD(wParam)) - { - case IDC_SEARCH_TEXT: - { - switch (HIWORD(wParam)) - { - case EN_CHANGE: - { - SearchWindowData *data = (SearchWindowData *) GetWindowLongPtr(hWnd, DWLP_USER); - data->hLastFoundEvent = NULL; //start from top if changes occur - break; - } - } - break; - } - case IDCANCEL: - { - SendMessage(hWnd, WM_CLOSE, 0, 0); - break; - } - case IDC_FIND_NEXT: - { - SearchWindowData *data = (SearchWindowData *) GetWindowLongPtr(hWnd, DWLP_USER); - const HistoryWindowData *histData = (HistoryWindowData *) GetWindowLongPtr(data->hHistoryWindow, DWLP_USER); - int direction = IsDlgButtonChecked(hWnd, IDC_DIRECTION_UP) ? DIRECTION_BACK : DIRECTION_FORWARD; - int tab = SendMessage(GetDlgItem(hWnd, IDC_TABS), TCM_GETCURSEL, 0, 0); - int type = (tab == 0) ? SEARCH_TEXT : SEARCH_TIME; - SearchResult searchResult; - if (data->hLastFoundEvent == NULL) - { - data->index = (direction == DIRECTION_FORWARD) ? 0 : histData->count; - } - else{ - data->hLastFoundEvent = GetNeededEvent(data->hLastFoundEvent, 1, direction); - } - - if (type == SEARCH_TEXT) //text search - { - TCHAR text[2048]; //TODO buffer overrun - SendMessage(GetDlgItem(hWnd, IDC_SEARCH_TEXT), WM_GETTEXT, SIZEOF(text), (LPARAM) text); - searchResult = SearchHistory(data->contact, data->hLastFoundEvent, text, direction, type); - } - else{//time search - TimeSearchData tsData = {0}; - SYSTEMTIME date = {0}, time = {0}; - int res = SendMessage(GetDlgItem(hWnd, IDC_SEARCH_DATE), DTM_GETSYSTEMTIME, 0, (LPARAM) &date); - tsData.flags = (res == GDT_VALID) ? TSDF_DATE_SET : 0; - res = SendMessage(GetDlgItem(hWnd, IDC_SEARCH_TIME), DTM_GETSYSTEMTIME, 0, (LPARAM) &time); - if (res == GDT_VALID) - { - tsData.flags |= TSDF_TIME_SET; - date.wHour = time.wHour; - date.wMinute = time.wMinute; - date.wSecond = time.wSecond; - date.wMilliseconds = time.wMilliseconds; - } - tsData.time = date; - searchResult = SearchHistory(data->contact, data->hLastFoundEvent, &tsData, direction, type); - } - if (searchResult.hEvent) - { - //char buffer[1024]; - //sprintf(buffer, "Found it: index = %ld hEvent = %p", searchResult.index, searchResult.hEvent); - //MessageBox(0, buffer, "Yupppi", 0); - data->index += (direction == DIRECTION_BACK) ? -searchResult.index : searchResult.index; - LoadPage(data->hHistoryWindow, searchResult.hEvent, data->index, histData->itemsPerPage / 2, histData->itemsPerPage, DIRECTION_BACK); - } - else{ - MessageBox(0, TranslateT("Search finished. No more entries ..."), TranslateT("Information"), MB_OK | MB_ICONINFORMATION); - } - data->hLastFoundEvent = searchResult.hEvent; - break; - } - } - break; + TCITEM tabItem = { 0 }; + tabItem.pszText = TranslateT("Text search"); + tabItem.mask = TCIF_TEXT; + SendMessage(GetDlgItem(hWnd, IDC_TABS), TCM_INSERTITEM, 0, (LPARAM)&tabItem); + tabItem.pszText = TranslateT("Time search"); + SendMessage(GetDlgItem(hWnd, IDC_TABS), TCM_INSERTITEM, 1, (LPARAM)&tabItem); + } + + CheckDlgButton(hWnd, IDC_DIRECTION_DOWN, TRUE); + return TRUE; + + case WM_SHOWWINDOW: + SetFocus(GetDlgItem(hWnd, IDC_SEARCH_TEXT)); + break; + + case WM_DESTROY: + free(data); + break; + + case WM_CLOSE: + DestroyWindow(hWnd); + break; + + case WM_NOTIFY: + switch (((LPNMHDR)lParam)->idFrom) { + case IDC_SEARCH_DATE: + case IDC_SEARCH_TIME: + data->hLastFoundEvent = NULL; //start from top if changes occur + break; + + case IDC_TABS: + switch (((LPNMHDR)lParam)->code) { + case TCN_SELCHANGE: + int tab = SendMessage(GetDlgItem(hWnd, IDC_TABS), TCM_GETCURSEL, 0, 0); + ShowWindow(GetDlgItem(hWnd, IDC_SEARCH_DATE), (tab == 1) ? SW_SHOW : SW_HIDE); + ShowWindow(GetDlgItem(hWnd, IDC_SEARCH_TIME), (tab == 1) ? SW_SHOW : SW_HIDE); + ShowWindow(GetDlgItem(hWnd, IDC_SEARCH_TEXT), (tab == 0) ? SW_SHOW : SW_HIDE); + SendMessage(GetDlgItem(hWnd, IDC_SEARCH_TEXT_STATIC), WM_SETTEXT, 0, (LPARAM)((tab == 0) ? _T("Text :") : _T("Time :"))); + break; + } + break; + } + break; + + case WM_COMMAND: + switch (LOWORD(wParam)) { + case IDC_SEARCH_TEXT: + switch (HIWORD(wParam)) { + case EN_CHANGE: + data->hLastFoundEvent = NULL; //start from top if changes occur + break; + } + break; + + case IDCANCEL: + SendMessage(hWnd, WM_CLOSE, 0, 0); + break; + + case IDC_FIND_NEXT: + const HistoryWindowData *histData = (HistoryWindowData *)GetWindowLongPtr(data->hHistoryWindow, DWLP_USER); + int direction = IsDlgButtonChecked(hWnd, IDC_DIRECTION_UP) ? DIRECTION_BACK : DIRECTION_FORWARD; + int tab = SendMessage(GetDlgItem(hWnd, IDC_TABS), TCM_GETCURSEL, 0, 0); + int type = (tab == 0) ? SEARCH_TEXT : SEARCH_TIME; + SearchResult searchResult; + if (data->hLastFoundEvent == NULL) + data->index = (direction == DIRECTION_FORWARD) ? 0 : histData->count; + else + data->hLastFoundEvent = GetNeededEvent(data->hLastFoundEvent, 1, direction); + + if (type == SEARCH_TEXT) { //text search + TCHAR text[2048]; //TODO buffer overrun + SendMessage(GetDlgItem(hWnd, IDC_SEARCH_TEXT), WM_GETTEXT, SIZEOF(text), (LPARAM)text); + searchResult = SearchHistory(data->contact, data->hLastFoundEvent, text, direction, type); + } + else { //time search + TimeSearchData tsData = { 0 }; + SYSTEMTIME date = { 0 }, time = { 0 }; + int res = SendMessage(GetDlgItem(hWnd, IDC_SEARCH_DATE), DTM_GETSYSTEMTIME, 0, (LPARAM)&date); + tsData.flags = (res == GDT_VALID) ? TSDF_DATE_SET : 0; + res = SendMessage(GetDlgItem(hWnd, IDC_SEARCH_TIME), DTM_GETSYSTEMTIME, 0, (LPARAM)&time); + if (res == GDT_VALID) { + tsData.flags |= TSDF_TIME_SET; + date.wHour = time.wHour; + date.wMinute = time.wMinute; + date.wSecond = time.wSecond; + date.wMilliseconds = time.wMilliseconds; } + tsData.time = date; + searchResult = SearchHistory(data->contact, data->hLastFoundEvent, &tsData, direction, type); + } + + if (searchResult.hEvent) { + //char buffer[1024]; + //sprintf(buffer, "Found it: index = %ld hEvent = %p", searchResult.index, searchResult.hEvent); + //MessageBox(0, buffer, "Yupppi", 0); + data->index += (direction == DIRECTION_BACK) ? -searchResult.index : searchResult.index; + LoadPage(data->hHistoryWindow, searchResult.hEvent, data->index, histData->itemsPerPage / 2, histData->itemsPerPage, DIRECTION_BACK); + } + else MessageBox(0, TranslateT("Search finished. No more entries ..."), TranslateT("Information"), MB_OK | MB_ICONINFORMATION); + + data->hLastFoundEvent = searchResult.hEvent; + break; } + break; + } return 0; } diff --git a/plugins/IEHistory/src/dlgHandlers.h b/plugins/IEHistory/src/dlgHandlers.h index 990c9da3c0..f0696a0abc 100644 --- a/plugins/IEHistory/src/dlgHandlers.h +++ b/plugins/IEHistory/src/dlgHandlers.h @@ -21,7 +21,7 @@ Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. #ifndef M_HISTORY_DLG_HANDLERS_H #define M_HISTORY_DLG_HANDLERS_H -#include "commonheaders.h" +#include "stdafx.h" #define LOAD_IN_BACKGROUND 0x00000001 diff --git a/plugins/IEHistory/src/events.cpp b/plugins/IEHistory/src/events.cpp index 558be95924..2b73d127b1 100644 --- a/plugins/IEHistory/src/events.cpp +++ b/plugins/IEHistory/src/events.cpp @@ -18,6 +18,7 @@ along with this program; if not, write to the Free Software Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. */ +#include "stdafx.h" #include "events.h" HANDLE hModulesLoaded; diff --git a/plugins/IEHistory/src/events.h b/plugins/IEHistory/src/events.h index b19b14fced..8dee289795 100644 --- a/plugins/IEHistory/src/events.h +++ b/plugins/IEHistory/src/events.h @@ -21,7 +21,7 @@ Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. #ifndef M_HISTORY_HOOKED_EVENTS_H #define M_HISTORY_HOOKED_EVENTS_H -#include "commonheaders.h" +#include "stdafx.h" extern HANDLE hModulesLoaded; extern HANDLE hOptionsInitialize; diff --git a/plugins/IEHistory/src/services.cpp b/plugins/IEHistory/src/services.cpp index 75d16a6e1d..7a86e17d08 100644 --- a/plugins/IEHistory/src/services.cpp +++ b/plugins/IEHistory/src/services.cpp @@ -18,6 +18,7 @@ along with this program; if not, write to the Free Software Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. */ +#include "stdafx.h" #include "services.h" HANDLE hShowHistory; diff --git a/plugins/IEHistory/src/services.h b/plugins/IEHistory/src/services.h index 11d448ade9..f9d8492236 100644 --- a/plugins/IEHistory/src/services.h +++ b/plugins/IEHistory/src/services.h @@ -21,7 +21,7 @@ Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. #ifndef M_IEHISTORY_PROVIDED_SERVICES_H #define M_IEHISTORY_PROVIDED_SERVICES_H -#include "commonheaders.h" +#include "stdafx.h" #include "dlgHandlers.h" int InitServices(); diff --git a/plugins/IEHistory/src/stdafx.cpp b/plugins/IEHistory/src/stdafx.cpp index 2731c2b8c3..56f759b9d0 100644 --- a/plugins/IEHistory/src/stdafx.cpp +++ b/plugins/IEHistory/src/stdafx.cpp @@ -18,7 +18,6 @@ along with this program; if not, write to the Free Software Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. */ - #include "stdafx.h" // TODO: reference any additional headers you need in STDAFX.H diff --git a/plugins/IEHistory/src/stdafx.h b/plugins/IEHistory/src/stdafx.h index 30794ae02f..cb61a2c186 100644 --- a/plugins/IEHistory/src/stdafx.h +++ b/plugins/IEHistory/src/stdafx.h @@ -18,27 +18,76 @@ along with this program; if not, write to the Free Software Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. */ -#pragma once +#ifndef M_COMMON_HEADERS_H +#define M_COMMON_HEADERS_H -// Modify the following defines if you have to target a platform prior to the ones specified below. -// Refer to MSDN for the latest info on corresponding values for different platforms. -#ifndef WINVER // Allow use of features specific to Windows XP or later. -#define WINVER 0x0501 // Change this to the appropriate value to target other versions of Windows. -#endif +#define EVENTTYPE_STATUS 25368 //tabsrmm status events -#ifndef _WIN32_WINNT // Allow use of features specific to Windows XP or later. -#define _WIN32_WINNT 0x0501 // Change this to the appropriate value to target other versions of Windows. -#endif +#define WINVER 0x0501 +#define _WIN32_WINNT 0x0501 +#define _WIN32_WINDOWS 0x0410 +#define _WIN32_IE 0x0600 -#ifndef _WIN32_WINDOWS // Allow use of features specific to Windows 98 or later. -#define _WIN32_WINDOWS 0x0410 // Change this to the appropriate value to target Windows Me or later. -#endif +// Windows Header Files: +#define WIN32_LEAN_AND_MEAN +#include <windows.h> +#include <CommCtrl.h> +#include "prsht.h" + +#include <malloc.h> +#include <stdio.h> +#include <stdlib.h> +#include <uxtheme.h> + +#include <newpluginapi.h> +#include <m_database.h> +#include <m_utils.h> +#include <m_system.h> +#include <m_skin.h> +#include <m_options.h> +#include <m_clist.h> +#include <m_langpack.h> +#include <m_history.h> +#include <m_contacts.h> +#include <m_metacontacts.h> +#include <m_protocols.h> +#include <m_popup.h> +#include <m_ieview.h> + +#include "resource.h" +#include "version.h" -#ifndef _WIN32_IE // Allow use of features specific to IE 6.0 or later. -#define _WIN32_IE 0x0600 // Change this to the appropriate value to target other versions of IE. +#include "utils.h" +#include "events.h" +#include "dlgHandlers.h" + +static FILE* fopen_s2(const char* file,const char* mode){ + FILE* ret=NULL; fopen_s(&ret,file,mode); + return ret; +} +#define fopen fopen_s2 +#define strcat strcat_s +#define _vsnprintf _vsnprintf_s +#define snprintf _snprintf_s +#define snwprintf _snwprintf_s +#define sprintf sprintf_s +#define itow _itow_s +#ifndef _UNICODE +# define itot itoa +# define sntprintf snprintf +#else +# define itot itow +# define sntprintf snwprintf #endif -#define WIN32_LEAN_AND_MEAN // Exclude rarely-used stuff from Windows headers -// Windows Header Files: -#include <windows.h> +extern HICON hIcon; //history icon +extern int hLangpack; +extern char ModuleName[]; +extern HINSTANCE hInstance; //dll instance +extern HANDLE hOpenWindowsList; +extern PLUGININFOEX pluginInfo; + +extern BOOL (WINAPI *MyEnableThemeDialogTexture)(HANDLE, DWORD); + +#endif diff --git a/plugins/IEHistory/src/utils.cpp b/plugins/IEHistory/src/utils.cpp index 424ce76b6b..2b676f8235 100644 --- a/plugins/IEHistory/src/utils.cpp +++ b/plugins/IEHistory/src/utils.cpp @@ -18,7 +18,7 @@ along with this program; if not, write to the Free Software Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. */ -#include "commonheaders.h" +#include "stdafx.h" #ifdef _DEBUG int LogInit() diff --git a/plugins/IEHistory/src/utils.h b/plugins/IEHistory/src/utils.h index 7cad1a1116..2d7605b7b1 100644 --- a/plugins/IEHistory/src/utils.h +++ b/plugins/IEHistory/src/utils.h @@ -21,10 +21,6 @@ Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. #ifndef M_IEHISTORY_UTILS_H #define M_IEHISTORY_UTILS_H -#include "stdafx.h" -#include <time.h> -#include <m_core.h> - #define ANCHOR_LEFT 0x000001 #define ANCHOR_RIGHT 0x000002 #define ANCHOR_TOP 0x000004 |