Commit a4b5c5db authored by Nikolay Sivov's avatar Nikolay Sivov Committed by Alexandre Julliard

comctl32: Don't use additional heap allocated pointer to old window procedure.

parent ecf89c7e
......@@ -121,14 +121,9 @@ static const struct message test_dtm_set_and_get_system_time_seq[] = {
{ 0 }
};
struct subclass_info
{
WNDPROC oldproc;
};
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;
LRESULT ret;
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);
defwndproc_counter++;
ret = CallWindowProcA(info->oldproc, hwnd, message, wParam, lParam);
ret = CallWindowProcA(oldproc, hwnd, message, wParam, lParam);
defwndproc_counter--;
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)
{
struct subclass_info *info;
WNDPROC oldproc;
HWND hWndDateTime = NULL;
info = HeapAlloc(GetProcessHeap(), 0, sizeof(struct subclass_info));
if (!info)
return NULL;
hWndDateTime = CreateWindowEx(0,
DATETIMEPICK_CLASS,
NULL,
......@@ -168,14 +159,11 @@ static HWND create_datetime_control(DWORD style)
NULL,
NULL);
if (!hWndDateTime) {
HeapFree(GetProcessHeap(), 0, info);
return NULL;
}
if (!hWndDateTime) return NULL;
info->oldproc = (WNDPROC)SetWindowLongPtrA(hWndDateTime, GWLP_WNDPROC,
(LONG_PTR)datetime_subclass_proc);
SetWindowLongPtrA(hWndDateTime, GWLP_USERDATA, (LONG_PTR)info);
oldproc = (WNDPROC)SetWindowLongPtrA(hWndDateTime, GWLP_WNDPROC,
(LONG_PTR)datetime_subclass_proc);
SetWindowLongPtrA(hWndDateTime, GWLP_USERDATA, (LONG_PTR)oldproc);
return hWndDateTime;
}
......
......@@ -396,14 +396,9 @@ static WCHAR pszUniTestW[] = {'T','S','T',0};
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)
{
struct subclass_info *info = (struct subclass_info *)GetWindowLongPtrA(hwnd, GWLP_USERDATA);
WNDPROC oldproc = (WNDPROC)GetWindowLongPtrA(hwnd, GWLP_USERDATA);
static LONG defwndproc_counter = 0;
LRESULT ret;
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);
defwndproc_counter++;
ret = CallWindowProcA(info->oldproc, hwnd, message, wParam, lParam);
ret = CallWindowProcA(oldproc, hwnd, message, wParam, lParam);
defwndproc_counter--;
return ret;
......@@ -487,7 +482,7 @@ static HWND create_custom_parent_window(void)
static HWND create_custom_header_control(HWND hParent, BOOL preloadHeaderItems)
{
struct subclass_info *info;
WNDPROC oldproc;
HWND childHandle;
HDLAYOUT hlayout;
RECT rectwin;
......@@ -505,9 +500,6 @@ static HWND create_custom_header_control(HWND hParent, BOOL preloadHeaderItems)
flush_sequences(sequences, NUM_MSG_SEQUENCES);
info = HeapAlloc(GetProcessHeap(), 0, sizeof(struct subclass_info));
if (!info)
return NULL;
childHandle = CreateWindowEx(0, WC_HEADER, NULL,
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,
winpos.cx, winpos.cy, 0);
info->oldproc = (WNDPROC)SetWindowLongPtrA(childHandle, GWLP_WNDPROC,
(LONG_PTR)header_subclass_proc);
SetWindowLongPtrA(childHandle, GWLP_USERDATA, (LONG_PTR)info);
oldproc = (WNDPROC)SetWindowLongPtrA(childHandle, GWLP_WNDPROC,
(LONG_PTR)header_subclass_proc);
SetWindowLongPtrA(childHandle, GWLP_USERDATA, (LONG_PTR)oldproc);
return childHandle;
}
......
......@@ -271,11 +271,6 @@ static const struct message lvs_ex_transparentbkgnd_seq[] = {
{ 0 }
};
struct subclass_info
{
WNDPROC oldproc;
};
static LRESULT WINAPI parent_wnd_proc(HWND hwnd, UINT message, WPARAM wParam, LPARAM lParam)
{
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)
{
struct subclass_info *info = (struct subclass_info *)GetWindowLongPtrA(hwnd, GWLP_USERDATA);
WNDPROC oldproc = (WNDPROC)GetWindowLongPtrA(hwnd, GWLP_USERDATA);
static LONG defwndproc_counter = 0;
LRESULT ret;
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);
defwndproc_counter++;
ret = CallWindowProcA(info->oldproc, hwnd, message, wParam, lParam);
ret = CallWindowProcA(oldproc, hwnd, message, wParam, lParam);
defwndproc_counter--;
return ret;
}
static HWND create_listview_control(DWORD style)
{
struct subclass_info *info;
WNDPROC oldproc;
HWND hwnd;
RECT rect;
info = HeapAlloc(GetProcessHeap(), 0, sizeof(struct subclass_info));
if (!info)
return NULL;
GetClientRect(hwndparent, &rect);
hwnd = CreateWindowExA(0, WC_LISTVIEW, "foo",
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);
ok(hwnd != NULL, "gle=%d\n", GetLastError());
if (!hwnd)
{
HeapFree(GetProcessHeap(), 0, info);
return NULL;
}
if (!hwnd) return NULL;
info->oldproc = (WNDPROC)SetWindowLongPtrA(hwnd, GWLP_WNDPROC,
(LONG_PTR)listview_subclass_proc);
SetWindowLongPtrA(hwnd, GWLP_USERDATA, (LONG_PTR)info);
oldproc = (WNDPROC)SetWindowLongPtrA(hwnd, GWLP_WNDPROC,
(LONG_PTR)listview_subclass_proc);
SetWindowLongPtrA(hwnd, GWLP_USERDATA, (LONG_PTR)oldproc);
return hwnd;
}
......@@ -483,15 +470,11 @@ static HWND create_listview_control(DWORD style)
/* unicode listview window with specified parent */
static HWND create_listview_controlW(DWORD style, HWND parent)
{
struct subclass_info *info;
WNDPROC oldproc;
HWND hwnd;
RECT rect;
static const WCHAR nameW[] = {'f','o','o',0};
info = HeapAlloc(GetProcessHeap(), 0, sizeof(struct subclass_info));
if (!info)
return NULL;
GetClientRect(parent, &rect);
hwnd = CreateWindowExW(0, WC_LISTVIEWW, nameW,
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);
ok(hwnd != NULL, "gle=%d\n", GetLastError());
if (!hwnd)
{
HeapFree(GetProcessHeap(), 0, info);
return NULL;
}
if (!hwnd) return NULL;
info->oldproc = (WNDPROC)SetWindowLongPtrW(hwnd, GWLP_WNDPROC,
(LONG_PTR)listview_subclass_proc);
SetWindowLongPtrW(hwnd, GWLP_USERDATA, (LONG_PTR)info);
oldproc = (WNDPROC)SetWindowLongPtrW(hwnd, GWLP_WNDPROC,
(LONG_PTR)listview_subclass_proc);
SetWindowLongPtrW(hwnd, GWLP_USERDATA, (LONG_PTR)oldproc);
return hwnd;
}
static HWND create_custom_listview_control(DWORD style)
{
struct subclass_info *info;
WNDPROC oldproc;
HWND hwnd;
RECT rect;
info = HeapAlloc(GetProcessHeap(), 0, sizeof(struct subclass_info));
if (!info)
return NULL;
GetClientRect(hwndparent, &rect);
hwnd = CreateWindowExA(0, WC_LISTVIEW, "foo",
WS_CHILD | WS_BORDER | WS_VISIBLE | style,
......@@ -529,22 +504,18 @@ static HWND create_custom_listview_control(DWORD style)
hwndparent, NULL, GetModuleHandleA(NULL), NULL);
ok(hwnd != NULL, "gle=%d\n", GetLastError());
if (!hwnd)
{
HeapFree(GetProcessHeap(), 0, info);
return NULL;
}
if (!hwnd) return NULL;
info->oldproc = (WNDPROC)SetWindowLongPtrA(hwnd, GWLP_WNDPROC,
(LONG_PTR)listview_subclass_proc);
SetWindowLongPtrA(hwnd, GWLP_USERDATA, (LONG_PTR)info);
oldproc = (WNDPROC)SetWindowLongPtrA(hwnd, GWLP_WNDPROC,
(LONG_PTR)listview_subclass_proc);
SetWindowLongPtrA(hwnd, GWLP_USERDATA, (LONG_PTR)oldproc);
return hwnd;
}
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;
LRESULT ret;
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);
defwndproc_counter++;
ret = CallWindowProcA(info->oldproc, hwnd, message, wParam, lParam);
ret = CallWindowProcA(oldproc, hwnd, message, wParam, lParam);
defwndproc_counter--;
return ret;
}
static HWND subclass_header(HWND hwndListview)
{
struct subclass_info *info;
WNDPROC oldproc;
HWND hwnd;
info = HeapAlloc(GetProcessHeap(), 0, sizeof(struct subclass_info));
if (!info)
return NULL;
hwnd = ListView_GetHeader(hwndListview);
info->oldproc = (WNDPROC)SetWindowLongPtrA(hwnd, GWLP_WNDPROC,
(LONG_PTR)header_subclass_proc);
SetWindowLongPtrA(hwnd, GWLP_USERDATA, (LONG_PTR)info);
oldproc = (WNDPROC)SetWindowLongPtrA(hwnd, GWLP_WNDPROC,
(LONG_PTR)header_subclass_proc);
SetWindowLongPtrA(hwnd, GWLP_USERDATA, (LONG_PTR)oldproc);
return hwnd;
}
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;
LRESULT ret;
struct message msg;
......@@ -606,24 +573,20 @@ static LRESULT WINAPI editbox_subclass_proc(HWND hwnd, UINT message, WPARAM wPar
}
defwndproc_counter++;
ret = CallWindowProcA(info->oldproc, hwnd, message, wParam, lParam);
ret = CallWindowProcA(oldproc, hwnd, message, wParam, lParam);
defwndproc_counter--;
return ret;
}
static HWND subclass_editbox(HWND hwndListview)
{
struct subclass_info *info;
WNDPROC oldproc;
HWND hwnd;
info = HeapAlloc(GetProcessHeap(), 0, sizeof(struct subclass_info));
if (!info)
return NULL;
hwnd = (HWND)SendMessage(hwndListview, LVM_GETEDITCONTROL, 0, 0);
info->oldproc = (WNDPROC)SetWindowLongPtrA(hwnd, GWLP_WNDPROC,
(LONG_PTR)editbox_subclass_proc);
SetWindowLongPtrA(hwnd, GWLP_USERDATA, (LONG_PTR)info);
oldproc = (WNDPROC)SetWindowLongPtrA(hwnd, GWLP_WNDPROC,
(LONG_PTR)editbox_subclass_proc);
SetWindowLongPtrA(hwnd, GWLP_USERDATA, (LONG_PTR)oldproc);
return hwnd;
}
......
......@@ -39,11 +39,6 @@
#define PARENT_SEQ_INDEX 0
#define MONTHCAL_SEQ_INDEX 1
struct subclass_info
{
WNDPROC oldproc;
};
static struct msg_sequence *sequences[NUM_MSG_SEQUENCES];
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)
{
struct subclass_info *info = (struct subclass_info *)GetWindowLongPtrA(hwnd, GWLP_USERDATA);
WNDPROC oldproc = (WNDPROC)GetWindowLongPtrA(hwnd, GWLP_USERDATA);
static LONG defwndproc_counter = 0;
LRESULT ret;
struct message msg;
......@@ -602,7 +597,7 @@ static LRESULT WINAPI monthcal_subclass_proc(HWND hwnd, UINT message, WPARAM wPa
}
defwndproc_counter++;
ret = CallWindowProcA(info->oldproc, hwnd, message, wParam, lParam);
ret = CallWindowProcA(oldproc, hwnd, message, wParam, lParam);
defwndproc_counter--;
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)
{
struct subclass_info *info;
WNDPROC oldproc;
HWND hwnd;
info = HeapAlloc(GetProcessHeap(), 0, sizeof(struct subclass_info));
if (!info)
return NULL;
hwnd = CreateWindowEx(0,
MONTHCAL_CLASS,
"",
......@@ -624,15 +615,11 @@ static HWND create_monthcal_control(DWORD style)
0, 0, 300, 400,
parent_wnd, NULL, GetModuleHandleA(NULL), NULL);
if (!hwnd)
{
HeapFree(GetProcessHeap(), 0, info);
return NULL;
}
if (!hwnd) return NULL;
info->oldproc = (WNDPROC)SetWindowLongPtrA(hwnd, GWLP_WNDPROC,
(LONG_PTR)monthcal_subclass_proc);
SetWindowLongPtrA(hwnd, GWLP_USERDATA, (LONG_PTR)info);
oldproc = (WNDPROC)SetWindowLongPtrA(hwnd, GWLP_WNDPROC,
(LONG_PTR)monthcal_subclass_proc);
SetWindowLongPtrA(hwnd, GWLP_USERDATA, (LONG_PTR)oldproc);
SendMessage(hwnd, WM_SETFONT, (WPARAM)GetStockObject(SYSTEM_FONT), 0);
......
......@@ -374,14 +374,9 @@ static HWND createParentWindow(void)
GetDesktopWindow(), NULL, GetModuleHandleA(NULL), NULL);
}
struct subclass_info
{
WNDPROC oldproc;
};
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;
LRESULT ret;
struct message msg;
......@@ -406,7 +401,7 @@ static LRESULT WINAPI tabSubclassProcess(HWND hwnd, UINT message, WPARAM wParam,
}
defwndproc_counter++;
ret = CallWindowProcA(info->oldproc, hwnd, message, wParam, lParam);
ret = CallWindowProcA(oldproc, hwnd, message, wParam, lParam);
defwndproc_counter--;
return ret;
......@@ -416,14 +411,10 @@ static HWND createFilledTabControl(HWND parent_wnd, DWORD style, DWORD mask, INT
{
HWND tabHandle;
TCITEM tcNewTab;
struct subclass_info *info;
WNDPROC oldproc;
RECT rect;
INT i;
info = HeapAlloc(GetProcessHeap(), 0, sizeof(struct subclass_info));
if (!info)
return NULL;
GetClientRect(parent_wnd, &rect);
tabHandle = CreateWindow (
......@@ -435,8 +426,8 @@ static HWND createFilledTabControl(HWND parent_wnd, DWORD style, DWORD mask, INT
assert(tabHandle);
info->oldproc = (WNDPROC)SetWindowLongPtrA(tabHandle, GWLP_WNDPROC, (LONG_PTR)tabSubclassProcess);
SetWindowLongPtrA(tabHandle, GWLP_USERDATA, (LONG_PTR)info);
oldproc = (WNDPROC)SetWindowLongPtrA(tabHandle, GWLP_WNDPROC, (LONG_PTR)tabSubclassProcess);
SetWindowLongPtrA(tabHandle, GWLP_USERDATA, (LONG_PTR)oldproc);
tcNewTab.mask = mask;
......
......@@ -364,11 +364,6 @@ static const struct message ignore_selection_test_seq[] = {
{0}
};
struct subclass_info
{
WNDPROC oldproc;
};
static LRESULT WINAPI parent_wnd_proc(HWND hwnd, UINT message, WPARAM wParam, LPARAM lParam){
static LONG defwndproc_counter = 0;
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){
struct subclass_info *info = (struct subclass_info *) GetWindowLongPtrA(hwnd, GWLP_USERDATA);
WNDPROC oldproc = (WNDPROC)GetWindowLongPtrA(hwnd, GWLP_USERDATA);
static LONG defwndproc_counter = 0;
LRESULT ret;
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);
defwndproc_counter++;
ret = CallWindowProcA(info->oldproc, hwnd, message, wParam, lParam);
ret = CallWindowProcA(oldproc, hwnd, message, wParam, lParam);
defwndproc_counter--;
return ret;
}
static HWND create_trackbar(DWORD style, HWND parent){
struct subclass_info *info;
HWND hWndTrack;
WNDPROC oldproc;
RECT rect;
info = HeapAlloc(GetProcessHeap(), 0, sizeof(struct subclass_info));
if (!info)
return NULL;
GetClientRect(parent, &rect);
hWndTrack = CreateWindowEx(
0, TRACKBAR_CLASS,"Trackbar Control", style,
rect.right,rect.bottom, 100, 50,
parent, NULL,GetModuleHandleA(NULL) ,NULL);
if (!hWndTrack)
{
HeapFree(GetProcessHeap(), 0, info);
return NULL;
}
info->oldproc = (WNDPROC)SetWindowLongPtrA(hWndTrack, GWLP_WNDPROC, (LONG_PTR)trackbar_subclass_proc);
if (!hWndTrack) return NULL;
SetWindowLongPtrA(hWndTrack, GWLP_USERDATA, (LONG_PTR)info);
oldproc = (WNDPROC)SetWindowLongPtrA(hWndTrack, GWLP_WNDPROC, (LONG_PTR)trackbar_subclass_proc);
SetWindowLongPtrA(hWndTrack, GWLP_USERDATA, (LONG_PTR)oldproc);
return hWndTrack;
}
......
......@@ -217,14 +217,9 @@ static HWND create_parent_window(void)
GetDesktopWindow(), NULL, GetModuleHandleA(NULL), NULL);
}
struct subclass_info
{
WNDPROC oldproc;
};
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;
LRESULT ret;
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);
defwndproc_counter++;
ret = CallWindowProcA(info->oldproc, hwnd, message, wParam, lParam);
ret = CallWindowProcA(oldproc, hwnd, message, wParam, lParam);
defwndproc_counter--;
return ret;
}
static HWND create_edit_control(void)
{
struct subclass_info *info;
WNDPROC oldproc;
RECT rect;
info = HeapAlloc(GetProcessHeap(), 0, sizeof(struct subclass_info));
if (!info)
return NULL;
GetClientRect(parent_wnd, &rect);
edit = CreateWindowExA(0, "EDIT", NULL, WS_CHILD | WS_BORDER | WS_VISIBLE,
0, 0, rect.right, rect.bottom,
parent_wnd, NULL, GetModuleHandleA(NULL), NULL);
if (!edit)
{
HeapFree(GetProcessHeap(), 0, info);
return NULL;
}
if (!edit) return NULL;
info->oldproc = (WNDPROC)SetWindowLongPtrA(edit, GWLP_WNDPROC,
(LONG_PTR)edit_subclass_proc);
SetWindowLongPtrA(edit, GWLP_USERDATA, (LONG_PTR)info);
oldproc = (WNDPROC)SetWindowLongPtrA(edit, GWLP_WNDPROC,
(LONG_PTR)edit_subclass_proc);
SetWindowLongPtrA(edit, GWLP_USERDATA, (LONG_PTR)oldproc);
return edit;
}
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;
LRESULT ret;
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);
defwndproc_counter++;
ret = CallWindowProcA(info->oldproc, hwnd, message, wParam, lParam);
ret = CallWindowProcA(oldproc, hwnd, message, wParam, lParam);
defwndproc_counter--;
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)
{
struct subclass_info *info;
WNDPROC oldproc;
HWND updown;
RECT rect;
info = HeapAlloc(GetProcessHeap(), 0, sizeof(struct subclass_info));
if (!info)
return NULL;
GetClientRect(parent_wnd, &rect);
updown = CreateUpDownControl(WS_CHILD | WS_BORDER | WS_VISIBLE | UDS_ALIGNRIGHT | style,
0, 0, rect.right, rect.bottom, parent_wnd, 1, GetModuleHandleA(NULL), edit,
100, 0, 50);
if (!updown)
{
HeapFree(GetProcessHeap(), 0, info);
return NULL;
}
if (!updown) return NULL;
info->oldproc = (WNDPROC)SetWindowLongPtrA(updown, GWLP_WNDPROC,
(LONG_PTR)updown_subclass_proc);
SetWindowLongPtrA(updown, GWLP_USERDATA, (LONG_PTR)info);
oldproc = (WNDPROC)SetWindowLongPtrA(updown, GWLP_WNDPROC,
(LONG_PTR)updown_subclass_proc);
SetWindowLongPtrA(updown, GWLP_USERDATA, (LONG_PTR)oldproc);
return updown;
}
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment