diff --git a/dlls/atl/atl.spec b/dlls/atl/atl.spec index 1a167a77065..5b31804e67e 100644 --- a/dlls/atl/atl.spec +++ b/dlls/atl/atl.spec @@ -33,7 +33,7 @@ 39 stdcall AtlAxCreateControl(ptr ptr ptr ptr) atl100.AtlAxCreateControl 40 stdcall AtlAxCreateControlEx(ptr ptr ptr ptr ptr ptr ptr) atl100.AtlAxCreateControlEx 41 stdcall AtlAxAttachControl(ptr ptr ptr) atl100.AtlAxAttachControl -42 stdcall AtlAxWinInit() atl100.AtlAxWinInit +42 stdcall AtlAxWinInit() 43 stdcall AtlModuleAddCreateWndData(ptr ptr ptr) 44 stdcall AtlModuleExtractCreateWndData(ptr) 45 stdcall AtlModuleRegisterWndClassInfoW(ptr ptr ptr) diff --git a/dlls/atl/atl_main.c b/dlls/atl/atl_main.c index 2a9636906f9..cc3cce1a3cf 100644 --- a/dlls/atl/atl_main.c +++ b/dlls/atl/atl_main.c @@ -584,3 +584,51 @@ DWORD WINAPI AtlGetVersion(void *pReserved) { return _ATL_VER; } + +/********************************************************************** + * AtlAxWin class window procedure + */ +static LRESULT CALLBACK AtlAxWin_wndproc( HWND hWnd, UINT wMsg, WPARAM wParam, LPARAM lParam ) +{ + if ( wMsg == WM_CREATE ) + { + DWORD len = GetWindowTextLengthW( hWnd ) + 1; + WCHAR *ptr = HeapAlloc( GetProcessHeap(), 0, len*sizeof(WCHAR) ); + if (!ptr) + return 1; + GetWindowTextW( hWnd, ptr, len ); + AtlAxCreateControlEx( ptr, hWnd, NULL, NULL, NULL, NULL, NULL ); + HeapFree( GetProcessHeap(), 0, ptr ); + return 0; + } + return DefWindowProcW( hWnd, wMsg, wParam, lParam ); +} + +BOOL WINAPI AtlAxWinInit(void) +{ + WNDCLASSEXW wcex; + const WCHAR AtlAxWin[] = {'A','t','l','A','x','W','i','n',0}; + + FIXME("semi-stub\n"); + + if ( FAILED( OleInitialize(NULL) ) ) + return FALSE; + + wcex.cbSize = sizeof(wcex); + wcex.style = CS_GLOBALCLASS; + wcex.cbClsExtra = 0; + wcex.cbWndExtra = 0; + wcex.hInstance = GetModuleHandleW( NULL ); + wcex.hIcon = NULL; + wcex.hCursor = NULL; + wcex.hbrBackground = NULL; + wcex.lpszMenuName = NULL; + wcex.hIconSm = 0; + + wcex.lpfnWndProc = AtlAxWin_wndproc; + wcex.lpszClassName = AtlAxWin; + if ( !RegisterClassExW( &wcex ) ) + return FALSE; + + return TRUE; +} diff --git a/dlls/atl/tests/atl_ax.c b/dlls/atl/tests/atl_ax.c index 4555bd6053e..ea9ce321a1d 100644 --- a/dlls/atl/tests/atl_ax.c +++ b/dlls/atl/tests/atl_ax.c @@ -35,6 +35,7 @@ #include #include #include +#include static HRESULT (WINAPI *pAtlAxAttachControl)(IUnknown *, HWND, IUnknown **); @@ -114,6 +115,24 @@ static void test_AtlAxAttachControl(void) DestroyWindow(hwnd); } +static void test_ax_win(void) +{ + BOOL ret; + WNDCLASSEXW wcex; + static const WCHAR AtlAxWin[] = {'A','t','l','A','x','W','i','n',0}; + static HMODULE hinstance = 0; + + ret = AtlAxWinInit(); + ok(ret, "AtlAxWinInit failed\n"); + + hinstance = GetModuleHandleA(NULL); + memset(&wcex, 0, sizeof(wcex)); + wcex.cbSize = sizeof(wcex); + ret = GetClassInfoExW(hinstance, AtlAxWin, &wcex); + ok(ret, "AtlAxWin has not registered\n"); + ok(wcex.style == CS_GLOBALCLASS, "wcex.style %08x\n", wcex.style); +} + START_TEST(atl_ax) { init_function_pointers(); @@ -128,5 +147,7 @@ START_TEST(atl_ax) else win_skip("AtlAxAttachControl is not available\n"); + test_ax_win(); + CoUninitialize(); }