[PATCH 04/18] comctl32: Extend TaskDialog, add simple callback and tests
Nikolay Sivov
bunglehead at gmail.com
Sat Feb 25 11:31:42 CST 2017
On 25.02.2017 19:01, Fabian Maurer wrote:
> +/* FIXME: Make thread safe? */
> +static const TASKDIALOGCONFIG *task_config = 0;
> +static HRESULT callback(HWND hwnd, UINT uNotification, WPARAM wParam, LPARAM lParam)
> +{
> + if(task_config->pfCallback)
> + return task_config->pfCallback(hwnd, uNotification, wParam, lParam, task_config->lpCallbackData);
> + return S_OK;
> +}
> +
> static INT_PTR CALLBACK DialogProc(HWND hwndDlg, UINT uMsg, WPARAM wParam, LPARAM lParam)
> {
> + HRESULT ret_callback;
> +
> switch (uMsg)
> {
> + case WM_INITDIALOG:
> + callback(hwndDlg, TDN_DIALOG_CONSTRUCTED, 0, 0);
> + callback(hwndDlg, TDN_CREATED, 0, 0);
> + return TRUE;
How is this going to work with global variable?
> +/* For message checking we use a simplified version from the code used for user32 messages */
> +
> +#define TDN_NO_MORE_MESSAGES 0xffffffff
> +
> +typedef struct
> +{
> + UINT msg;
> + WPARAM wparam;
> + LPARAM lparam;
> +
> + struct list entry;
> +}message_data;
> +
> +static struct list messages = LIST_INIT(messages);
> +
> +/* Message lists to test against */
> +
> +static const message_data mes_simple_show[] = {
> + { TDN_DIALOG_CONSTRUCTED, 0, 0 },
> + { TDN_CREATED, 0, 0 },
> + { TDN_BUTTON_CLICKED, IDOK, 0 },
> + { TDN_DESTROYED, 0, 0 },
> + { TDN_NO_MORE_MESSAGES }
> +};
> +
> +/* Functions handling message processing */
> +
> +static void message_add(UINT msg, WPARAM wparam, LPARAM lparam)
> +{
> + message_data *data = HeapAlloc(GetProcessHeap(), 0, sizeof(message_data));
> +
> + data->msg = msg;
> + data->wparam = wparam;
> + data->lparam = lparam;
> +
> + list_add_tail(&messages, &data->entry);
> +}
> +
> +#define ok_sequence(exp ) \
> + ok_sequence_((exp), __FILE__, __LINE__)
> +
> +static void ok_sequence_(const message_data *expected_list, const char *file, int line)
> +{
> + message_data *message;
> + BOOL dump = FALSE;
> + UINT count;
> +
For that please use msg.h from comctl32/tests.
More information about the wine-devel
mailing list