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
2e9c40d5
Commit
2e9c40d5
authored
Aug 22, 2022
by
Jacek Caban
Committed by
Alexandre Julliard
Aug 25, 2022
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
user32: Support passing bitmap and icon resource ID as a string when creating static control.
parent
f28824eb
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
50 additions
and
6 deletions
+50
-6
static.c
dlls/user32/static.c
+32
-6
static.c
dlls/user32/tests/static.c
+18
-0
No files found.
dlls/user32/static.c
View file @
2e9c40d5
...
@@ -418,22 +418,48 @@ LRESULT StaticWndProc_common( HWND hwnd, UINT uMsg, WPARAM wParam, LPARAM lParam
...
@@ -418,22 +418,48 @@ LRESULT StaticWndProc_common( HWND hwnd, UINT uMsg, WPARAM wParam, LPARAM lParam
switch
(
style
)
{
switch
(
style
)
{
case
SS_ICON
:
case
SS_ICON
:
{
{
const
WCHAR
*
name
=
cs
->
lpszName
;
HICON
hIcon
;
HICON
hIcon
;
if
(
unicode
||
IS_INTRESOURCE
(
cs
->
lpszName
))
hIcon
=
STATIC_LoadIconW
(
cs
->
hInstance
,
cs
->
lpszName
,
full_style
);
if
(
!
unicode
)
{
const
char
*
nameA
=
(
const
char
*
)
name
;
if
(
nameA
&&
nameA
[
0
]
==
'\xff'
)
name
=
MAKEINTRESOURCEW
(
MAKEWORD
(
nameA
[
1
],
nameA
[
2
]));
}
else
if
(
name
&&
name
[
0
]
==
0xffff
)
{
name
=
MAKEINTRESOURCEW
(
name
[
1
]);
}
if
(
unicode
||
IS_INTRESOURCE
(
name
))
hIcon
=
STATIC_LoadIconW
(
cs
->
hInstance
,
name
,
full_style
);
else
else
hIcon
=
STATIC_LoadIconA
(
cs
->
hInstance
,
(
LPCSTR
)
cs
->
lpszN
ame
,
full_style
);
hIcon
=
STATIC_LoadIconA
(
cs
->
hInstance
,
(
const
char
*
)
n
ame
,
full_style
);
STATIC_SetIcon
(
hwnd
,
hIcon
,
full_style
);
STATIC_SetIcon
(
hwnd
,
hIcon
,
full_style
);
}
}
break
;
break
;
case
SS_BITMAP
:
case
SS_BITMAP
:
if
((
ULONG_PTR
)
cs
->
hInstance
>>
16
)
if
((
ULONG_PTR
)
cs
->
hInstance
>>
16
)
{
{
const
WCHAR
*
name
=
cs
->
lpszName
;
HBITMAP
hBitmap
;
HBITMAP
hBitmap
;
if
(
unicode
||
IS_INTRESOURCE
(
cs
->
lpszName
))
hBitmap
=
LoadBitmapW
(
cs
->
hInstance
,
cs
->
lpszName
);
if
(
!
unicode
)
{
const
char
*
nameA
=
(
const
char
*
)
name
;
if
(
nameA
&&
nameA
[
0
]
==
'\xff'
)
name
=
MAKEINTRESOURCEW
(
MAKEWORD
(
nameA
[
1
],
nameA
[
2
]));
}
else
if
(
name
&&
name
[
0
]
==
0xffff
)
{
name
=
MAKEINTRESOURCEW
(
name
[
1
]);
}
if
(
unicode
||
IS_INTRESOURCE
(
name
))
hBitmap
=
LoadBitmapW
(
cs
->
hInstance
,
name
);
else
else
hBitmap
=
LoadBitmapA
(
cs
->
hInstance
,
(
LPCSTR
)
cs
->
lpszN
ame
);
hBitmap
=
LoadBitmapA
(
cs
->
hInstance
,
(
const
char
*
)
n
ame
);
STATIC_SetBitmap
(
hwnd
,
hBitmap
,
full_style
);
STATIC_SetBitmap
(
hwnd
,
hBitmap
,
full_style
);
}
}
break
;
break
;
...
...
dlls/user32/tests/static.c
View file @
2e9c40d5
...
@@ -197,6 +197,24 @@ static void test_set_image(void)
...
@@ -197,6 +197,24 @@ static void test_set_image(void)
DestroyWindow
(
hwnd
);
DestroyWindow
(
hwnd
);
DeleteObject
(
image
);
DeleteObject
(
image
);
hwnd
=
CreateWindowW
(
L"static"
,
L"\uffff
\x65
"
,
WS_VISIBLE
|
WS_CHILD
|
SS_BITMAP
,
5
,
5
,
100
,
100
,
hMainWnd
,
(
HMENU
)
CTRL_ID
,
GetModuleHandleW
(
NULL
),
0
);
bmp
=
(
HBITMAP
)
SendMessageW
(
hwnd
,
STM_GETIMAGE
,
IMAGE_BITMAP
,
0
);
ok
(
bmp
!=
NULL
,
"got NULL
\n
"
);
test_image
(
bmp
);
DestroyWindow
(
hwnd
);
hwnd
=
CreateWindowA
(
"static"
,
"
\xff\x65\0
"
,
WS_VISIBLE
|
WS_CHILD
|
SS_BITMAP
,
5
,
5
,
100
,
100
,
hMainWnd
,
(
HMENU
)
CTRL_ID
,
GetModuleHandleW
(
NULL
),
0
);
bmp
=
(
HBITMAP
)
SendMessageW
(
hwnd
,
STM_GETIMAGE
,
IMAGE_BITMAP
,
0
);
ok
(
bmp
!=
NULL
,
"got NULL
\n
"
);
test_image
(
bmp
);
DestroyWindow
(
hwnd
);
}
}
static
void
test_STM_SETIMAGE
(
void
)
static
void
test_STM_SETIMAGE
(
void
)
...
...
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