Skip to content
Projects
Groups
Snippets
Help
This project
Loading...
Sign in / Register
Toggle navigation
W
wine-winehq
Project
Project
Details
Activity
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Issues
0
Issues
0
List
Board
Labels
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Charts
Registry
Registry
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
wine
wine-winehq
Commits
2dd2eafd
Commit
2dd2eafd
authored
Jun 09, 2006
by
Dmitry Timoshkov
Committed by
Alexandre Julliard
Jun 09, 2006
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
user: Neither WS_CAPTION nor WS_EX_APPWINDOW has anything to do how
passed in to CreateWindow menu should be handled.
parent
f80db874
Show whitespace changes
Inline
Side-by-side
Showing
3 changed files
with
141 additions
and
3 deletions
+141
-3
menu.c
dlls/user/menu.c
+7
-1
win.c
dlls/user/tests/win.c
+133
-0
win.c
dlls/user/win.c
+1
-2
No files found.
dlls/user/menu.c
View file @
2dd2eafd
...
...
@@ -4337,7 +4337,13 @@ HMENU WINAPI LoadMenuIndirectA( LPCVOID template )
BOOL
WINAPI
IsMenu
(
HMENU
hmenu
)
{
LPPOPUPMENU
menu
=
MENU_GetMenu
(
hmenu
);
return
menu
!=
NULL
;
if
(
!
menu
)
{
SetLastError
(
ERROR_INVALID_MENU_HANDLE
);
return
FALSE
;
}
return
TRUE
;
}
/**********************************************************************
...
...
dlls/user/tests/win.c
View file @
2dd2eafd
...
...
@@ -3604,6 +3604,138 @@ static void test_IsWindowUnicode(void)
DestroyWindow
(
hwnd
);
}
static
void
test_CreateWindow
(
void
)
{
HWND
hwnd
,
parent
;
HMENU
hmenu
;
#define expect_menu(window, menu) \
SetLastError(0xdeadbeef); \
ok(GetMenu(window) == (HMENU)menu, "GetMenu error %ld\n", GetLastError())
#define expect_style(window, style)\
ok(GetWindowLong(window, GWL_STYLE) == (style), "expected style %lx != %lx\n", (long)(style), GetWindowLong(window, GWL_STYLE))
#define expect_ex_style(window, ex_style)\
ok(GetWindowLong(window, GWL_EXSTYLE) == (ex_style), "expected ex_style %lx != %lx\n", (long)(ex_style), GetWindowLong(window, GWL_EXSTYLE))
hmenu
=
CreateMenu
();
assert
(
hmenu
!=
0
);
parent
=
GetDesktopWindow
();
assert
(
parent
!=
0
);
SetLastError
(
0xdeadbeef
);
ok
(
IsMenu
(
hmenu
),
"IsMenu error %ld
\n
"
,
GetLastError
());
SetLastError
(
0xdeadbeef
);
hwnd
=
CreateWindowEx
(
WS_EX_APPWINDOW
,
"static"
,
NULL
,
WS_CHILD
,
0
,
0
,
100
,
100
,
parent
,
(
HMENU
)
1
,
0
,
NULL
);
ok
(
hwnd
!=
0
,
"CreateWindowEx error %ld
\n
"
,
GetLastError
());
expect_menu
(
hwnd
,
1
);
expect_style
(
hwnd
,
WS_CHILD
);
expect_ex_style
(
hwnd
,
WS_EX_APPWINDOW
);
DestroyWindow
(
hwnd
);
SetLastError
(
0xdeadbeef
);
hwnd
=
CreateWindowEx
(
WS_EX_APPWINDOW
,
"static"
,
NULL
,
WS_CHILD
|
WS_CAPTION
,
0
,
0
,
100
,
100
,
parent
,
(
HMENU
)
1
,
0
,
NULL
);
ok
(
hwnd
!=
0
,
"CreateWindowEx error %ld
\n
"
,
GetLastError
());
expect_menu
(
hwnd
,
1
);
expect_style
(
hwnd
,
WS_CHILD
|
WS_CAPTION
);
expect_ex_style
(
hwnd
,
WS_EX_APPWINDOW
|
WS_EX_WINDOWEDGE
);
DestroyWindow
(
hwnd
);
SetLastError
(
0xdeadbeef
);
hwnd
=
CreateWindowEx
(
0
,
"static"
,
NULL
,
WS_CHILD
,
0
,
0
,
100
,
100
,
parent
,
(
HMENU
)
1
,
0
,
NULL
);
ok
(
hwnd
!=
0
,
"CreateWindowEx error %ld
\n
"
,
GetLastError
());
expect_menu
(
hwnd
,
1
);
expect_style
(
hwnd
,
WS_CHILD
);
expect_ex_style
(
hwnd
,
0
);
DestroyWindow
(
hwnd
);
SetLastError
(
0xdeadbeef
);
hwnd
=
CreateWindowEx
(
0
,
"static"
,
NULL
,
WS_CHILD
|
WS_CAPTION
,
0
,
0
,
100
,
100
,
parent
,
(
HMENU
)
1
,
0
,
NULL
);
ok
(
hwnd
!=
0
,
"CreateWindowEx error %ld
\n
"
,
GetLastError
());
expect_menu
(
hwnd
,
1
);
expect_style
(
hwnd
,
WS_CHILD
|
WS_CAPTION
);
expect_ex_style
(
hwnd
,
WS_EX_WINDOWEDGE
);
DestroyWindow
(
hwnd
);
SetLastError
(
0xdeadbeef
);
hwnd
=
CreateWindowEx
(
WS_EX_APPWINDOW
,
"static"
,
NULL
,
WS_POPUP
,
0
,
0
,
100
,
100
,
parent
,
hmenu
,
0
,
NULL
);
ok
(
hwnd
!=
0
,
"CreateWindowEx error %ld
\n
"
,
GetLastError
());
expect_menu
(
hwnd
,
hmenu
);
expect_style
(
hwnd
,
WS_POPUP
|
WS_CLIPSIBLINGS
);
expect_ex_style
(
hwnd
,
WS_EX_APPWINDOW
);
DestroyWindow
(
hwnd
);
SetLastError
(
0xdeadbeef
);
ok
(
!
IsMenu
(
hmenu
),
"IsMenu should fail
\n
"
);
ok
(
GetLastError
()
==
ERROR_INVALID_MENU_HANDLE
,
"IsMenu set error %ld
\n
"
,
GetLastError
());
hmenu
=
CreateMenu
();
assert
(
hmenu
!=
0
);
SetLastError
(
0xdeadbeef
);
hwnd
=
CreateWindowEx
(
WS_EX_APPWINDOW
,
"static"
,
NULL
,
WS_POPUP
|
WS_CAPTION
,
0
,
0
,
100
,
100
,
parent
,
hmenu
,
0
,
NULL
);
ok
(
hwnd
!=
0
,
"CreateWindowEx error %ld
\n
"
,
GetLastError
());
expect_menu
(
hwnd
,
hmenu
);
expect_style
(
hwnd
,
WS_POPUP
|
WS_CAPTION
|
WS_CLIPSIBLINGS
);
expect_ex_style
(
hwnd
,
WS_EX_APPWINDOW
|
WS_EX_WINDOWEDGE
);
DestroyWindow
(
hwnd
);
SetLastError
(
0xdeadbeef
);
ok
(
!
IsMenu
(
hmenu
),
"IsMenu should fail
\n
"
);
ok
(
GetLastError
()
==
ERROR_INVALID_MENU_HANDLE
,
"IsMenu set error %ld
\n
"
,
GetLastError
());
hmenu
=
CreateMenu
();
assert
(
hmenu
!=
0
);
SetLastError
(
0xdeadbeef
);
hwnd
=
CreateWindowEx
(
WS_EX_APPWINDOW
,
"static"
,
NULL
,
WS_POPUP
,
0
,
0
,
100
,
100
,
parent
,
hmenu
,
0
,
NULL
);
ok
(
hwnd
!=
0
,
"CreateWindowEx error %ld
\n
"
,
GetLastError
());
expect_menu
(
hwnd
,
hmenu
);
expect_style
(
hwnd
,
WS_POPUP
|
WS_CLIPSIBLINGS
);
expect_ex_style
(
hwnd
,
WS_EX_APPWINDOW
);
DestroyWindow
(
hwnd
);
SetLastError
(
0xdeadbeef
);
ok
(
!
IsMenu
(
hmenu
),
"IsMenu should fail
\n
"
);
ok
(
GetLastError
()
==
ERROR_INVALID_MENU_HANDLE
,
"IsMenu set error %ld
\n
"
,
GetLastError
());
hmenu
=
CreateMenu
();
assert
(
hmenu
!=
0
);
SetLastError
(
0xdeadbeef
);
hwnd
=
CreateWindowEx
(
0
,
"static"
,
NULL
,
WS_POPUP
|
WS_CAPTION
,
0
,
0
,
100
,
100
,
parent
,
hmenu
,
0
,
NULL
);
ok
(
hwnd
!=
0
,
"CreateWindowEx error %ld
\n
"
,
GetLastError
());
expect_menu
(
hwnd
,
hmenu
);
expect_style
(
hwnd
,
WS_POPUP
|
WS_CAPTION
|
WS_CLIPSIBLINGS
);
expect_ex_style
(
hwnd
,
WS_EX_WINDOWEDGE
);
DestroyWindow
(
hwnd
);
SetLastError
(
0xdeadbeef
);
ok
(
!
IsMenu
(
hmenu
),
"IsMenu should fail
\n
"
);
ok
(
GetLastError
()
==
ERROR_INVALID_MENU_HANDLE
,
"IsMenu set error %ld
\n
"
,
GetLastError
());
hmenu
=
CreateMenu
();
assert
(
hmenu
!=
0
);
SetLastError
(
0xdeadbeef
);
hwnd
=
CreateWindowEx
(
0
,
"static"
,
NULL
,
WS_POPUP
,
0
,
0
,
100
,
100
,
parent
,
hmenu
,
0
,
NULL
);
ok
(
hwnd
!=
0
,
"CreateWindowEx error %ld
\n
"
,
GetLastError
());
expect_menu
(
hwnd
,
hmenu
);
expect_style
(
hwnd
,
WS_POPUP
|
WS_CLIPSIBLINGS
);
expect_ex_style
(
hwnd
,
0
);
DestroyWindow
(
hwnd
);
SetLastError
(
0xdeadbeef
);
ok
(
!
IsMenu
(
hmenu
),
"IsMenu should fail
\n
"
);
ok
(
GetLastError
()
==
ERROR_INVALID_MENU_HANDLE
,
"IsMenu set error %ld
\n
"
,
GetLastError
());
#undef expect_menu
#undef expect_style
#undef expect_ex_style
}
START_TEST
(
win
)
{
pGetAncestor
=
(
void
*
)
GetProcAddress
(
GetModuleHandleA
(
"user32.dll"
),
"GetAncestor"
);
...
...
@@ -3651,6 +3783,7 @@ START_TEST(win)
test_capture_2
();
test_capture_3
(
hwndMain
,
hwndMain2
);
test_CreateWindow
();
test_parent_owner
();
test_SetParent
();
test_shell_window
();
...
...
dlls/user/win.c
View file @
2dd2eafd
...
...
@@ -1037,8 +1037,7 @@ static HWND WIN_CreateWindowEx( CREATESTRUCTA *cs, ATOM classAtom, UINT flags )
/* Set the window menu */
if
(((
wndPtr
->
dwStyle
&
(
WS_CAPTION
|
WS_CHILD
))
==
WS_CAPTION
)
||
(
wndPtr
->
dwExStyle
&
WS_EX_APPWINDOW
))
if
(
!
(
wndPtr
->
dwStyle
&
WS_CHILD
))
{
if
(
cs
->
hMenu
)
{
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment