atl: Implement AtlAxWinInit and AtlAxWin window procedure.
[wine/wine64.git] / dlls / atl / atl_ax.c
blob660e001aab42fdd5c2c8ba41576ac445525ce67a
1 /*
2 * Active Template Library ActiveX functions (atl.dll)
4 * Copyright 2006 Andrey Turkin
6 * This library is free software; you can redistribute it and/or
7 * modify it under the terms of the GNU Lesser General Public
8 * License as published by the Free Software Foundation; either
9 * version 2.1 of the License, or (at your option) any later version.
11 * This library is distributed in the hope that it will be useful,
12 * but WITHOUT ANY WARRANTY; without even the implied warranty of
13 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
14 * Lesser General Public License for more details.
16 * You should have received a copy of the GNU Lesser General Public
17 * License along with this library; if not, write to the Free Software
18 * Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301, USA
21 #include <stdarg.h>
22 #include <stdio.h>
24 #define COBJMACROS
26 #include "windef.h"
27 #include "winbase.h"
28 #include "winuser.h"
29 #include "winerror.h"
30 #include "winuser.h"
31 #include "wine/debug.h"
32 #include "objbase.h"
33 #include "objidl.h"
34 #include "ole2.h"
35 #include "exdisp.h"
36 #include "atlbase.h"
37 #include "atliface.h"
38 #include "atlwin.h"
40 #include "wine/unicode.h"
42 WINE_DEFAULT_DEBUG_CHANNEL(atl);
44 /**********************************************************************
45 * AtlAxWin class window procedure
47 LRESULT static CALLBACK AtlAxWin_wndproc( HWND hWnd, UINT wMsg, WPARAM wParam, LPARAM lParam )
49 if ( wMsg == WM_CREATE )
51 DWORD len = GetWindowTextLengthW( hWnd ) + 1;
52 WCHAR *ptr = HeapAlloc( GetProcessHeap(), 0, len*sizeof(WCHAR) );
53 if (!ptr)
54 return 1;
55 GetWindowTextW( hWnd, ptr, len );
56 AtlAxCreateControl( ptr, hWnd, NULL, NULL );
57 HeapFree( GetProcessHeap(), 0, ptr );
58 return 0;
60 return DefWindowProcW( hWnd, wMsg, wParam, lParam );
63 /***********************************************************************
64 * AtlAxWinInit [ATL.@]
65 * Initializes the control-hosting code: registering the AtlAxWin,
66 * AtlAxWin7 and AtlAxWinLic7 window classes and some messages.
68 * RETURNS
69 * TRUE or FALSE
72 BOOL WINAPI AtlAxWinInit(void)
74 WNDCLASSEXW wcex;
75 const WCHAR AtlAxWin[] = {'A','t','l','A','x','W','i','n',0};
77 FIXME("semi-stub\n");
79 if ( FAILED( OleInitialize(NULL) ) )
80 return FALSE;
82 wcex.cbSize = sizeof(wcex);
83 wcex.style = 0;
84 wcex.cbClsExtra = 0;
85 wcex.cbWndExtra = 0;
86 wcex.hInstance = GetModuleHandleW( NULL );
87 wcex.hIcon = NULL;
88 wcex.hCursor = NULL;
89 wcex.hbrBackground = NULL;
90 wcex.lpszMenuName = NULL;
91 wcex.hIconSm = 0;
93 wcex.lpfnWndProc = AtlAxWin_wndproc;
94 wcex.lpszClassName = AtlAxWin;
95 if ( !RegisterClassExW( &wcex ) )
96 return FALSE;
98 return TRUE;