diff options
Diffstat (limited to 'src/modules')
-rw-r--r-- | src/modules/clist/clcutils.cpp | 5 | ||||
-rw-r--r-- | src/modules/clist/genmenuopt.cpp | 7 | ||||
-rw-r--r-- | src/modules/database/profilemanager.cpp | 7 | ||||
-rw-r--r-- | src/modules/extraicons/options_ei.cpp | 6 | ||||
-rw-r--r-- | src/modules/options/options.cpp | 23 | ||||
-rw-r--r-- | src/modules/plugins/newplugins.cpp | 2 | ||||
-rw-r--r-- | src/modules/plugins/pluginopts.cpp | 6 | ||||
-rw-r--r-- | src/modules/protocols/protoopts.cpp | 15 | ||||
-rw-r--r-- | src/modules/skin/hotkey_opts.cpp | 14 | ||||
-rw-r--r-- | src/modules/skin/skin.h | 1 |
10 files changed, 30 insertions, 56 deletions
diff --git a/src/modules/clist/clcutils.cpp b/src/modules/clist/clcutils.cpp index fb5053bd00..b4873b9d03 100644 --- a/src/modules/clist/clcutils.cpp +++ b/src/modules/clist/clcutils.cpp @@ -457,7 +457,6 @@ void fnDeleteFromContactList(HWND hwnd, struct ClcData *dat) }
}
-static WNDPROC OldRenameEditWndProc;
static LRESULT CALLBACK RenameEditSubclassProc(HWND hwnd, UINT msg, WPARAM wParam, LPARAM lParam)
{
switch (msg) {
@@ -484,7 +483,7 @@ static LRESULT CALLBACK RenameEditSubclassProc(HWND hwnd, UINT msg, WPARAM wPara cli.pfnEndRename(GetParent(hwnd), (struct ClcData *) GetWindowLongPtr(GetParent(hwnd), 0), 1);
return 0;
}
- return CallWindowProc(OldRenameEditWndProc, hwnd, msg, wParam, lParam);
+ return mir_callNextSubclass(hwnd, RenameEditSubclassProc, msg, wParam, lParam);
}
void fnBeginRenameSelection(HWND hwnd, struct ClcData *dat)
@@ -507,7 +506,7 @@ void fnBeginRenameSelection(HWND hwnd, struct ClcData *dat) cli.pfnCalcEipPosition(dat, contact, group, &pt);
int h = cli.pfnGetRowHeight(dat, dat->selection);
dat->hwndRenameEdit = CreateWindow(_T("EDIT"), contact->szText, WS_CHILD | WS_BORDER | ES_AUTOHSCROLL, pt.x, pt.y, clRect.right - pt.x, h, hwnd, NULL, cli.hInst, NULL);
- OldRenameEditWndProc = (WNDPROC) SetWindowLongPtr(dat->hwndRenameEdit, GWLP_WNDPROC, (LONG_PTR) RenameEditSubclassProc);
+ mir_subclassWindow(dat->hwndRenameEdit, RenameEditSubclassProc);
SendMessage(dat->hwndRenameEdit, WM_SETFONT, (WPARAM) (contact->type == CLCIT_GROUP ? dat->fontInfo[FONTID_GROUPS].hFont : dat->fontInfo[FONTID_CONTACTS].hFont), 0);
SendMessage(dat->hwndRenameEdit, EM_SETMARGINS, EC_LEFTMARGIN | EC_RIGHTMARGIN | EC_USEFONTINFO, 0);
SendMessage(dat->hwndRenameEdit, EM_SETSEL, 0, (LPARAM) (-1));
diff --git a/src/modules/clist/genmenuopt.cpp b/src/modules/clist/genmenuopt.cpp index 6dd96a921b..3922e42533 100644 --- a/src/modules/clist/genmenuopt.cpp +++ b/src/modules/clist/genmenuopt.cpp @@ -382,8 +382,6 @@ static HTREEITEM MoveItemAbove(HWND hTreeWnd, HTREEITEM hItem, HTREEITEM hInsert return NULL;
}
-WNDPROC MyOldWindowProc = NULL;
-
LRESULT CALLBACK LBTNDOWNProc(HWND hwnd, UINT uMsg, WPARAM wParam, LPARAM lParam)
{
if (uMsg == WM_LBUTTONDOWN && !(GetKeyState(VK_CONTROL)&0x8000)) {
@@ -424,7 +422,7 @@ LRESULT CALLBACK LBTNDOWNProc(HWND hwnd, UINT uMsg, WPARAM wParam, LPARAM lParam }
}
- return CallWindowProc(MyOldWindowProc, hwnd, uMsg, wParam, lParam);
+ return mir_callNextSubclass(hwnd, LBTNDOWNProc, uMsg, wParam, lParam);
}
static INT_PTR CALLBACK GenMenuOpts(HWND hwndDlg, UINT msg, WPARAM wParam, LPARAM lParam)
@@ -439,8 +437,7 @@ static INT_PTR CALLBACK GenMenuOpts(HWND hwndDlg, UINT msg, WPARAM wParam, LPARA SetWindowLongPtr( GetDlgItem(hwndDlg, IDC_MENUITEMS), GWLP_USERDATA, (LONG_PTR)dat);
dat->dragging = 0;
dat->iInitMenuValue = db_get_b(NULL, "CList", "MoveProtoMenus", TRUE);
- MyOldWindowProc = (WNDPROC)GetWindowLongPtr( GetDlgItem(hwndDlg, IDC_MENUITEMS), GWLP_WNDPROC);
- SetWindowLongPtr( GetDlgItem(hwndDlg, IDC_MENUITEMS), GWLP_WNDPROC, (LONG_PTR)&LBTNDOWNProc);
+ mir_subclassWindow( GetDlgItem(hwndDlg, IDC_MENUITEMS), LBTNDOWNProc);
{
HIMAGELIST himlCheckBoxes;
himlCheckBoxes = ImageList_Create(GetSystemMetrics(SM_CXSMICON), GetSystemMetrics(SM_CYSMICON),
diff --git a/src/modules/database/profilemanager.cpp b/src/modules/database/profilemanager.cpp index d597d50a3f..67589a9d25 100644 --- a/src/modules/database/profilemanager.cpp +++ b/src/modules/database/profilemanager.cpp @@ -155,7 +155,7 @@ static LRESULT CALLBACK ProfileNameValidate(HWND edit, UINT msg, WPARAM wParam, return 0;
PostMessage(GetParent(edit), WM_INPUTCHANGED, 0, 0);
}
- return CallWindowProc((WNDPROC)GetWindowLongPtr(edit, GWLP_USERDATA), edit, msg, wParam, lParam);
+ return mir_callNextSubclass(edit, ProfileNameValidate, msg, wParam, lParam);
}
static INT_PTR CALLBACK DlgProfileNew(HWND hwndDlg, UINT msg, WPARAM wParam, LPARAM lParam)
@@ -187,10 +187,7 @@ static INT_PTR CALLBACK DlgProfileNew(HWND hwndDlg, UINT msg, WPARAM wParam, LPA SendMessage(hwndCombo, CB_SETCURSEL, 0, 0);
// subclass the profile name box
- HWND hwndProfile = GetDlgItem(hwndDlg, IDC_PROFILENAME);
- WNDPROC proc = (WNDPROC)GetWindowLongPtr(hwndProfile, GWLP_WNDPROC);
- SetWindowLongPtr(hwndProfile, GWLP_USERDATA, (LONG_PTR)proc);
- SetWindowLongPtr(hwndProfile, GWLP_WNDPROC, (LONG_PTR)ProfileNameValidate);
+ mir_subclassWindow(GetDlgItem(hwndDlg, IDC_PROFILENAME), ProfileNameValidate);
}
// decide if there is a default profile name given in the INI and if it should be used
diff --git a/src/modules/extraicons/options_ei.cpp b/src/modules/extraicons/options_ei.cpp index fc76ce5835..65866ae24b 100644 --- a/src/modules/extraicons/options_ei.cpp +++ b/src/modules/extraicons/options_ei.cpp @@ -67,8 +67,6 @@ static void RemoveExtraIcons(int slot) #define TVIS_FOCUSED 1
#endif
-WNDPROC origTreeProc;
-
static bool IsSelected(HWND tree, HTREEITEM hItem)
{
return (TVIS_SELECTED & TreeView_GetItemState(tree, hItem, TVIS_SELECTED)) == TVIS_SELECTED;
@@ -234,7 +232,7 @@ LRESULT CALLBACK TreeProc(HWND hwndDlg, UINT msg, WPARAM wParam, LPARAM lParam) }
}
- return CallWindowProc(origTreeProc, hwndDlg, msg, wParam, lParam);
+ return mir_callNextSubclass(hwndDlg, TreeProc, msg, wParam, lParam);
}
static vector<int> * Tree_GetIDs(HWND tree, HTREEITEM hItem)
@@ -468,7 +466,7 @@ static INT_PTR CALLBACK OptionsDlgProc(HWND hwndDlg, UINT msg, WPARAM wParam, LP sort.lpfnCompare = CompareFunc;
TreeView_SortChildrenCB(tree, &sort, 0);
- origTreeProc = (WNDPROC) SetWindowLongPtr(tree, GWLP_WNDPROC, (INT_PTR)TreeProc);
+ mir_subclassWindow(tree, TreeProc);
}
return TRUE;
diff --git a/src/modules/options/options.cpp b/src/modules/options/options.cpp index 952e30361a..e7fd848af1 100644 --- a/src/modules/options/options.cpp +++ b/src/modules/options/options.cpp @@ -252,15 +252,13 @@ static int MatchesFilter(const OptionsPageData *page, TCHAR *szFilterString) return ContainsFilterString(key, szFilterString);
}
-static WNDPROC OptionsFilterDefaultProc = NULL;
-
static LRESULT CALLBACK OptionsFilterSubclassProc(HWND hWnd, UINT message, WPARAM wParam, LPARAM lParam)
{
if (message != WM_PAINT && message != WM_PRINT)
- return CallWindowProc(OptionsFilterDefaultProc, hWnd, message, wParam, lParam);
+ return mir_callNextSubclass(hWnd, OptionsFilterSubclassProc, message, wParam, lParam);
if (GetFocus() == hWnd || GetWindowTextLength(hWnd))
- return CallWindowProc(OptionsFilterDefaultProc, hWnd, message, wParam, lParam);
+ return mir_callNextSubclass(hWnd, OptionsFilterSubclassProc, message, wParam, lParam);
RECT rc;
GetClientRect(hWnd, &rc);
@@ -386,7 +384,7 @@ static void AeroPaintControl(HWND hwnd, HDC hdc, WNDPROC OldWndProc, UINT msg = //paint
SetPropA(hwnd, "Miranda.AeroRender.Active", (HANDLE)TRUE);
- CallWindowProc(OldWndProc, hwnd, msg, (WPARAM)tempDC, lpFlags);
+ mir_callNextSubclass(hwnd, OldWndProc, msg, (WPARAM)tempDC, lpFlags);
SetPropA(hwnd, "Miranda.AeroRender.Active", (HANDLE)FALSE);
// Fix alpha channel
@@ -403,7 +401,6 @@ static void AeroPaintControl(HWND hwnd, HDC hdc, WNDPROC OldWndProc, UINT msg = static LRESULT CALLBACK AeroPaintSubclassProc(HWND hwnd, UINT msg, WPARAM wParam, LPARAM lParam)
{
- WNDPROC OldWndProc = (WNDPROC)GetWindowLongPtr(hwnd, GWLP_USERDATA);
switch (msg) {
case WM_CTLCOLOREDIT:
if ( !GetPropA((HWND)lParam, "Miranda.AeroRender.Active"))
@@ -415,14 +412,14 @@ static LRESULT CALLBACK AeroPaintSubclassProc(HWND hwnd, UINT msg, WPARAM wParam case WM_PRINT:
case WM_PRINTCLIENT:
- AeroPaintControl(hwnd, (HDC)wParam, OldWndProc, msg, lParam);
+ AeroPaintControl(hwnd, (HDC)wParam, AeroPaintSubclassProc, msg, lParam);
return TRUE;
case WM_PAINT:
{
PAINTSTRUCT ps;
HDC hdc = BeginPaint(hwnd, &ps);
- AeroPaintControl(hwnd, hdc, OldWndProc);
+ AeroPaintControl(hwnd, hdc, AeroPaintSubclassProc);
EndPaint(hwnd, &ps);
}
return TRUE;
@@ -431,7 +428,7 @@ static LRESULT CALLBACK AeroPaintSubclassProc(HWND hwnd, UINT msg, WPARAM wParam RemovePropA(hwnd, "Miranda.AeroRender.Active");
break;
}
- return CallWindowProc(OldWndProc, hwnd, msg, wParam, lParam);
+ return mir_callNextSubclass(hwnd, AeroPaintSubclassProc, msg, wParam, lParam);
}
static void CALLBACK FilterSearchTimerFunc(HWND hwnd, UINT, UINT_PTR, DWORD)
@@ -662,13 +659,11 @@ static INT_PTR CALLBACK OptionsDlgProc(HWND hdlg, UINT message, WPARAM wParam, L COMBOBOXINFO cbi;
cbi.cbSize = sizeof(COMBOBOXINFO);
getComboBoxInfo( GetDlgItem(hdlg, IDC_KEYWORD_FILTER), &cbi);
- OptionsFilterDefaultProc = (WNDPROC)SetWindowLongPtr(cbi.hwndItem, GWLP_WNDPROC, (LONG_PTR) OptionsFilterSubclassProc);
+ mir_subclassWindow(cbi.hwndItem, OptionsFilterSubclassProc);
if (IsAeroMode()) {
- SetWindowLongPtr(cbi.hwndCombo, GWLP_USERDATA, GetWindowLongPtr(cbi.hwndCombo, GWLP_WNDPROC));
- SetWindowLongPtr(cbi.hwndCombo, GWLP_WNDPROC, (LONG_PTR)AeroPaintSubclassProc);
- SetWindowLongPtr(cbi.hwndItem, GWLP_USERDATA, GetWindowLongPtr(cbi.hwndItem, GWLP_WNDPROC));
- SetWindowLongPtr(cbi.hwndItem, GWLP_WNDPROC, (LONG_PTR)AeroPaintSubclassProc);
+ mir_subclassWindow(cbi.hwndCombo, AeroPaintSubclassProc);
+ mir_subclassWindow(cbi.hwndItem, AeroPaintSubclassProc);
}
}
diff --git a/src/modules/plugins/newplugins.cpp b/src/modules/plugins/newplugins.cpp index b3c46d4482..90ea348e59 100644 --- a/src/modules/plugins/newplugins.cpp +++ b/src/modules/plugins/newplugins.cpp @@ -347,6 +347,8 @@ int Plugin_UnloadDyn(pluginEntry *p) if ( CallPluginEventHook(p->bpi.hInst, hOkToExitEvent, 0, 0) != 0)
return FALSE;
+ KillModuleSubclassing(p->bpi.hInst);
+
CallPluginEventHook(p->bpi.hInst, hPreShutdownEvent, 0, 0);
CallPluginEventHook(p->bpi.hInst, hShutdownEvent, 0, 0);
diff --git a/src/modules/plugins/pluginopts.cpp b/src/modules/plugins/pluginopts.cpp index 8448b255bb..12aa248e31 100644 --- a/src/modules/plugins/pluginopts.cpp +++ b/src/modules/plugins/pluginopts.cpp @@ -229,8 +229,7 @@ static LRESULT CALLBACK PluginListWndProc(HWND hwnd, UINT msg, WPARAM wParam, LP ListView_SetItem(hwnd, &lvi);
} } } } }
- WNDPROC wnProc = (WNDPROC)GetWindowLongPtr(hwnd, GWLP_USERDATA);
- return CallWindowProc(wnProc, hwnd, msg, wParam, lParam);
+ return mir_callNextSubclass(hwnd, PluginListWndProc, msg, wParam, lParam);
}
static int CALLBACK SortPlugins(WPARAM i1, LPARAM i2, LPARAM lParamSort)
@@ -254,8 +253,7 @@ INT_PTR CALLBACK DlgPluginOpt(HWND hwndDlg, UINT msg, WPARAM wParam, LPARAM lPar TranslateDialogDefault(hwndDlg);
{
HWND hwndList = GetDlgItem(hwndDlg, IDC_PLUGLIST);
- SetWindowLongPtr(hwndList, GWLP_USERDATA, (LONG_PTR)GetWindowLongPtr(hwndList, GWLP_WNDPROC));
- SetWindowLongPtr(hwndList, GWLP_WNDPROC, (LONG_PTR)PluginListWndProc);
+ mir_subclassWindow(hwndList, PluginListWndProc);
HIMAGELIST hIml = ImageList_Create(16, 16, ILC_MASK | (IsWinVerXPPlus()? ILC_COLOR32 : ILC_COLOR16), 4, 0);
ImageList_AddIcon_IconLibLoaded(hIml, SKINICON_OTHER_UNICODE);
diff --git a/src/modules/protocols/protoopts.cpp b/src/modules/protocols/protoopts.cpp index 7b128dcea7..4eec5c28b1 100644 --- a/src/modules/protocols/protoopts.cpp +++ b/src/modules/protocols/protoopts.cpp @@ -227,12 +227,9 @@ struct TAccMgrData struct TAccListData
{
- WNDPROC oldWndProc;
- int iItem;
+ int iItem;
RECT rcCheck;
-
HWND hwndEdit;
- WNDPROC oldEditProc;
};
static void sttClickButton(HWND hwndDlg, int idcButton)
@@ -272,7 +269,7 @@ static LRESULT CALLBACK sttEditSubclassProc(HWND hwnd, UINT msg, WPARAM wParam, DestroyWindow(hwnd);
return 0;
}
- return CallWindowProc((WNDPROC)GetWindowLongPtr(hwnd, GWLP_USERDATA), hwnd, msg, wParam, lParam);
+ return mir_callNextSubclass(hwnd, sttEditSubclassProc, msg, wParam, lParam);
}
static LRESULT CALLBACK AccListWndProc(HWND hwnd, UINT msg, WPARAM wParam, LPARAM lParam)
@@ -338,7 +335,7 @@ static LRESULT CALLBACK AccListWndProc(HWND hwnd, UINT msg, WPARAM wParam, LPARA ++rc.top; --rc.right;
dat->hwndEdit = CreateWindow(_T("EDIT"), pa->tszAccountName, WS_CHILD|WS_BORDER|ES_AUTOHSCROLL, rc.left, rc.top, rc.right-rc.left, rc.bottom-rc.top, hwnd, NULL, hInst, NULL);
- SetWindowLongPtr(dat->hwndEdit, GWLP_USERDATA, SetWindowLongPtr(dat->hwndEdit, GWLP_WNDPROC, (LONG_PTR)sttEditSubclassProc));
+ mir_subclassWindow(dat->hwndEdit, sttEditSubclassProc);
SendMessage(dat->hwndEdit, WM_SETFONT, (WPARAM)parentDat->hfntTitle, 0);
SendMessage(dat->hwndEdit, EM_SETMARGINS, EC_LEFTMARGIN|EC_RIGHTMARGIN|EC_USEFONTINFO, 0);
SendMessage(dat->hwndEdit, EM_SETSEL, 0, (LPARAM) (-1));
@@ -371,7 +368,7 @@ static LRESULT CALLBACK AccListWndProc(HWND hwnd, UINT msg, WPARAM wParam, LPARA break;
}
- return CallWindowProc(dat->oldWndProc, hwnd, msg, wParam, lParam);
+ return mir_callNextSubclass(hwnd, AccListWndProc, msg, wParam, lParam);
}
static void sttSubclassAccList(HWND hwnd, BOOL subclass)
@@ -379,13 +376,11 @@ static void sttSubclassAccList(HWND hwnd, BOOL subclass) if (subclass) {
struct TAccListData *dat = (struct TAccListData *)mir_alloc(sizeof(struct TAccListData));
dat->iItem = -1;
- dat->oldWndProc = (WNDPROC)GetWindowLongPtr(hwnd, GWLP_WNDPROC);
SetWindowLongPtr(hwnd, GWLP_USERDATA, (LONG_PTR)dat);
- SetWindowLongPtr(hwnd, GWLP_WNDPROC, (LONG_PTR)AccListWndProc);
+ mir_subclassWindow(hwnd, AccListWndProc);
}
else {
struct TAccListData *dat = (struct TAccListData *)GetWindowLongPtr(hwnd, GWLP_USERDATA);
- SetWindowLongPtr(hwnd, GWLP_WNDPROC, (LONG_PTR)dat->oldWndProc);
SetWindowLongPtr(hwnd, GWLP_USERDATA, 0);
mir_free(dat);
}
diff --git a/src/modules/skin/hotkey_opts.cpp b/src/modules/skin/hotkey_opts.cpp index b2159e5032..ed6a4bd40b 100644 --- a/src/modules/skin/hotkey_opts.cpp +++ b/src/modules/skin/hotkey_opts.cpp @@ -142,29 +142,23 @@ static LRESULT CALLBACK sttHotkeyEditProc(HWND hwnd, UINT msg, WPARAM wParam, LP return TRUE;
case WM_DESTROY:
- {
- WNDPROC saveOldWndProc = data->oldWndProc;
- SetWindowLongPtr(hwnd, GWLP_WNDPROC, (LONG_PTR)data->oldWndProc);
- SetWindowLongPtr(hwnd, GWLP_USERDATA, 0);
- mir_free(data);
- return CallWindowProc(saveOldWndProc, hwnd, msg, wParam, lParam);
- }
+ SetWindowLongPtr(hwnd, GWLP_USERDATA, 0);
+ mir_free(data);
}
- return CallWindowProc(data->oldWndProc, hwnd, msg, wParam, lParam);
+ return mir_callNextSubclass(hwnd, sttHotkeyEditProc, msg, wParam, lParam);
}
void HotkeyEditCreate(HWND hwnd)
{
THotkeyBoxData *data = (THotkeyBoxData *)mir_alloc(sizeof(THotkeyBoxData));
SetWindowLongPtr(hwnd, GWLP_USERDATA, (ULONG_PTR)data);
- data->oldWndProc = (WNDPROC)SetWindowLongPtr(hwnd, GWLP_WNDPROC, (ULONG_PTR)sttHotkeyEditProc);
+ mir_subclassWindow(hwnd, sttHotkeyEditProc);
}
void HotkeyEditDestroy(HWND hwnd)
{
THotkeyBoxData *data = (THotkeyBoxData *)GetWindowLongPtr(hwnd, GWLP_USERDATA);
- SetWindowLongPtr(hwnd, GWLP_WNDPROC, (ULONG_PTR)data->oldWndProc);
SetWindowLongPtr(hwnd, GWLP_USERDATA, 0);
mir_free(data);
}
diff --git a/src/modules/skin/skin.h b/src/modules/skin/skin.h index 3dbbb3a7c5..b36472a0dd 100644 --- a/src/modules/skin/skin.h +++ b/src/modules/skin/skin.h @@ -29,7 +29,6 @@ typedef enum { HKT_GLOBAL, HKT_LOCAL, HKT_MANUAL, HKT_COUNT } THotkeyType; struct THotkeyBoxData
{
- WNDPROC oldWndProc;
BYTE shift;
BYTE key;
};
|