comctl32: Don't use additional heap allocated pointer to old window procedure.
This commit is contained in:
parent
ecf89c7e3d
commit
a4b5c5db1c
@ -121,14 +121,9 @@ static const struct message test_dtm_set_and_get_system_time_seq[] = {
|
|||||||
{ 0 }
|
{ 0 }
|
||||||
};
|
};
|
||||||
|
|
||||||
struct subclass_info
|
|
||||||
{
|
|
||||||
WNDPROC oldproc;
|
|
||||||
};
|
|
||||||
|
|
||||||
static LRESULT WINAPI datetime_subclass_proc(HWND hwnd, UINT message, WPARAM wParam, LPARAM lParam)
|
static LRESULT WINAPI datetime_subclass_proc(HWND hwnd, UINT message, WPARAM wParam, LPARAM lParam)
|
||||||
{
|
{
|
||||||
struct subclass_info *info = (struct subclass_info *)GetWindowLongPtrA(hwnd, GWLP_USERDATA);
|
WNDPROC oldproc = (WNDPROC)GetWindowLongPtrA(hwnd, GWLP_USERDATA);
|
||||||
static LONG defwndproc_counter = 0;
|
static LONG defwndproc_counter = 0;
|
||||||
LRESULT ret;
|
LRESULT ret;
|
||||||
struct message msg;
|
struct message msg;
|
||||||
@ -143,7 +138,7 @@ static LRESULT WINAPI datetime_subclass_proc(HWND hwnd, UINT message, WPARAM wPa
|
|||||||
add_message(sequences, DATETIME_SEQ_INDEX, &msg);
|
add_message(sequences, DATETIME_SEQ_INDEX, &msg);
|
||||||
|
|
||||||
defwndproc_counter++;
|
defwndproc_counter++;
|
||||||
ret = CallWindowProcA(info->oldproc, hwnd, message, wParam, lParam);
|
ret = CallWindowProcA(oldproc, hwnd, message, wParam, lParam);
|
||||||
defwndproc_counter--;
|
defwndproc_counter--;
|
||||||
|
|
||||||
return ret;
|
return ret;
|
||||||
@ -151,13 +146,9 @@ static LRESULT WINAPI datetime_subclass_proc(HWND hwnd, UINT message, WPARAM wPa
|
|||||||
|
|
||||||
static HWND create_datetime_control(DWORD style)
|
static HWND create_datetime_control(DWORD style)
|
||||||
{
|
{
|
||||||
struct subclass_info *info;
|
WNDPROC oldproc;
|
||||||
HWND hWndDateTime = NULL;
|
HWND hWndDateTime = NULL;
|
||||||
|
|
||||||
info = HeapAlloc(GetProcessHeap(), 0, sizeof(struct subclass_info));
|
|
||||||
if (!info)
|
|
||||||
return NULL;
|
|
||||||
|
|
||||||
hWndDateTime = CreateWindowEx(0,
|
hWndDateTime = CreateWindowEx(0,
|
||||||
DATETIMEPICK_CLASS,
|
DATETIMEPICK_CLASS,
|
||||||
NULL,
|
NULL,
|
||||||
@ -168,14 +159,11 @@ static HWND create_datetime_control(DWORD style)
|
|||||||
NULL,
|
NULL,
|
||||||
NULL);
|
NULL);
|
||||||
|
|
||||||
if (!hWndDateTime) {
|
if (!hWndDateTime) return NULL;
|
||||||
HeapFree(GetProcessHeap(), 0, info);
|
|
||||||
return NULL;
|
|
||||||
}
|
|
||||||
|
|
||||||
info->oldproc = (WNDPROC)SetWindowLongPtrA(hWndDateTime, GWLP_WNDPROC,
|
oldproc = (WNDPROC)SetWindowLongPtrA(hWndDateTime, GWLP_WNDPROC,
|
||||||
(LONG_PTR)datetime_subclass_proc);
|
(LONG_PTR)datetime_subclass_proc);
|
||||||
SetWindowLongPtrA(hWndDateTime, GWLP_USERDATA, (LONG_PTR)info);
|
SetWindowLongPtrA(hWndDateTime, GWLP_USERDATA, (LONG_PTR)oldproc);
|
||||||
|
|
||||||
return hWndDateTime;
|
return hWndDateTime;
|
||||||
}
|
}
|
||||||
|
@ -396,14 +396,9 @@ static WCHAR pszUniTestW[] = {'T','S','T',0};
|
|||||||
ok(res == i, "Got Item Count as %d\n", res);\
|
ok(res == i, "Got Item Count as %d\n", res);\
|
||||||
}
|
}
|
||||||
|
|
||||||
struct subclass_info
|
|
||||||
{
|
|
||||||
WNDPROC oldproc;
|
|
||||||
};
|
|
||||||
|
|
||||||
static LRESULT WINAPI header_subclass_proc(HWND hwnd, UINT message, WPARAM wParam, LPARAM lParam)
|
static LRESULT WINAPI header_subclass_proc(HWND hwnd, UINT message, WPARAM wParam, LPARAM lParam)
|
||||||
{
|
{
|
||||||
struct subclass_info *info = (struct subclass_info *)GetWindowLongPtrA(hwnd, GWLP_USERDATA);
|
WNDPROC oldproc = (WNDPROC)GetWindowLongPtrA(hwnd, GWLP_USERDATA);
|
||||||
static LONG defwndproc_counter = 0;
|
static LONG defwndproc_counter = 0;
|
||||||
LRESULT ret;
|
LRESULT ret;
|
||||||
struct message msg;
|
struct message msg;
|
||||||
@ -417,7 +412,7 @@ static LRESULT WINAPI header_subclass_proc(HWND hwnd, UINT message, WPARAM wPara
|
|||||||
add_message(sequences, HEADER_SEQ_INDEX, &msg);
|
add_message(sequences, HEADER_SEQ_INDEX, &msg);
|
||||||
|
|
||||||
defwndproc_counter++;
|
defwndproc_counter++;
|
||||||
ret = CallWindowProcA(info->oldproc, hwnd, message, wParam, lParam);
|
ret = CallWindowProcA(oldproc, hwnd, message, wParam, lParam);
|
||||||
defwndproc_counter--;
|
defwndproc_counter--;
|
||||||
|
|
||||||
return ret;
|
return ret;
|
||||||
@ -487,7 +482,7 @@ static HWND create_custom_parent_window(void)
|
|||||||
|
|
||||||
static HWND create_custom_header_control(HWND hParent, BOOL preloadHeaderItems)
|
static HWND create_custom_header_control(HWND hParent, BOOL preloadHeaderItems)
|
||||||
{
|
{
|
||||||
struct subclass_info *info;
|
WNDPROC oldproc;
|
||||||
HWND childHandle;
|
HWND childHandle;
|
||||||
HDLAYOUT hlayout;
|
HDLAYOUT hlayout;
|
||||||
RECT rectwin;
|
RECT rectwin;
|
||||||
@ -505,9 +500,6 @@ static HWND create_custom_header_control(HWND hParent, BOOL preloadHeaderItems)
|
|||||||
|
|
||||||
|
|
||||||
flush_sequences(sequences, NUM_MSG_SEQUENCES);
|
flush_sequences(sequences, NUM_MSG_SEQUENCES);
|
||||||
info = HeapAlloc(GetProcessHeap(), 0, sizeof(struct subclass_info));
|
|
||||||
if (!info)
|
|
||||||
return NULL;
|
|
||||||
|
|
||||||
childHandle = CreateWindowEx(0, WC_HEADER, NULL,
|
childHandle = CreateWindowEx(0, WC_HEADER, NULL,
|
||||||
WS_CHILD|WS_BORDER|WS_VISIBLE|HDS_BUTTONS|HDS_HORZ,
|
WS_CHILD|WS_BORDER|WS_VISIBLE|HDS_BUTTONS|HDS_HORZ,
|
||||||
@ -534,9 +526,9 @@ static HWND create_custom_header_control(HWND hParent, BOOL preloadHeaderItems)
|
|||||||
SetWindowPos(childHandle, winpos.hwndInsertAfter, winpos.x, winpos.y,
|
SetWindowPos(childHandle, winpos.hwndInsertAfter, winpos.x, winpos.y,
|
||||||
winpos.cx, winpos.cy, 0);
|
winpos.cx, winpos.cy, 0);
|
||||||
|
|
||||||
info->oldproc = (WNDPROC)SetWindowLongPtrA(childHandle, GWLP_WNDPROC,
|
oldproc = (WNDPROC)SetWindowLongPtrA(childHandle, GWLP_WNDPROC,
|
||||||
(LONG_PTR)header_subclass_proc);
|
(LONG_PTR)header_subclass_proc);
|
||||||
SetWindowLongPtrA(childHandle, GWLP_USERDATA, (LONG_PTR)info);
|
SetWindowLongPtrA(childHandle, GWLP_USERDATA, (LONG_PTR)oldproc);
|
||||||
return childHandle;
|
return childHandle;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -271,11 +271,6 @@ static const struct message lvs_ex_transparentbkgnd_seq[] = {
|
|||||||
{ 0 }
|
{ 0 }
|
||||||
};
|
};
|
||||||
|
|
||||||
struct subclass_info
|
|
||||||
{
|
|
||||||
WNDPROC oldproc;
|
|
||||||
};
|
|
||||||
|
|
||||||
static LRESULT WINAPI parent_wnd_proc(HWND hwnd, UINT message, WPARAM wParam, LPARAM lParam)
|
static LRESULT WINAPI parent_wnd_proc(HWND hwnd, UINT message, WPARAM wParam, LPARAM lParam)
|
||||||
{
|
{
|
||||||
static LONG defwndproc_counter = 0;
|
static LONG defwndproc_counter = 0;
|
||||||
@ -421,7 +416,7 @@ static HWND create_parent_window(BOOL Unicode)
|
|||||||
|
|
||||||
static LRESULT WINAPI listview_subclass_proc(HWND hwnd, UINT message, WPARAM wParam, LPARAM lParam)
|
static LRESULT WINAPI listview_subclass_proc(HWND hwnd, UINT message, WPARAM wParam, LPARAM lParam)
|
||||||
{
|
{
|
||||||
struct subclass_info *info = (struct subclass_info *)GetWindowLongPtrA(hwnd, GWLP_USERDATA);
|
WNDPROC oldproc = (WNDPROC)GetWindowLongPtrA(hwnd, GWLP_USERDATA);
|
||||||
static LONG defwndproc_counter = 0;
|
static LONG defwndproc_counter = 0;
|
||||||
LRESULT ret;
|
LRESULT ret;
|
||||||
struct message msg;
|
struct message msg;
|
||||||
@ -445,21 +440,17 @@ static LRESULT WINAPI listview_subclass_proc(HWND hwnd, UINT message, WPARAM wPa
|
|||||||
add_message(sequences, LISTVIEW_SEQ_INDEX, &msg);
|
add_message(sequences, LISTVIEW_SEQ_INDEX, &msg);
|
||||||
|
|
||||||
defwndproc_counter++;
|
defwndproc_counter++;
|
||||||
ret = CallWindowProcA(info->oldproc, hwnd, message, wParam, lParam);
|
ret = CallWindowProcA(oldproc, hwnd, message, wParam, lParam);
|
||||||
defwndproc_counter--;
|
defwndproc_counter--;
|
||||||
return ret;
|
return ret;
|
||||||
}
|
}
|
||||||
|
|
||||||
static HWND create_listview_control(DWORD style)
|
static HWND create_listview_control(DWORD style)
|
||||||
{
|
{
|
||||||
struct subclass_info *info;
|
WNDPROC oldproc;
|
||||||
HWND hwnd;
|
HWND hwnd;
|
||||||
RECT rect;
|
RECT rect;
|
||||||
|
|
||||||
info = HeapAlloc(GetProcessHeap(), 0, sizeof(struct subclass_info));
|
|
||||||
if (!info)
|
|
||||||
return NULL;
|
|
||||||
|
|
||||||
GetClientRect(hwndparent, &rect);
|
GetClientRect(hwndparent, &rect);
|
||||||
hwnd = CreateWindowExA(0, WC_LISTVIEW, "foo",
|
hwnd = CreateWindowExA(0, WC_LISTVIEW, "foo",
|
||||||
WS_CHILD | WS_BORDER | WS_VISIBLE | LVS_REPORT | style,
|
WS_CHILD | WS_BORDER | WS_VISIBLE | LVS_REPORT | style,
|
||||||
@ -467,15 +458,11 @@ static HWND create_listview_control(DWORD style)
|
|||||||
hwndparent, NULL, GetModuleHandleA(NULL), NULL);
|
hwndparent, NULL, GetModuleHandleA(NULL), NULL);
|
||||||
ok(hwnd != NULL, "gle=%d\n", GetLastError());
|
ok(hwnd != NULL, "gle=%d\n", GetLastError());
|
||||||
|
|
||||||
if (!hwnd)
|
if (!hwnd) return NULL;
|
||||||
{
|
|
||||||
HeapFree(GetProcessHeap(), 0, info);
|
|
||||||
return NULL;
|
|
||||||
}
|
|
||||||
|
|
||||||
info->oldproc = (WNDPROC)SetWindowLongPtrA(hwnd, GWLP_WNDPROC,
|
oldproc = (WNDPROC)SetWindowLongPtrA(hwnd, GWLP_WNDPROC,
|
||||||
(LONG_PTR)listview_subclass_proc);
|
(LONG_PTR)listview_subclass_proc);
|
||||||
SetWindowLongPtrA(hwnd, GWLP_USERDATA, (LONG_PTR)info);
|
SetWindowLongPtrA(hwnd, GWLP_USERDATA, (LONG_PTR)oldproc);
|
||||||
|
|
||||||
return hwnd;
|
return hwnd;
|
||||||
}
|
}
|
||||||
@ -483,15 +470,11 @@ static HWND create_listview_control(DWORD style)
|
|||||||
/* unicode listview window with specified parent */
|
/* unicode listview window with specified parent */
|
||||||
static HWND create_listview_controlW(DWORD style, HWND parent)
|
static HWND create_listview_controlW(DWORD style, HWND parent)
|
||||||
{
|
{
|
||||||
struct subclass_info *info;
|
WNDPROC oldproc;
|
||||||
HWND hwnd;
|
HWND hwnd;
|
||||||
RECT rect;
|
RECT rect;
|
||||||
static const WCHAR nameW[] = {'f','o','o',0};
|
static const WCHAR nameW[] = {'f','o','o',0};
|
||||||
|
|
||||||
info = HeapAlloc(GetProcessHeap(), 0, sizeof(struct subclass_info));
|
|
||||||
if (!info)
|
|
||||||
return NULL;
|
|
||||||
|
|
||||||
GetClientRect(parent, &rect);
|
GetClientRect(parent, &rect);
|
||||||
hwnd = CreateWindowExW(0, WC_LISTVIEWW, nameW,
|
hwnd = CreateWindowExW(0, WC_LISTVIEWW, nameW,
|
||||||
WS_CHILD | WS_BORDER | WS_VISIBLE | LVS_REPORT | style,
|
WS_CHILD | WS_BORDER | WS_VISIBLE | LVS_REPORT | style,
|
||||||
@ -499,29 +482,21 @@ static HWND create_listview_controlW(DWORD style, HWND parent)
|
|||||||
parent, NULL, GetModuleHandleW(NULL), NULL);
|
parent, NULL, GetModuleHandleW(NULL), NULL);
|
||||||
ok(hwnd != NULL, "gle=%d\n", GetLastError());
|
ok(hwnd != NULL, "gle=%d\n", GetLastError());
|
||||||
|
|
||||||
if (!hwnd)
|
if (!hwnd) return NULL;
|
||||||
{
|
|
||||||
HeapFree(GetProcessHeap(), 0, info);
|
|
||||||
return NULL;
|
|
||||||
}
|
|
||||||
|
|
||||||
info->oldproc = (WNDPROC)SetWindowLongPtrW(hwnd, GWLP_WNDPROC,
|
oldproc = (WNDPROC)SetWindowLongPtrW(hwnd, GWLP_WNDPROC,
|
||||||
(LONG_PTR)listview_subclass_proc);
|
(LONG_PTR)listview_subclass_proc);
|
||||||
SetWindowLongPtrW(hwnd, GWLP_USERDATA, (LONG_PTR)info);
|
SetWindowLongPtrW(hwnd, GWLP_USERDATA, (LONG_PTR)oldproc);
|
||||||
|
|
||||||
return hwnd;
|
return hwnd;
|
||||||
}
|
}
|
||||||
|
|
||||||
static HWND create_custom_listview_control(DWORD style)
|
static HWND create_custom_listview_control(DWORD style)
|
||||||
{
|
{
|
||||||
struct subclass_info *info;
|
WNDPROC oldproc;
|
||||||
HWND hwnd;
|
HWND hwnd;
|
||||||
RECT rect;
|
RECT rect;
|
||||||
|
|
||||||
info = HeapAlloc(GetProcessHeap(), 0, sizeof(struct subclass_info));
|
|
||||||
if (!info)
|
|
||||||
return NULL;
|
|
||||||
|
|
||||||
GetClientRect(hwndparent, &rect);
|
GetClientRect(hwndparent, &rect);
|
||||||
hwnd = CreateWindowExA(0, WC_LISTVIEW, "foo",
|
hwnd = CreateWindowExA(0, WC_LISTVIEW, "foo",
|
||||||
WS_CHILD | WS_BORDER | WS_VISIBLE | style,
|
WS_CHILD | WS_BORDER | WS_VISIBLE | style,
|
||||||
@ -529,22 +504,18 @@ static HWND create_custom_listview_control(DWORD style)
|
|||||||
hwndparent, NULL, GetModuleHandleA(NULL), NULL);
|
hwndparent, NULL, GetModuleHandleA(NULL), NULL);
|
||||||
ok(hwnd != NULL, "gle=%d\n", GetLastError());
|
ok(hwnd != NULL, "gle=%d\n", GetLastError());
|
||||||
|
|
||||||
if (!hwnd)
|
if (!hwnd) return NULL;
|
||||||
{
|
|
||||||
HeapFree(GetProcessHeap(), 0, info);
|
|
||||||
return NULL;
|
|
||||||
}
|
|
||||||
|
|
||||||
info->oldproc = (WNDPROC)SetWindowLongPtrA(hwnd, GWLP_WNDPROC,
|
oldproc = (WNDPROC)SetWindowLongPtrA(hwnd, GWLP_WNDPROC,
|
||||||
(LONG_PTR)listview_subclass_proc);
|
(LONG_PTR)listview_subclass_proc);
|
||||||
SetWindowLongPtrA(hwnd, GWLP_USERDATA, (LONG_PTR)info);
|
SetWindowLongPtrA(hwnd, GWLP_USERDATA, (LONG_PTR)oldproc);
|
||||||
|
|
||||||
return hwnd;
|
return hwnd;
|
||||||
}
|
}
|
||||||
|
|
||||||
static LRESULT WINAPI header_subclass_proc(HWND hwnd, UINT message, WPARAM wParam, LPARAM lParam)
|
static LRESULT WINAPI header_subclass_proc(HWND hwnd, UINT message, WPARAM wParam, LPARAM lParam)
|
||||||
{
|
{
|
||||||
struct subclass_info *info = (struct subclass_info *)GetWindowLongPtrA(hwnd, GWLP_USERDATA);
|
WNDPROC oldproc = (WNDPROC)GetWindowLongPtrA(hwnd, GWLP_USERDATA);
|
||||||
static LONG defwndproc_counter = 0;
|
static LONG defwndproc_counter = 0;
|
||||||
LRESULT ret;
|
LRESULT ret;
|
||||||
struct message msg;
|
struct message msg;
|
||||||
@ -560,31 +531,27 @@ static LRESULT WINAPI header_subclass_proc(HWND hwnd, UINT message, WPARAM wPara
|
|||||||
add_message(sequences, LISTVIEW_SEQ_INDEX, &msg);
|
add_message(sequences, LISTVIEW_SEQ_INDEX, &msg);
|
||||||
|
|
||||||
defwndproc_counter++;
|
defwndproc_counter++;
|
||||||
ret = CallWindowProcA(info->oldproc, hwnd, message, wParam, lParam);
|
ret = CallWindowProcA(oldproc, hwnd, message, wParam, lParam);
|
||||||
defwndproc_counter--;
|
defwndproc_counter--;
|
||||||
return ret;
|
return ret;
|
||||||
}
|
}
|
||||||
|
|
||||||
static HWND subclass_header(HWND hwndListview)
|
static HWND subclass_header(HWND hwndListview)
|
||||||
{
|
{
|
||||||
struct subclass_info *info;
|
WNDPROC oldproc;
|
||||||
HWND hwnd;
|
HWND hwnd;
|
||||||
|
|
||||||
info = HeapAlloc(GetProcessHeap(), 0, sizeof(struct subclass_info));
|
|
||||||
if (!info)
|
|
||||||
return NULL;
|
|
||||||
|
|
||||||
hwnd = ListView_GetHeader(hwndListview);
|
hwnd = ListView_GetHeader(hwndListview);
|
||||||
info->oldproc = (WNDPROC)SetWindowLongPtrA(hwnd, GWLP_WNDPROC,
|
oldproc = (WNDPROC)SetWindowLongPtrA(hwnd, GWLP_WNDPROC,
|
||||||
(LONG_PTR)header_subclass_proc);
|
(LONG_PTR)header_subclass_proc);
|
||||||
SetWindowLongPtrA(hwnd, GWLP_USERDATA, (LONG_PTR)info);
|
SetWindowLongPtrA(hwnd, GWLP_USERDATA, (LONG_PTR)oldproc);
|
||||||
|
|
||||||
return hwnd;
|
return hwnd;
|
||||||
}
|
}
|
||||||
|
|
||||||
static LRESULT WINAPI editbox_subclass_proc(HWND hwnd, UINT message, WPARAM wParam, LPARAM lParam)
|
static LRESULT WINAPI editbox_subclass_proc(HWND hwnd, UINT message, WPARAM wParam, LPARAM lParam)
|
||||||
{
|
{
|
||||||
struct subclass_info *info = (struct subclass_info *)GetWindowLongPtrA(hwnd, GWLP_USERDATA);
|
WNDPROC oldproc = (WNDPROC)GetWindowLongPtrA(hwnd, GWLP_USERDATA);
|
||||||
static LONG defwndproc_counter = 0;
|
static LONG defwndproc_counter = 0;
|
||||||
LRESULT ret;
|
LRESULT ret;
|
||||||
struct message msg;
|
struct message msg;
|
||||||
@ -606,24 +573,20 @@ static LRESULT WINAPI editbox_subclass_proc(HWND hwnd, UINT message, WPARAM wPar
|
|||||||
}
|
}
|
||||||
|
|
||||||
defwndproc_counter++;
|
defwndproc_counter++;
|
||||||
ret = CallWindowProcA(info->oldproc, hwnd, message, wParam, lParam);
|
ret = CallWindowProcA(oldproc, hwnd, message, wParam, lParam);
|
||||||
defwndproc_counter--;
|
defwndproc_counter--;
|
||||||
return ret;
|
return ret;
|
||||||
}
|
}
|
||||||
|
|
||||||
static HWND subclass_editbox(HWND hwndListview)
|
static HWND subclass_editbox(HWND hwndListview)
|
||||||
{
|
{
|
||||||
struct subclass_info *info;
|
WNDPROC oldproc;
|
||||||
HWND hwnd;
|
HWND hwnd;
|
||||||
|
|
||||||
info = HeapAlloc(GetProcessHeap(), 0, sizeof(struct subclass_info));
|
|
||||||
if (!info)
|
|
||||||
return NULL;
|
|
||||||
|
|
||||||
hwnd = (HWND)SendMessage(hwndListview, LVM_GETEDITCONTROL, 0, 0);
|
hwnd = (HWND)SendMessage(hwndListview, LVM_GETEDITCONTROL, 0, 0);
|
||||||
info->oldproc = (WNDPROC)SetWindowLongPtrA(hwnd, GWLP_WNDPROC,
|
oldproc = (WNDPROC)SetWindowLongPtrA(hwnd, GWLP_WNDPROC,
|
||||||
(LONG_PTR)editbox_subclass_proc);
|
(LONG_PTR)editbox_subclass_proc);
|
||||||
SetWindowLongPtrA(hwnd, GWLP_USERDATA, (LONG_PTR)info);
|
SetWindowLongPtrA(hwnd, GWLP_USERDATA, (LONG_PTR)oldproc);
|
||||||
|
|
||||||
return hwnd;
|
return hwnd;
|
||||||
}
|
}
|
||||||
|
@ -39,11 +39,6 @@
|
|||||||
#define PARENT_SEQ_INDEX 0
|
#define PARENT_SEQ_INDEX 0
|
||||||
#define MONTHCAL_SEQ_INDEX 1
|
#define MONTHCAL_SEQ_INDEX 1
|
||||||
|
|
||||||
struct subclass_info
|
|
||||||
{
|
|
||||||
WNDPROC oldproc;
|
|
||||||
};
|
|
||||||
|
|
||||||
static struct msg_sequence *sequences[NUM_MSG_SEQUENCES];
|
static struct msg_sequence *sequences[NUM_MSG_SEQUENCES];
|
||||||
|
|
||||||
static HWND parent_wnd;
|
static HWND parent_wnd;
|
||||||
@ -581,7 +576,7 @@ static HWND create_parent_window(void)
|
|||||||
|
|
||||||
static LRESULT WINAPI monthcal_subclass_proc(HWND hwnd, UINT message, WPARAM wParam, LPARAM lParam)
|
static LRESULT WINAPI monthcal_subclass_proc(HWND hwnd, UINT message, WPARAM wParam, LPARAM lParam)
|
||||||
{
|
{
|
||||||
struct subclass_info *info = (struct subclass_info *)GetWindowLongPtrA(hwnd, GWLP_USERDATA);
|
WNDPROC oldproc = (WNDPROC)GetWindowLongPtrA(hwnd, GWLP_USERDATA);
|
||||||
static LONG defwndproc_counter = 0;
|
static LONG defwndproc_counter = 0;
|
||||||
LRESULT ret;
|
LRESULT ret;
|
||||||
struct message msg;
|
struct message msg;
|
||||||
@ -602,7 +597,7 @@ static LRESULT WINAPI monthcal_subclass_proc(HWND hwnd, UINT message, WPARAM wPa
|
|||||||
}
|
}
|
||||||
|
|
||||||
defwndproc_counter++;
|
defwndproc_counter++;
|
||||||
ret = CallWindowProcA(info->oldproc, hwnd, message, wParam, lParam);
|
ret = CallWindowProcA(oldproc, hwnd, message, wParam, lParam);
|
||||||
defwndproc_counter--;
|
defwndproc_counter--;
|
||||||
|
|
||||||
return ret;
|
return ret;
|
||||||
@ -610,13 +605,9 @@ static LRESULT WINAPI monthcal_subclass_proc(HWND hwnd, UINT message, WPARAM wPa
|
|||||||
|
|
||||||
static HWND create_monthcal_control(DWORD style)
|
static HWND create_monthcal_control(DWORD style)
|
||||||
{
|
{
|
||||||
struct subclass_info *info;
|
WNDPROC oldproc;
|
||||||
HWND hwnd;
|
HWND hwnd;
|
||||||
|
|
||||||
info = HeapAlloc(GetProcessHeap(), 0, sizeof(struct subclass_info));
|
|
||||||
if (!info)
|
|
||||||
return NULL;
|
|
||||||
|
|
||||||
hwnd = CreateWindowEx(0,
|
hwnd = CreateWindowEx(0,
|
||||||
MONTHCAL_CLASS,
|
MONTHCAL_CLASS,
|
||||||
"",
|
"",
|
||||||
@ -624,15 +615,11 @@ static HWND create_monthcal_control(DWORD style)
|
|||||||
0, 0, 300, 400,
|
0, 0, 300, 400,
|
||||||
parent_wnd, NULL, GetModuleHandleA(NULL), NULL);
|
parent_wnd, NULL, GetModuleHandleA(NULL), NULL);
|
||||||
|
|
||||||
if (!hwnd)
|
if (!hwnd) return NULL;
|
||||||
{
|
|
||||||
HeapFree(GetProcessHeap(), 0, info);
|
|
||||||
return NULL;
|
|
||||||
}
|
|
||||||
|
|
||||||
info->oldproc = (WNDPROC)SetWindowLongPtrA(hwnd, GWLP_WNDPROC,
|
oldproc = (WNDPROC)SetWindowLongPtrA(hwnd, GWLP_WNDPROC,
|
||||||
(LONG_PTR)monthcal_subclass_proc);
|
(LONG_PTR)monthcal_subclass_proc);
|
||||||
SetWindowLongPtrA(hwnd, GWLP_USERDATA, (LONG_PTR)info);
|
SetWindowLongPtrA(hwnd, GWLP_USERDATA, (LONG_PTR)oldproc);
|
||||||
|
|
||||||
SendMessage(hwnd, WM_SETFONT, (WPARAM)GetStockObject(SYSTEM_FONT), 0);
|
SendMessage(hwnd, WM_SETFONT, (WPARAM)GetStockObject(SYSTEM_FONT), 0);
|
||||||
|
|
||||||
|
@ -374,14 +374,9 @@ static HWND createParentWindow(void)
|
|||||||
GetDesktopWindow(), NULL, GetModuleHandleA(NULL), NULL);
|
GetDesktopWindow(), NULL, GetModuleHandleA(NULL), NULL);
|
||||||
}
|
}
|
||||||
|
|
||||||
struct subclass_info
|
|
||||||
{
|
|
||||||
WNDPROC oldproc;
|
|
||||||
};
|
|
||||||
|
|
||||||
static LRESULT WINAPI tabSubclassProcess(HWND hwnd, UINT message, WPARAM wParam, LPARAM lParam)
|
static LRESULT WINAPI tabSubclassProcess(HWND hwnd, UINT message, WPARAM wParam, LPARAM lParam)
|
||||||
{
|
{
|
||||||
struct subclass_info *info = (struct subclass_info *)GetWindowLongPtrA(hwnd, GWLP_USERDATA);
|
WNDPROC oldproc = (WNDPROC)GetWindowLongPtrA(hwnd, GWLP_USERDATA);
|
||||||
static LONG defwndproc_counter = 0;
|
static LONG defwndproc_counter = 0;
|
||||||
LRESULT ret;
|
LRESULT ret;
|
||||||
struct message msg;
|
struct message msg;
|
||||||
@ -406,7 +401,7 @@ static LRESULT WINAPI tabSubclassProcess(HWND hwnd, UINT message, WPARAM wParam,
|
|||||||
}
|
}
|
||||||
|
|
||||||
defwndproc_counter++;
|
defwndproc_counter++;
|
||||||
ret = CallWindowProcA(info->oldproc, hwnd, message, wParam, lParam);
|
ret = CallWindowProcA(oldproc, hwnd, message, wParam, lParam);
|
||||||
defwndproc_counter--;
|
defwndproc_counter--;
|
||||||
|
|
||||||
return ret;
|
return ret;
|
||||||
@ -416,14 +411,10 @@ static HWND createFilledTabControl(HWND parent_wnd, DWORD style, DWORD mask, INT
|
|||||||
{
|
{
|
||||||
HWND tabHandle;
|
HWND tabHandle;
|
||||||
TCITEM tcNewTab;
|
TCITEM tcNewTab;
|
||||||
struct subclass_info *info;
|
WNDPROC oldproc;
|
||||||
RECT rect;
|
RECT rect;
|
||||||
INT i;
|
INT i;
|
||||||
|
|
||||||
info = HeapAlloc(GetProcessHeap(), 0, sizeof(struct subclass_info));
|
|
||||||
if (!info)
|
|
||||||
return NULL;
|
|
||||||
|
|
||||||
GetClientRect(parent_wnd, &rect);
|
GetClientRect(parent_wnd, &rect);
|
||||||
|
|
||||||
tabHandle = CreateWindow (
|
tabHandle = CreateWindow (
|
||||||
@ -435,8 +426,8 @@ static HWND createFilledTabControl(HWND parent_wnd, DWORD style, DWORD mask, INT
|
|||||||
|
|
||||||
assert(tabHandle);
|
assert(tabHandle);
|
||||||
|
|
||||||
info->oldproc = (WNDPROC)SetWindowLongPtrA(tabHandle, GWLP_WNDPROC, (LONG_PTR)tabSubclassProcess);
|
oldproc = (WNDPROC)SetWindowLongPtrA(tabHandle, GWLP_WNDPROC, (LONG_PTR)tabSubclassProcess);
|
||||||
SetWindowLongPtrA(tabHandle, GWLP_USERDATA, (LONG_PTR)info);
|
SetWindowLongPtrA(tabHandle, GWLP_USERDATA, (LONG_PTR)oldproc);
|
||||||
|
|
||||||
tcNewTab.mask = mask;
|
tcNewTab.mask = mask;
|
||||||
|
|
||||||
|
@ -364,11 +364,6 @@ static const struct message ignore_selection_test_seq[] = {
|
|||||||
{0}
|
{0}
|
||||||
};
|
};
|
||||||
|
|
||||||
struct subclass_info
|
|
||||||
{
|
|
||||||
WNDPROC oldproc;
|
|
||||||
};
|
|
||||||
|
|
||||||
static LRESULT WINAPI parent_wnd_proc(HWND hwnd, UINT message, WPARAM wParam, LPARAM lParam){
|
static LRESULT WINAPI parent_wnd_proc(HWND hwnd, UINT message, WPARAM wParam, LPARAM lParam){
|
||||||
static LONG defwndproc_counter = 0;
|
static LONG defwndproc_counter = 0;
|
||||||
LRESULT ret;
|
LRESULT ret;
|
||||||
@ -430,7 +425,7 @@ static HWND create_parent_window(void){
|
|||||||
}
|
}
|
||||||
|
|
||||||
static LRESULT WINAPI trackbar_subclass_proc(HWND hwnd, UINT message, WPARAM wParam, LPARAM lParam){
|
static LRESULT WINAPI trackbar_subclass_proc(HWND hwnd, UINT message, WPARAM wParam, LPARAM lParam){
|
||||||
struct subclass_info *info = (struct subclass_info *) GetWindowLongPtrA(hwnd, GWLP_USERDATA);
|
WNDPROC oldproc = (WNDPROC)GetWindowLongPtrA(hwnd, GWLP_USERDATA);
|
||||||
static LONG defwndproc_counter = 0;
|
static LONG defwndproc_counter = 0;
|
||||||
LRESULT ret;
|
LRESULT ret;
|
||||||
struct message msg;
|
struct message msg;
|
||||||
@ -445,36 +440,27 @@ static LRESULT WINAPI trackbar_subclass_proc(HWND hwnd, UINT message, WPARAM wPa
|
|||||||
add_message(sequences, TRACKBAR_SEQ_INDEX, &msg);
|
add_message(sequences, TRACKBAR_SEQ_INDEX, &msg);
|
||||||
|
|
||||||
defwndproc_counter++;
|
defwndproc_counter++;
|
||||||
ret = CallWindowProcA(info->oldproc, hwnd, message, wParam, lParam);
|
ret = CallWindowProcA(oldproc, hwnd, message, wParam, lParam);
|
||||||
defwndproc_counter--;
|
defwndproc_counter--;
|
||||||
|
|
||||||
return ret;
|
return ret;
|
||||||
}
|
}
|
||||||
|
|
||||||
static HWND create_trackbar(DWORD style, HWND parent){
|
static HWND create_trackbar(DWORD style, HWND parent){
|
||||||
struct subclass_info *info;
|
|
||||||
HWND hWndTrack;
|
HWND hWndTrack;
|
||||||
|
WNDPROC oldproc;
|
||||||
RECT rect;
|
RECT rect;
|
||||||
|
|
||||||
info = HeapAlloc(GetProcessHeap(), 0, sizeof(struct subclass_info));
|
|
||||||
if (!info)
|
|
||||||
return NULL;
|
|
||||||
|
|
||||||
GetClientRect(parent, &rect);
|
GetClientRect(parent, &rect);
|
||||||
hWndTrack = CreateWindowEx(
|
hWndTrack = CreateWindowEx(
|
||||||
0, TRACKBAR_CLASS,"Trackbar Control", style,
|
0, TRACKBAR_CLASS,"Trackbar Control", style,
|
||||||
rect.right,rect.bottom, 100, 50,
|
rect.right,rect.bottom, 100, 50,
|
||||||
parent, NULL,GetModuleHandleA(NULL) ,NULL);
|
parent, NULL,GetModuleHandleA(NULL) ,NULL);
|
||||||
|
|
||||||
if (!hWndTrack)
|
if (!hWndTrack) return NULL;
|
||||||
{
|
|
||||||
HeapFree(GetProcessHeap(), 0, info);
|
|
||||||
return NULL;
|
|
||||||
}
|
|
||||||
|
|
||||||
info->oldproc = (WNDPROC)SetWindowLongPtrA(hWndTrack, GWLP_WNDPROC, (LONG_PTR)trackbar_subclass_proc);
|
oldproc = (WNDPROC)SetWindowLongPtrA(hWndTrack, GWLP_WNDPROC, (LONG_PTR)trackbar_subclass_proc);
|
||||||
|
SetWindowLongPtrA(hWndTrack, GWLP_USERDATA, (LONG_PTR)oldproc);
|
||||||
SetWindowLongPtrA(hWndTrack, GWLP_USERDATA, (LONG_PTR)info);
|
|
||||||
|
|
||||||
return hWndTrack;
|
return hWndTrack;
|
||||||
}
|
}
|
||||||
|
@ -217,14 +217,9 @@ static HWND create_parent_window(void)
|
|||||||
GetDesktopWindow(), NULL, GetModuleHandleA(NULL), NULL);
|
GetDesktopWindow(), NULL, GetModuleHandleA(NULL), NULL);
|
||||||
}
|
}
|
||||||
|
|
||||||
struct subclass_info
|
|
||||||
{
|
|
||||||
WNDPROC oldproc;
|
|
||||||
};
|
|
||||||
|
|
||||||
static LRESULT WINAPI edit_subclass_proc(HWND hwnd, UINT message, WPARAM wParam, LPARAM lParam)
|
static LRESULT WINAPI edit_subclass_proc(HWND hwnd, UINT message, WPARAM wParam, LPARAM lParam)
|
||||||
{
|
{
|
||||||
struct subclass_info *info = (struct subclass_info *)GetWindowLongPtrA(hwnd, GWLP_USERDATA);
|
WNDPROC oldproc = (WNDPROC)GetWindowLongPtrA(hwnd, GWLP_USERDATA);
|
||||||
static LONG defwndproc_counter = 0;
|
static LONG defwndproc_counter = 0;
|
||||||
LRESULT ret;
|
LRESULT ret;
|
||||||
struct message msg;
|
struct message msg;
|
||||||
@ -239,40 +234,32 @@ static LRESULT WINAPI edit_subclass_proc(HWND hwnd, UINT message, WPARAM wParam,
|
|||||||
add_message(sequences, EDIT_SEQ_INDEX, &msg);
|
add_message(sequences, EDIT_SEQ_INDEX, &msg);
|
||||||
|
|
||||||
defwndproc_counter++;
|
defwndproc_counter++;
|
||||||
ret = CallWindowProcA(info->oldproc, hwnd, message, wParam, lParam);
|
ret = CallWindowProcA(oldproc, hwnd, message, wParam, lParam);
|
||||||
defwndproc_counter--;
|
defwndproc_counter--;
|
||||||
return ret;
|
return ret;
|
||||||
}
|
}
|
||||||
|
|
||||||
static HWND create_edit_control(void)
|
static HWND create_edit_control(void)
|
||||||
{
|
{
|
||||||
struct subclass_info *info;
|
WNDPROC oldproc;
|
||||||
RECT rect;
|
RECT rect;
|
||||||
|
|
||||||
info = HeapAlloc(GetProcessHeap(), 0, sizeof(struct subclass_info));
|
|
||||||
if (!info)
|
|
||||||
return NULL;
|
|
||||||
|
|
||||||
GetClientRect(parent_wnd, &rect);
|
GetClientRect(parent_wnd, &rect);
|
||||||
edit = CreateWindowExA(0, "EDIT", NULL, WS_CHILD | WS_BORDER | WS_VISIBLE,
|
edit = CreateWindowExA(0, "EDIT", NULL, WS_CHILD | WS_BORDER | WS_VISIBLE,
|
||||||
0, 0, rect.right, rect.bottom,
|
0, 0, rect.right, rect.bottom,
|
||||||
parent_wnd, NULL, GetModuleHandleA(NULL), NULL);
|
parent_wnd, NULL, GetModuleHandleA(NULL), NULL);
|
||||||
if (!edit)
|
if (!edit) return NULL;
|
||||||
{
|
|
||||||
HeapFree(GetProcessHeap(), 0, info);
|
|
||||||
return NULL;
|
|
||||||
}
|
|
||||||
|
|
||||||
info->oldproc = (WNDPROC)SetWindowLongPtrA(edit, GWLP_WNDPROC,
|
oldproc = (WNDPROC)SetWindowLongPtrA(edit, GWLP_WNDPROC,
|
||||||
(LONG_PTR)edit_subclass_proc);
|
(LONG_PTR)edit_subclass_proc);
|
||||||
SetWindowLongPtrA(edit, GWLP_USERDATA, (LONG_PTR)info);
|
SetWindowLongPtrA(edit, GWLP_USERDATA, (LONG_PTR)oldproc);
|
||||||
|
|
||||||
return edit;
|
return edit;
|
||||||
}
|
}
|
||||||
|
|
||||||
static LRESULT WINAPI updown_subclass_proc(HWND hwnd, UINT message, WPARAM wParam, LPARAM lParam)
|
static LRESULT WINAPI updown_subclass_proc(HWND hwnd, UINT message, WPARAM wParam, LPARAM lParam)
|
||||||
{
|
{
|
||||||
struct subclass_info *info = (struct subclass_info *)GetWindowLongPtrA(hwnd, GWLP_USERDATA);
|
WNDPROC oldproc = (WNDPROC)GetWindowLongPtrA(hwnd, GWLP_USERDATA);
|
||||||
static LONG defwndproc_counter = 0;
|
static LONG defwndproc_counter = 0;
|
||||||
LRESULT ret;
|
LRESULT ret;
|
||||||
struct message msg;
|
struct message msg;
|
||||||
@ -287,7 +274,7 @@ static LRESULT WINAPI updown_subclass_proc(HWND hwnd, UINT message, WPARAM wPara
|
|||||||
add_message(sequences, UPDOWN_SEQ_INDEX, &msg);
|
add_message(sequences, UPDOWN_SEQ_INDEX, &msg);
|
||||||
|
|
||||||
defwndproc_counter++;
|
defwndproc_counter++;
|
||||||
ret = CallWindowProcA(info->oldproc, hwnd, message, wParam, lParam);
|
ret = CallWindowProcA(oldproc, hwnd, message, wParam, lParam);
|
||||||
defwndproc_counter--;
|
defwndproc_counter--;
|
||||||
|
|
||||||
return ret;
|
return ret;
|
||||||
@ -295,27 +282,19 @@ static LRESULT WINAPI updown_subclass_proc(HWND hwnd, UINT message, WPARAM wPara
|
|||||||
|
|
||||||
static HWND create_updown_control(DWORD style)
|
static HWND create_updown_control(DWORD style)
|
||||||
{
|
{
|
||||||
struct subclass_info *info;
|
WNDPROC oldproc;
|
||||||
HWND updown;
|
HWND updown;
|
||||||
RECT rect;
|
RECT rect;
|
||||||
|
|
||||||
info = HeapAlloc(GetProcessHeap(), 0, sizeof(struct subclass_info));
|
|
||||||
if (!info)
|
|
||||||
return NULL;
|
|
||||||
|
|
||||||
GetClientRect(parent_wnd, &rect);
|
GetClientRect(parent_wnd, &rect);
|
||||||
updown = CreateUpDownControl(WS_CHILD | WS_BORDER | WS_VISIBLE | UDS_ALIGNRIGHT | style,
|
updown = CreateUpDownControl(WS_CHILD | WS_BORDER | WS_VISIBLE | UDS_ALIGNRIGHT | style,
|
||||||
0, 0, rect.right, rect.bottom, parent_wnd, 1, GetModuleHandleA(NULL), edit,
|
0, 0, rect.right, rect.bottom, parent_wnd, 1, GetModuleHandleA(NULL), edit,
|
||||||
100, 0, 50);
|
100, 0, 50);
|
||||||
if (!updown)
|
if (!updown) return NULL;
|
||||||
{
|
|
||||||
HeapFree(GetProcessHeap(), 0, info);
|
|
||||||
return NULL;
|
|
||||||
}
|
|
||||||
|
|
||||||
info->oldproc = (WNDPROC)SetWindowLongPtrA(updown, GWLP_WNDPROC,
|
oldproc = (WNDPROC)SetWindowLongPtrA(updown, GWLP_WNDPROC,
|
||||||
(LONG_PTR)updown_subclass_proc);
|
(LONG_PTR)updown_subclass_proc);
|
||||||
SetWindowLongPtrA(updown, GWLP_USERDATA, (LONG_PTR)info);
|
SetWindowLongPtrA(updown, GWLP_USERDATA, (LONG_PTR)oldproc);
|
||||||
|
|
||||||
return updown;
|
return updown;
|
||||||
}
|
}
|
||||||
|
Loading…
x
Reference in New Issue
Block a user