wine/dlls/mshtml/task.c

99 lines
2.6 KiB
C
Raw Normal View History

/*
* Copyright 2006 Jacek Caban for CodeWeavers
*
* This library is free software; you can redistribute it and/or
* modify it under the terms of the GNU Lesser General Public
* License as published by the Free Software Foundation; either
* version 2.1 of the License, or (at your option) any later version.
*
* This library is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
* Lesser General Public License for more details.
*
* You should have received a copy of the GNU Lesser General Public
* License along with this library; if not, write to the Free Software
* Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301, USA
*/
#include "config.h"
#include <stdarg.h>
#include <stdio.h>
#define COBJMACROS
#include "windef.h"
#include "winbase.h"
#include "winuser.h"
#include "ole2.h"
#include "mshtmcid.h"
#include "wine/debug.h"
#include "mshtml_private.h"
WINE_DEFAULT_DEBUG_CHANNEL(mshtml);
#define WM_PROCESSTASK 0x8008
static LRESULT WINAPI hidden_proc(HWND hwnd, UINT msg, WPARAM wParam, LPARAM lParam)
{
if(msg > WM_USER)
FIXME("(%p %d %x %lx)\n", hwnd, msg, wParam, lParam);
return DefWindowProcW(hwnd, msg, wParam, lParam);
}
static HWND create_thread_hwnd(void)
{
static ATOM hidden_wnd_class = 0;
static const WCHAR wszInternetExplorer_Hidden[] = {'I','n','t','e','r','n','e','t',
' ','E','x','p','l','o','r','e','r','_','H','i','d','d','e','n',0};
if(!hidden_wnd_class) {
WNDCLASSEXW wndclass = {
sizeof(WNDCLASSEXW), 0,
hidden_proc,
0, 0, hInst, NULL, NULL, NULL, NULL,
wszInternetExplorer_Hidden,
NULL
};
hidden_wnd_class = RegisterClassExW(&wndclass);
}
return CreateWindowExW(0, wszInternetExplorer_Hidden, NULL, WS_POPUP,
0, 0, 0, 0, NULL, NULL, hInst, NULL);
}
HWND get_thread_hwnd(void)
{
thread_data_t *thread_data = get_thread_data(TRUE);
if(!thread_data->thread_hwnd)
thread_data->thread_hwnd = create_thread_hwnd();
return thread_data->thread_hwnd;
}
thread_data_t *get_thread_data(BOOL create)
{
thread_data_t *thread_data;
if(!mshtml_tls) {
if(create)
mshtml_tls = TlsAlloc();
else
return NULL;
}
thread_data = TlsGetValue(mshtml_tls);
if(!thread_data && create) {
thread_data = mshtml_alloc_zero(sizeof(thread_data_t));
TlsSetValue(mshtml_tls, thread_data);
}
return thread_data;
}