diff --git a/reactos/lib/user32/controls/scrollbar.c b/reactos/lib/user32/controls/scrollbar.c index f9426d8afd0..5888de8bc03 100644 --- a/reactos/lib/user32/controls/scrollbar.c +++ b/reactos/lib/user32/controls/scrollbar.c @@ -1,4 +1,4 @@ -/* $Id: scrollbar.c,v 1.15 2003/09/12 12:54:26 weiden Exp $ +/* $Id: scrollbar.c,v 1.16 2003/09/13 13:58:38 weiden Exp $ * * COPYRIGHT: See COPYING in the top level directory * PROJECT: ReactOS kernel @@ -453,7 +453,7 @@ GetScrollInfo (HWND hwnd, int fnBar, LPSCROLLINFO lpsi) SCROLLINFO si; if(!lpsi || - ((lpsi->cbSize != sizeof(SCROLLINFO)) && (lpsi->cbSize != sizeof(SCROLLINFO)))) + ((lpsi->cbSize != sizeof(SCROLLINFO)) && (lpsi->cbSize != sizeof(SCROLLINFO) - sizeof(si.nTrackPos)))) { SetLastError(ERROR_INVALID_PARAMETER); return 0; @@ -529,7 +529,8 @@ SetScrollInfo (HWND hwnd, int fnBar, LPCSCROLLINFO lpsi, WINBOOL fRedraw) { SCROLLINFO si; - if(!lpsi) + if(!lpsi || + ((lpsi->cbSize != sizeof(SCROLLINFO)) && (lpsi->cbSize != sizeof(SCROLLINFO) - sizeof(si.nTrackPos)))) { SetLastError(ERROR_INVALID_PARAMETER); return 0; diff --git a/reactos/lib/user32/windows/messagebox.c b/reactos/lib/user32/windows/messagebox.c index be78321135c..51a8a98d557 100644 --- a/reactos/lib/user32/windows/messagebox.c +++ b/reactos/lib/user32/windows/messagebox.c @@ -16,7 +16,7 @@ * along with this program; if not, write to the Free Software * Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. */ -/* $Id: messagebox.c,v 1.17 2003/08/30 18:38:08 weiden Exp $ +/* $Id: messagebox.c,v 1.18 2003/09/13 13:58:38 weiden Exp $ * * PROJECT: ReactOS user32.dll * FILE: lib/user32/windows/messagebox.c @@ -76,13 +76,8 @@ typedef UINT *LPUINT; static HWND MSGBOX_CreateButton(HWND hwnd, LONG ID, LPWSTR Caption) { - HWND btn = CreateWindowExW(0, L"BUTTON", Caption, WS_CHILD | WS_TABSTOP | WS_VISIBLE, - 0, 0, 10, 10, hwnd, 0, 0, NULL); - if(btn) - { - SetWindowLongW(btn, GWL_ID, ID); - } - return btn; + return CreateWindowExW(0, L"BUTTON", Caption, WS_CHILD | WS_TABSTOP | WS_VISIBLE, + 0, 0, 10, 10, hwnd, (HMENU)ID, 0, NULL); } static HFONT MSGBOX_OnInit(HWND hwnd, LPMSGBOXPARAMS lpmb) diff --git a/reactos/lib/user32/windows/window.c b/reactos/lib/user32/windows/window.c index fdb230c5736..7b4c2e4e2fe 100644 --- a/reactos/lib/user32/windows/window.c +++ b/reactos/lib/user32/windows/window.c @@ -1,4 +1,4 @@ -/* $Id: window.c,v 1.71 2003/08/28 13:38:23 gvg Exp $ +/* $Id: window.c,v 1.72 2003/09/13 13:58:38 weiden Exp $ * * COPYRIGHT: See COPYING in the top level directory * PROJECT: ReactOS user32.dll @@ -567,7 +567,7 @@ CreateWindowExA(DWORD dwExStyle, } } - if(!hMenu) + if(!hMenu && (dwStyle & (WS_OVERLAPPEDWINDOW | WS_POPUP))) { wce.cbSize = sizeof(WNDCLASSEXA); if(GetClassInfoExA(hInstance, lpClassName, &wce) && wce.lpszMenuName) @@ -697,7 +697,7 @@ CreateWindowExW(DWORD dwExStyle, } } - if(!hMenu) + if(!hMenu && (dwStyle & (WS_OVERLAPPEDWINDOW | WS_POPUP))) { wce.cbSize = sizeof(WNDCLASSEXW); if(GetClassInfoExW(hInstance, lpClassName, &wce) && wce.lpszMenuName) diff --git a/reactos/subsys/win32k/include/window.h b/reactos/subsys/win32k/include/window.h index 7178b32eea2..7607ed6c866 100644 --- a/reactos/subsys/win32k/include/window.h +++ b/reactos/subsys/win32k/include/window.h @@ -41,8 +41,6 @@ typedef struct _WINDOW_OBJECT DWORD ContextHelpId; /* Parent window handle. */ HWND ParentHandle; - /* Window menu handle. */ - HMENU Menu; /* system menu handle. */ HMENU SystemMenu; /* Handle of the module that created the window. */ @@ -63,7 +61,7 @@ typedef struct _WINDOW_OBJECT HANDLE Self; /* Window flags. */ ULONG Flags; - /* FIXME: Don't know. */ + /* Window menu handle or window id */ UINT IDMenu; /* Handle of region of the window to be updated. */ HANDLE UpdateRegion; diff --git a/reactos/subsys/win32k/ntuser/menu.c b/reactos/subsys/win32k/ntuser/menu.c index d40beb213d6..c7e805bcd48 100644 --- a/reactos/subsys/win32k/ntuser/menu.c +++ b/reactos/subsys/win32k/ntuser/menu.c @@ -16,7 +16,7 @@ * along with this program; if not, write to the Free Software * Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. */ -/* $Id: menu.c,v 1.29 2003/08/28 10:39:44 weiden Exp $ +/* $Id: menu.c,v 1.30 2003/09/13 13:58:38 weiden Exp $ * * COPYRIGHT: See COPYING in the top level directory * PROJECT: ReactOS kernel @@ -1341,7 +1341,7 @@ NtUserHiliteMenuItem( SetLastWin32Error(ERROR_INVALID_MENU_HANDLE); return res; } - if(WindowObject->Menu == hmenu) + if(WindowObject->IDMenu == (UINT)hmenu) { ExAcquireFastMutexUnsafe(&MenuObject->MenuItemsLock); res = IntHiliteMenuItem(WindowObject, MenuObject, uItemHilite, uHilite); diff --git a/reactos/subsys/win32k/ntuser/misc.c b/reactos/subsys/win32k/ntuser/misc.c index 9d017fa5c83..59c6b280466 100644 --- a/reactos/subsys/win32k/ntuser/misc.c +++ b/reactos/subsys/win32k/ntuser/misc.c @@ -1,4 +1,4 @@ -/* $Id: misc.c,v 1.16 2003/09/12 12:54:26 weiden Exp $ +/* $Id: misc.c,v 1.17 2003/09/13 13:58:38 weiden Exp $ * * COPYRIGHT: See COPYING in the top level directory * PROJECT: ReactOS kernel @@ -68,7 +68,7 @@ NtUserCallOneParam( return FALSE; } - Result = (DWORD)WindowObject->Menu; + Result = (DWORD)WindowObject->IDMenu; IntReleaseWindowObject(WindowObject); return Result; diff --git a/reactos/subsys/win32k/ntuser/window.c b/reactos/subsys/win32k/ntuser/window.c index 796ed70c472..b96f116aa42 100644 --- a/reactos/subsys/win32k/ntuser/window.c +++ b/reactos/subsys/win32k/ntuser/window.c @@ -16,7 +16,7 @@ * along with this program; if not, write to the Free Software * Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. */ -/* $Id: window.c,v 1.107 2003/09/07 09:55:52 weiden Exp $ +/* $Id: window.c,v 1.108 2003/09/13 13:58:38 weiden Exp $ * * COPYRIGHT: See COPYING in the top level directory * PROJECT: ReactOS kernel @@ -325,7 +325,7 @@ IntCreateDesktopWindow(PWINSTATION_OBJECT WindowStation, WindowObject->Height = Height; WindowObject->ParentHandle = NULL; WindowObject->Parent = NULL; - WindowObject->Menu = NULL; + WindowObject->IDMenu = 0; WindowObject->Instance = NULL; WindowObject->Parameters = NULL; WindowObject->Self = Handle; @@ -754,7 +754,7 @@ IntSetParent(PWINDOW_OBJECT Wnd, PWINDOW_OBJECT WndNewParent) if (!(Wnd->Style & WS_CHILD)) { //if ( Wnd->Menu ) DestroyMenu ( Wnd->menu ); - Wnd->Menu = NULL; + Wnd->IDMenu = 0; } } } @@ -1180,7 +1180,7 @@ NtUserCreateWindowEx(DWORD dwExStyle, WindowObject->Height = nHeight; WindowObject->ContextHelpId = 0; WindowObject->ParentHandle = hWndParent; - WindowObject->Menu = hMenu; + WindowObject->IDMenu = (UINT)hMenu; if(SystemMenu) WindowObject->SystemMenu = SystemMenu->Self; else @@ -2596,14 +2596,14 @@ NtUserSetMenu( return FALSE; } - WindowObject->Menu = hMenu; + WindowObject->IDMenu = (UINT)hMenu; IntReleaseMenuObject(MenuObject); } else { /* remove the menu handle */ - WindowObject->Menu = 0; + WindowObject->IDMenu = 0; } IntReleaseWindowObject(WindowObject);