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
583d246a
Commit
583d246a
authored
Sep 20, 2017
by
Fabian Maurer
Committed by
Alexandre Julliard
Sep 20, 2017
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
comctl32/taskdialog: Initial support for callback procedure.
Signed-off-by:
Nikolay Sivov
<
nsivov@codeweavers.com
>
Signed-off-by:
Alexandre Julliard
<
julliard@winehq.org
>
parent
4a280916
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
75 additions
and
3 deletions
+75
-3
taskdialog.c
dlls/comctl32/taskdialog.c
+52
-3
taskdialog.c
dlls/comctl32/tests/taskdialog.c
+23
-0
No files found.
dlls/comctl32/taskdialog.c
View file @
583d246a
...
...
@@ -80,6 +80,13 @@ struct taskdialog_button_desc
HINSTANCE
hinst
;
};
struct
taskdialog_info
{
HWND
hwnd
;
PFTASKDIALOGCALLBACK
callback
;
LONG_PTR
callback_data
;
};
static
void
pixels_to_dialogunits
(
const
struct
taskdialog_template_desc
*
desc
,
LONG
*
width
,
LONG
*
height
)
{
if
(
width
)
...
...
@@ -482,20 +489,54 @@ static DLGTEMPLATE *create_taskdialog_template(const TASKDIALOGCONFIG *taskconfi
return
template
;
}
static
HRESULT
taskdialog_notify
(
struct
taskdialog_info
*
dialog_info
,
UINT
notification
,
WPARAM
wparam
,
LPARAM
lparam
)
{
return
dialog_info
->
callback
?
dialog_info
->
callback
(
dialog_info
->
hwnd
,
notification
,
wparam
,
lparam
,
dialog_info
->
callback_data
)
:
S_OK
;
}
static
void
taskdialog_on_button_click
(
struct
taskdialog_info
*
dialog_info
,
WORD
command_id
)
{
if
(
taskdialog_notify
(
dialog_info
,
TDN_BUTTON_CLICKED
,
command_id
,
0
)
==
S_OK
)
EndDialog
(
dialog_info
->
hwnd
,
command_id
);
}
static
INT_PTR
CALLBACK
taskdialog_proc
(
HWND
hwnd
,
UINT
msg
,
WPARAM
wParam
,
LPARAM
lParam
)
{
static
const
WCHAR
taskdialog_info_propnameW
[]
=
{
'T'
,
'a'
,
's'
,
'k'
,
'D'
,
'i'
,
'a'
,
'l'
,
'o'
,
'g'
,
'I'
,
'n'
,
'f'
,
'o'
,
0
};
struct
taskdialog_info
*
dialog_info
;
TRACE
(
"hwnd=%p msg=0x%04x wparam=%lx lparam=%lx
\n
"
,
hwnd
,
msg
,
wParam
,
lParam
);
if
(
msg
!=
WM_INITDIALOG
)
dialog_info
=
GetPropW
(
hwnd
,
taskdialog_info_propnameW
);
switch
(
msg
)
{
case
TDM_CLICK_BUTTON
:
taskdialog_on_button_click
(
dialog_info
,
LOWORD
(
wParam
));
break
;
case
WM_INITDIALOG
:
dialog_info
=
(
struct
taskdialog_info
*
)
lParam
;
dialog_info
->
hwnd
=
hwnd
;
SetPropW
(
hwnd
,
taskdialog_info_propnameW
,
dialog_info
);
taskdialog_notify
(
dialog_info
,
TDN_DIALOG_CONSTRUCTED
,
0
,
0
);
break
;
case
WM_SHOWWINDOW
:
taskdialog_notify
(
dialog_info
,
TDN_CREATED
,
0
,
0
);
break
;
case
WM_COMMAND
:
if
(
HIWORD
(
wParam
)
==
BN_CLICKED
)
{
WORD
command_id
=
LOWORD
(
wParam
);
EndDialog
(
hwnd
,
command_id
);
taskdialog_on_button_click
(
dialog_info
,
LOWORD
(
wParam
));
return
TRUE
;
}
break
;
case
WM_DESTROY
:
taskdialog_notify
(
dialog_info
,
TDN_DESTROYED
,
0
,
0
);
RemovePropW
(
hwnd
,
taskdialog_info_propnameW
);
break
;
}
return
FALSE
;
}
...
...
@@ -506,13 +547,21 @@ static INT_PTR CALLBACK taskdialog_proc(HWND hwnd, UINT msg, WPARAM wParam, LPAR
HRESULT
WINAPI
TaskDialogIndirect
(
const
TASKDIALOGCONFIG
*
taskconfig
,
int
*
button
,
int
*
radio_button
,
BOOL
*
verification_flag_checked
)
{
struct
taskdialog_info
dialog_info
;
DLGTEMPLATE
*
template
;
INT
ret
;
TRACE
(
"%p, %p, %p, %p
\n
"
,
taskconfig
,
button
,
radio_button
,
verification_flag_checked
);
if
(
!
taskconfig
||
taskconfig
->
cbSize
!=
sizeof
(
TASKDIALOGCONFIG
))
return
E_INVALIDARG
;
dialog_info
.
callback
=
taskconfig
->
pfCallback
;
dialog_info
.
callback_data
=
taskconfig
->
lpCallbackData
;
template
=
create_taskdialog_template
(
taskconfig
);
ret
=
DialogBoxIndirectParamW
(
taskconfig
->
hInstance
,
template
,
taskconfig
->
hwndParent
,
taskdialog_proc
,
0
);
ret
=
DialogBoxIndirectParamW
(
taskconfig
->
hInstance
,
template
,
taskconfig
->
hwndParent
,
taskdialog_proc
,
(
LPARAM
)
&
dialog_info
);
Free
(
template
);
if
(
button
)
*
button
=
ret
;
...
...
dlls/comctl32/tests/taskdialog.c
View file @
583d246a
...
...
@@ -31,6 +31,27 @@ static HRESULT (WINAPI *pTaskDialogIndirect)(const TASKDIALOGCONFIG *, int *, in
static
HRESULT
(
WINAPI
*
pTaskDialog
)(
HWND
,
HINSTANCE
,
const
WCHAR
*
,
const
WCHAR
*
,
const
WCHAR
*
,
TASKDIALOG_COMMON_BUTTON_FLAGS
,
const
WCHAR
*
,
int
*
);
static
void
test_invalid_parameters
(
void
)
{
TASKDIALOGCONFIG
info
=
{
0
};
HRESULT
hr
;
hr
=
pTaskDialogIndirect
(
NULL
,
NULL
,
NULL
,
NULL
);
ok
(
hr
==
E_INVALIDARG
,
"Unexpected return value %#x.
\n
"
,
hr
);
info
.
cbSize
=
0
;
hr
=
pTaskDialogIndirect
(
&
info
,
NULL
,
NULL
,
NULL
);
ok
(
hr
==
E_INVALIDARG
,
"Unexpected return value %#x.
\n
"
,
hr
);
info
.
cbSize
=
sizeof
(
TASKDIALOGCONFIG
)
-
1
;
hr
=
pTaskDialogIndirect
(
&
info
,
NULL
,
NULL
,
NULL
);
ok
(
hr
==
E_INVALIDARG
,
"Unexpected return value %#x.
\n
"
,
hr
);
info
.
cbSize
=
sizeof
(
TASKDIALOGCONFIG
)
+
1
;
hr
=
pTaskDialogIndirect
(
&
info
,
NULL
,
NULL
,
NULL
);
ok
(
hr
==
E_INVALIDARG
,
"Unexpected return value %#x.
\n
"
,
hr
);
}
START_TEST
(
taskdialog
)
{
ULONG_PTR
ctx_cookie
;
...
...
@@ -62,5 +83,7 @@ START_TEST(taskdialog)
ok
(
pTaskDialogIndirect
==
ptr_ordinal
,
"got wrong pointer for ordinal 345, %p expected %p
\n
"
,
ptr_ordinal
,
pTaskDialogIndirect
);
test_invalid_parameters
();
unload_v6_module
(
ctx_cookie
,
hCtx
);
}
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