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
30 #include "wine/debug.h"
31 #include "wine/heap.h"
36 #include "wine/atlbase.h"
38 #include "wine/atlwin.h"
41 #include "wine/unicode.h"
43 WINE_DEFAULT_DEBUG_CHANNEL(atl
);
46 IOleClientSite IOleClientSite_iface
;
47 IOleContainer IOleContainer_iface
;
48 IOleInPlaceSiteWindowless IOleInPlaceSiteWindowless_iface
;
49 IOleInPlaceFrame IOleInPlaceFrame_iface
;
50 IOleControlSite IOleControlSite_iface
;
57 BOOL fActive
, fInPlace
, fWindowless
;
60 static const WCHAR wine_atl_iocsW
[] = {'_','_','W','I','N','E','_','A','T','L','_','I','O','C','S','\0'};
62 /**********************************************************************
63 * AtlAxWin class window procedure
65 static LRESULT CALLBACK
AtlAxWin_wndproc( HWND hWnd
, UINT wMsg
, WPARAM wParam
, LPARAM lParam
)
67 if ( wMsg
== WM_CREATE
)
69 DWORD len
= GetWindowTextLengthW( hWnd
) + 1;
70 WCHAR
*ptr
= HeapAlloc( GetProcessHeap(), 0, len
*sizeof(WCHAR
) );
73 GetWindowTextW( hWnd
, ptr
, len
);
74 AtlAxCreateControlEx( ptr
, hWnd
, NULL
, NULL
, NULL
, NULL
, NULL
);
75 HeapFree( GetProcessHeap(), 0, ptr
);
78 return DefWindowProcW( hWnd
, wMsg
, wParam
, lParam
);
81 /***********************************************************************
82 * AtlAxWinInit [atl100.@]
83 * Initializes the control-hosting code: registering the AtlAxWin,
84 * AtlAxWin7 and AtlAxWinLic7 window classes and some messages.
90 BOOL WINAPI
AtlAxWinInit(void)
94 #if _ATL_VER <= _ATL_VER_30
95 #define ATL_NAME_SUFFIX 0
96 #elif _ATL_VER == _ATL_VER_80
97 #define ATL_NAME_SUFFIX '8','0',0
98 #elif _ATL_VER == _ATL_VER_90
99 #define ATL_NAME_SUFFIX '9','0',0
100 #elif _ATL_VER == _ATL_VER_100
101 #define ATL_NAME_SUFFIX '1','0','0',0
102 #elif _ATL_VER == _ATL_VER_110
103 #define ATL_NAME_SUFFIX '1','1','0',0
105 #error Unsupported version
108 static const WCHAR AtlAxWinW
[] = {'A','t','l','A','x','W','i','n',ATL_NAME_SUFFIX
};
110 FIXME("version %04x semi-stub\n", _ATL_VER
);
112 if ( FAILED( OleInitialize(NULL
) ) )
115 wcex
.cbSize
= sizeof(wcex
);
116 wcex
.style
= CS_GLOBALCLASS
| (_ATL_VER
> _ATL_VER_30
? CS_DBLCLKS
: 0);
119 wcex
.hInstance
= GetModuleHandleW( NULL
);
122 wcex
.hbrBackground
= NULL
;
123 wcex
.lpszMenuName
= NULL
;
126 wcex
.lpfnWndProc
= AtlAxWin_wndproc
;
127 wcex
.lpszClassName
= AtlAxWinW
;
128 if ( !RegisterClassExW( &wcex
) )
131 if(_ATL_VER
> _ATL_VER_30
) {
132 static const WCHAR AtlAxWinLicW
[] = {'A','t','l','A','x','W','i','n','L','i','c',ATL_NAME_SUFFIX
};
134 wcex
.lpszClassName
= AtlAxWinLicW
;
135 if ( !RegisterClassExW( &wcex
) )
142 /***********************************************************************
143 * Atl container component implementation
146 /****** IOleClientSite *****/
147 static inline IOCS
*impl_from_IOleClientSite(IOleClientSite
*iface
)
149 return CONTAINING_RECORD(iface
, IOCS
, IOleClientSite_iface
);
152 static HRESULT
IOCS_Detach( IOCS
*This
) /* remove subclassing */
156 SetWindowLongPtrW( This
->hWnd
, GWLP_WNDPROC
, (ULONG_PTR
) This
->OrigWndProc
);
157 RemovePropW( This
->hWnd
, wine_atl_iocsW
);
162 IOleObject
*control
= This
->control
;
164 This
->control
= NULL
;
165 IOleObject_Close( control
, OLECLOSE_NOSAVE
);
166 IOleObject_SetClientSite( control
, NULL
);
167 IOleObject_Release( control
);
172 static HRESULT WINAPI
OleClientSite_QueryInterface(IOleClientSite
*iface
, REFIID riid
, void **ppv
)
174 IOCS
*This
= impl_from_IOleClientSite(iface
);
176 TRACE("(%p)->(%s %p)\n", This
, debugstr_guid(riid
), ppv
);
180 if (IsEqualIID(&IID_IUnknown
, riid
) ||
181 IsEqualIID(&IID_IOleClientSite
, riid
))
185 else if (IsEqualIID(&IID_IOleContainer
, riid
))
187 *ppv
= &This
->IOleContainer_iface
;
189 else if (IsEqualIID(&IID_IOleInPlaceSite
, riid
) ||
190 IsEqualIID(&IID_IOleInPlaceSiteEx
, riid
) ||
191 IsEqualIID(&IID_IOleInPlaceSiteWindowless
, riid
))
193 *ppv
= &This
->IOleInPlaceSiteWindowless_iface
;
195 else if (IsEqualIID(&IID_IOleInPlaceFrame
, riid
))
197 *ppv
= &This
->IOleInPlaceFrame_iface
;
199 else if (IsEqualIID(&IID_IOleControlSite
, riid
))
201 *ppv
= &This
->IOleControlSite_iface
;
206 IOleClientSite_AddRef(iface
);
210 WARN("unsupported interface %s\n", debugstr_guid(riid
));
211 return E_NOINTERFACE
;
214 static ULONG WINAPI
OleClientSite_AddRef(IOleClientSite
*iface
)
216 IOCS
*This
= impl_from_IOleClientSite(iface
);
217 ULONG ref
= InterlockedIncrement(&This
->ref
);
218 TRACE("(%p)->(%d)\n", This
, ref
);
222 static ULONG WINAPI
OleClientSite_Release(IOleClientSite
*iface
)
224 IOCS
*This
= impl_from_IOleClientSite(iface
);
225 ULONG ref
= InterlockedDecrement(&This
->ref
);
227 TRACE("(%p)->(%d)\n", This
, ref
);
232 HeapFree( GetProcessHeap(), 0, This
);
238 static HRESULT WINAPI
OleClientSite_SaveObject(IOleClientSite
*iface
)
240 IOCS
*This
= impl_from_IOleClientSite(iface
);
241 FIXME( "(%p) - stub\n", This
);
245 static HRESULT WINAPI
OleClientSite_GetMoniker(IOleClientSite
*iface
, DWORD dwAssign
, DWORD dwWhichMoniker
, IMoniker
**ppmk
)
247 IOCS
*This
= impl_from_IOleClientSite(iface
);
249 FIXME( "(%p, 0x%x, 0x%x, %p)\n", This
, dwAssign
, dwWhichMoniker
, ppmk
);
253 static HRESULT WINAPI
OleClientSite_GetContainer(IOleClientSite
*iface
, IOleContainer
**container
)
255 IOCS
*This
= impl_from_IOleClientSite(iface
);
256 TRACE("(%p, %p)\n", This
, container
);
257 return IOleClientSite_QueryInterface(iface
, &IID_IOleContainer
, (void**)container
);
260 static HRESULT WINAPI
OleClientSite_ShowObject(IOleClientSite
*iface
)
262 IOCS
*This
= impl_from_IOleClientSite(iface
);
263 FIXME( "(%p) - stub\n", This
);
267 static HRESULT WINAPI
OleClientSite_OnShowWindow(IOleClientSite
*iface
, BOOL fShow
)
269 IOCS
*This
= impl_from_IOleClientSite(iface
);
270 FIXME( "(%p, %s) - stub\n", This
, fShow
? "TRUE" : "FALSE" );
274 static HRESULT WINAPI
OleClientSite_RequestNewObjectLayout(IOleClientSite
*iface
)
276 IOCS
*This
= impl_from_IOleClientSite(iface
);
277 FIXME( "(%p) - stub\n", This
);
282 /****** IOleContainer *****/
283 static inline IOCS
*impl_from_IOleContainer(IOleContainer
*iface
)
285 return CONTAINING_RECORD(iface
, IOCS
, IOleContainer_iface
);
288 static HRESULT WINAPI
OleContainer_QueryInterface( IOleContainer
* iface
, REFIID riid
, void** ppv
)
290 IOCS
*This
= impl_from_IOleContainer(iface
);
291 return IOleClientSite_QueryInterface(&This
->IOleClientSite_iface
, riid
, ppv
);
294 static ULONG WINAPI
OleContainer_AddRef(IOleContainer
* iface
)
296 IOCS
*This
= impl_from_IOleContainer(iface
);
297 return IOleClientSite_AddRef(&This
->IOleClientSite_iface
);
300 static ULONG WINAPI
OleContainer_Release(IOleContainer
* iface
)
302 IOCS
*This
= impl_from_IOleContainer(iface
);
303 return IOleClientSite_Release(&This
->IOleClientSite_iface
);
306 static HRESULT WINAPI
OleContainer_ParseDisplayName(IOleContainer
* iface
, IBindCtx
* pbc
,
307 LPOLESTR pszDisplayName
, ULONG
* pchEaten
, IMoniker
** ppmkOut
)
309 IOCS
*This
= impl_from_IOleContainer(iface
);
310 FIXME( "(%p,%p,%s,%p,%p) - stub\n", This
, pbc
, debugstr_w(pszDisplayName
), pchEaten
, ppmkOut
);
314 static HRESULT WINAPI
OleContainer_EnumObjects(IOleContainer
* iface
, DWORD grfFlags
, IEnumUnknown
** ppenum
)
316 IOCS
*This
= impl_from_IOleContainer(iface
);
317 FIXME( "(%p, %u, %p) - stub\n", This
, grfFlags
, ppenum
);
321 static HRESULT WINAPI
OleContainer_LockContainer(IOleContainer
* iface
, BOOL fLock
)
323 IOCS
*This
= impl_from_IOleContainer(iface
);
324 FIXME( "(%p, %s) - stub\n", This
, fLock
?"TRUE":"FALSE" );
329 /****** IOleInPlaceSiteWindowless *******/
330 static inline IOCS
*impl_from_IOleInPlaceSiteWindowless(IOleInPlaceSiteWindowless
*iface
)
332 return CONTAINING_RECORD(iface
, IOCS
, IOleInPlaceSiteWindowless_iface
);
335 static HRESULT WINAPI
OleInPlaceSiteWindowless_QueryInterface(IOleInPlaceSiteWindowless
*iface
, REFIID riid
, void **ppv
)
337 IOCS
*This
= impl_from_IOleInPlaceSiteWindowless(iface
);
338 return IOleClientSite_QueryInterface(&This
->IOleClientSite_iface
, riid
, ppv
);
341 static ULONG WINAPI
OleInPlaceSiteWindowless_AddRef(IOleInPlaceSiteWindowless
*iface
)
343 IOCS
*This
= impl_from_IOleInPlaceSiteWindowless(iface
);
344 return IOleClientSite_AddRef(&This
->IOleClientSite_iface
);
347 static ULONG WINAPI
OleInPlaceSiteWindowless_Release(IOleInPlaceSiteWindowless
*iface
)
349 IOCS
*This
= impl_from_IOleInPlaceSiteWindowless(iface
);
350 return IOleClientSite_Release(&This
->IOleClientSite_iface
);
353 static HRESULT WINAPI
OleInPlaceSiteWindowless_GetWindow(IOleInPlaceSiteWindowless
* iface
, HWND
* phwnd
)
355 IOCS
*This
= impl_from_IOleInPlaceSiteWindowless(iface
);
357 TRACE("(%p,%p)\n", This
, phwnd
);
362 static HRESULT WINAPI
OleInPlaceSiteWindowless_ContextSensitiveHelp(IOleInPlaceSiteWindowless
* iface
, BOOL fEnterMode
)
364 IOCS
*This
= impl_from_IOleInPlaceSiteWindowless(iface
);
365 FIXME("(%p,%d) - stub\n", This
, fEnterMode
);
369 static HRESULT WINAPI
OleInPlaceSiteWindowless_CanInPlaceActivate(IOleInPlaceSiteWindowless
*iface
)
371 IOCS
*This
= impl_from_IOleInPlaceSiteWindowless(iface
);
372 TRACE("(%p)\n", This
);
376 static HRESULT WINAPI
OleInPlaceSiteWindowless_OnInPlaceActivate(IOleInPlaceSiteWindowless
*iface
)
378 IOCS
*This
= impl_from_IOleInPlaceSiteWindowless(iface
);
380 TRACE("(%p)\n", This
);
382 This
->fInPlace
= TRUE
;
386 static HRESULT WINAPI
OleInPlaceSiteWindowless_OnUIActivate(IOleInPlaceSiteWindowless
*iface
)
388 IOCS
*This
= impl_from_IOleInPlaceSiteWindowless(iface
);
390 TRACE("(%p)\n", This
);
394 static HRESULT WINAPI
OleInPlaceSiteWindowless_GetWindowContext(IOleInPlaceSiteWindowless
*iface
,
395 IOleInPlaceFrame
**frame
, IOleInPlaceUIWindow
**ppDoc
, LPRECT lprcPosRect
,
396 LPRECT lprcClipRect
, LPOLEINPLACEFRAMEINFO lpFrameInfo
)
398 IOCS
*This
= impl_from_IOleInPlaceSiteWindowless(iface
);
400 TRACE("(%p,%p,%p,%p,%p,%p)\n", This
, frame
, ppDoc
, lprcPosRect
, lprcClipRect
, lpFrameInfo
);
403 *lprcClipRect
= This
->size
;
405 *lprcPosRect
= This
->size
;
409 *frame
= &This
->IOleInPlaceFrame_iface
;
410 IOleInPlaceFrame_AddRef(*frame
);
418 lpFrameInfo
->fMDIApp
= FALSE
;
419 lpFrameInfo
->hwndFrame
= This
->hWnd
;
420 lpFrameInfo
->haccel
= NULL
;
421 lpFrameInfo
->cAccelEntries
= 0;
427 static HRESULT WINAPI
OleInPlaceSiteWindowless_Scroll(IOleInPlaceSiteWindowless
*iface
, SIZE scrollExtent
)
429 IOCS
*This
= impl_from_IOleInPlaceSiteWindowless(iface
);
430 FIXME("(%p) - stub\n", This
);
434 static HRESULT WINAPI
OleInPlaceSiteWindowless_OnUIDeactivate(IOleInPlaceSiteWindowless
*iface
, BOOL fUndoable
)
436 IOCS
*This
= impl_from_IOleInPlaceSiteWindowless(iface
);
437 FIXME("(%p,%d) - stub\n", This
, fUndoable
);
441 static HRESULT WINAPI
OleInPlaceSiteWindowless_OnInPlaceDeactivate(IOleInPlaceSiteWindowless
*iface
)
443 IOCS
*This
= impl_from_IOleInPlaceSiteWindowless(iface
);
445 TRACE("(%p)\n", This
);
447 This
->fInPlace
= This
->fWindowless
= FALSE
;
451 static HRESULT WINAPI
OleInPlaceSiteWindowless_DiscardUndoState(IOleInPlaceSiteWindowless
*iface
)
453 IOCS
*This
= impl_from_IOleInPlaceSiteWindowless(iface
);
454 FIXME("(%p) - stub\n", This
);
458 static HRESULT WINAPI
OleInPlaceSiteWindowless_DeactivateAndUndo(IOleInPlaceSiteWindowless
*iface
)
460 IOCS
*This
= impl_from_IOleInPlaceSiteWindowless(iface
);
461 FIXME("(%p) - stub\n", This
);
465 static HRESULT WINAPI
OleInPlaceSiteWindowless_OnPosRectChange(IOleInPlaceSiteWindowless
*iface
, LPCRECT lprcPosRect
)
467 IOCS
*This
= impl_from_IOleInPlaceSiteWindowless(iface
);
468 FIXME("(%p,%p) - stub\n", This
, lprcPosRect
);
472 static HRESULT WINAPI
OleInPlaceSiteWindowless_OnInPlaceActivateEx( IOleInPlaceSiteWindowless
*iface
, BOOL
* pfNoRedraw
, DWORD dwFlags
)
474 IOCS
*This
= impl_from_IOleInPlaceSiteWindowless(iface
);
478 This
->fActive
= This
->fInPlace
= TRUE
;
479 if ( dwFlags
& ACTIVATE_WINDOWLESS
)
480 This
->fWindowless
= TRUE
;
484 static HRESULT WINAPI
OleInPlaceSiteWindowless_OnInPlaceDeactivateEx( IOleInPlaceSiteWindowless
*iface
, BOOL fNoRedraw
)
486 IOCS
*This
= impl_from_IOleInPlaceSiteWindowless(iface
);
490 This
->fActive
= This
->fInPlace
= This
->fWindowless
= FALSE
;
493 static HRESULT WINAPI
OleInPlaceSiteWindowless_RequestUIActivate( IOleInPlaceSiteWindowless
*iface
)
498 static HRESULT WINAPI
OleInPlaceSiteWindowless_CanWindowlessActivate( IOleInPlaceSiteWindowless
*iface
)
503 static HRESULT WINAPI
OleInPlaceSiteWindowless_GetCapture( IOleInPlaceSiteWindowless
*iface
)
508 static HRESULT WINAPI
OleInPlaceSiteWindowless_SetCapture( IOleInPlaceSiteWindowless
*iface
, BOOL fCapture
)
513 static HRESULT WINAPI
OleInPlaceSiteWindowless_GetFocus( IOleInPlaceSiteWindowless
*iface
)
518 static HRESULT WINAPI
OleInPlaceSiteWindowless_SetFocus( IOleInPlaceSiteWindowless
*iface
, BOOL fFocus
)
523 static HRESULT WINAPI
OleInPlaceSiteWindowless_GetDC( IOleInPlaceSiteWindowless
*iface
, LPCRECT pRect
, DWORD grfFlags
, HDC
* phDC
)
528 static HRESULT WINAPI
OleInPlaceSiteWindowless_ReleaseDC( IOleInPlaceSiteWindowless
*iface
, HDC hDC
)
533 static HRESULT WINAPI
OleInPlaceSiteWindowless_InvalidateRect( IOleInPlaceSiteWindowless
*iface
, LPCRECT pRect
, BOOL fErase
)
538 static HRESULT WINAPI
OleInPlaceSiteWindowless_InvalidateRgn( IOleInPlaceSiteWindowless
*iface
, HRGN hRGN
, BOOL fErase
)
543 static HRESULT WINAPI
OleInPlaceSiteWindowless_ScrollRect( IOleInPlaceSiteWindowless
*iface
, INT dx
, INT dy
, LPCRECT pRectScroll
, LPCRECT pRectClip
)
548 static HRESULT WINAPI
OleInPlaceSiteWindowless_AdjustRect( IOleInPlaceSiteWindowless
*iface
, LPRECT prc
)
553 static HRESULT WINAPI
OleInPlaceSiteWindowless_OnDefWindowMessage( IOleInPlaceSiteWindowless
*iface
, UINT msg
, WPARAM wParam
, LPARAM lParam
, LRESULT
* plResult
)
560 /****** IOleInPlaceFrame *******/
561 static inline IOCS
*impl_from_IOleInPlaceFrame(IOleInPlaceFrame
*iface
)
563 return CONTAINING_RECORD(iface
, IOCS
, IOleInPlaceFrame_iface
);
566 static HRESULT WINAPI
OleInPlaceFrame_QueryInterface(IOleInPlaceFrame
*iface
, REFIID riid
, void **ppv
)
568 IOCS
*This
= impl_from_IOleInPlaceFrame(iface
);
569 return IOleClientSite_QueryInterface(&This
->IOleClientSite_iface
, riid
, ppv
);
572 static ULONG WINAPI
OleInPlaceFrame_AddRef(IOleInPlaceFrame
*iface
)
574 IOCS
*This
= impl_from_IOleInPlaceFrame(iface
);
575 return IOleClientSite_AddRef(&This
->IOleClientSite_iface
);
578 static ULONG WINAPI
OleInPlaceFrame_Release(IOleInPlaceFrame
*iface
)
580 IOCS
*This
= impl_from_IOleInPlaceFrame(iface
);
581 return IOleClientSite_Release(&This
->IOleClientSite_iface
);
584 static HRESULT WINAPI
OleInPlaceFrame_GetWindow(IOleInPlaceFrame
*iface
, HWND
*phWnd
)
586 IOCS
*This
= impl_from_IOleInPlaceFrame(iface
);
588 TRACE( "(%p,%p)\n", This
, phWnd
);
594 static HRESULT WINAPI
OleInPlaceFrame_ContextSensitiveHelp(IOleInPlaceFrame
*iface
, BOOL fEnterMode
)
596 IOCS
*This
= impl_from_IOleInPlaceFrame(iface
);
598 FIXME( "(%p,%d) - stub\n", This
, fEnterMode
);
602 static HRESULT WINAPI
OleInPlaceFrame_GetBorder(IOleInPlaceFrame
*iface
, LPRECT lprectBorder
)
604 IOCS
*This
= impl_from_IOleInPlaceFrame(iface
);
606 FIXME( "(%p,%p) - stub\n", This
, lprectBorder
);
610 static HRESULT WINAPI
OleInPlaceFrame_RequestBorderSpace(IOleInPlaceFrame
*iface
, LPCBORDERWIDTHS pborderwidths
)
612 IOCS
*This
= impl_from_IOleInPlaceFrame(iface
);
614 FIXME( "(%p,%p) - stub\n", This
, pborderwidths
);
618 static HRESULT WINAPI
OleInPlaceFrame_SetBorderSpace(IOleInPlaceFrame
*iface
, LPCBORDERWIDTHS pborderwidths
)
620 IOCS
*This
= impl_from_IOleInPlaceFrame(iface
);
622 FIXME( "(%p,%p) - stub\n", This
, pborderwidths
);
626 static HRESULT WINAPI
OleInPlaceFrame_SetActiveObject(IOleInPlaceFrame
*iface
, IOleInPlaceActiveObject
*pActiveObject
, LPCOLESTR pszObjName
)
628 IOCS
*This
= impl_from_IOleInPlaceFrame(iface
);
630 FIXME( "(%p,%p,%s) - stub\n", This
, pActiveObject
, debugstr_w(pszObjName
) );
634 static HRESULT WINAPI
OleInPlaceFrame_InsertMenus(IOleInPlaceFrame
*iface
, HMENU hmenuShared
, LPOLEMENUGROUPWIDTHS lpMenuWidths
)
636 IOCS
*This
= impl_from_IOleInPlaceFrame(iface
);
638 FIXME( "(%p,%p,%p) - stub\n", This
, hmenuShared
, lpMenuWidths
);
642 static HRESULT WINAPI
OleInPlaceFrame_SetMenu(IOleInPlaceFrame
*iface
, HMENU hmenuShared
, HOLEMENU holemenu
, HWND hwndActiveObject
)
644 IOCS
*This
= impl_from_IOleInPlaceFrame(iface
);
646 FIXME( "(%p,%p,%p,%p) - stub\n", This
, hmenuShared
, holemenu
, hwndActiveObject
);
650 static HRESULT WINAPI
OleInPlaceFrame_RemoveMenus(IOleInPlaceFrame
*iface
, HMENU hmenuShared
)
652 IOCS
*This
= impl_from_IOleInPlaceFrame(iface
);
654 FIXME( "(%p, %p) - stub\n", This
, hmenuShared
);
658 static HRESULT WINAPI
OleInPlaceFrame_SetStatusText(IOleInPlaceFrame
*iface
, LPCOLESTR pszStatusText
)
660 IOCS
*This
= impl_from_IOleInPlaceFrame(iface
);
662 FIXME( "(%p, %s) - stub\n", This
, debugstr_w( pszStatusText
) );
666 static HRESULT WINAPI
OleInPlaceFrame_EnableModeless(IOleInPlaceFrame
*iface
, BOOL fEnable
)
668 IOCS
*This
= impl_from_IOleInPlaceFrame(iface
);
670 FIXME( "(%p, %d) - stub\n", This
, fEnable
);
674 static HRESULT WINAPI
OleInPlaceFrame_TranslateAccelerator(IOleInPlaceFrame
*iface
, LPMSG lpmsg
, WORD wID
)
676 IOCS
*This
= impl_from_IOleInPlaceFrame(iface
);
678 FIXME( "(%p, %p, %x) - stub\n", This
, lpmsg
, wID
);
683 /****** IOleControlSite *******/
684 static inline IOCS
*impl_from_IOleControlSite(IOleControlSite
*iface
)
686 return CONTAINING_RECORD(iface
, IOCS
, IOleControlSite_iface
);
689 static HRESULT WINAPI
OleControlSite_QueryInterface(IOleControlSite
*iface
, REFIID riid
, void **ppv
)
691 IOCS
*This
= impl_from_IOleControlSite(iface
);
692 return IOleClientSite_QueryInterface(&This
->IOleClientSite_iface
, riid
, ppv
);
695 static ULONG WINAPI
OleControlSite_AddRef(IOleControlSite
*iface
)
697 IOCS
*This
= impl_from_IOleControlSite(iface
);
698 return IOleClientSite_AddRef(&This
->IOleClientSite_iface
);
701 static ULONG WINAPI
OleControlSite_Release(IOleControlSite
*iface
)
703 IOCS
*This
= impl_from_IOleControlSite(iface
);
704 return IOleClientSite_Release(&This
->IOleClientSite_iface
);
707 static HRESULT WINAPI
OleControlSite_OnControlInfoChanged( IOleControlSite
* This
)
712 static HRESULT WINAPI
OleControlSite_LockInPlaceActive( IOleControlSite
* This
, BOOL fLock
)
717 static HRESULT WINAPI
OleControlSite_GetExtendedControl( IOleControlSite
* This
, IDispatch
** ppDisp
)
722 static HRESULT WINAPI
OleControlSite_TransformCoords( IOleControlSite
* This
, POINTL
* pPtlHimetric
, POINTF
* pPtfContainer
, DWORD dwFlags
)
727 static HRESULT WINAPI
OleControlSite_TranslateAccelerator( IOleControlSite
* This
, MSG
* pMsg
, DWORD grfModifiers
)
732 static HRESULT WINAPI
OleControlSite_OnFocus( IOleControlSite
* This
, BOOL fGotFocus
)
737 static HRESULT WINAPI
OleControlSite_ShowPropertyFrame( IOleControlSite
* This
)
744 static const IOleClientSiteVtbl OleClientSite_vtbl
= {
745 OleClientSite_QueryInterface
,
746 OleClientSite_AddRef
,
747 OleClientSite_Release
,
748 OleClientSite_SaveObject
,
749 OleClientSite_GetMoniker
,
750 OleClientSite_GetContainer
,
751 OleClientSite_ShowObject
,
752 OleClientSite_OnShowWindow
,
753 OleClientSite_RequestNewObjectLayout
755 static const IOleContainerVtbl OleContainer_vtbl
= {
756 OleContainer_QueryInterface
,
758 OleContainer_Release
,
759 OleContainer_ParseDisplayName
,
760 OleContainer_EnumObjects
,
761 OleContainer_LockContainer
763 static const IOleInPlaceSiteWindowlessVtbl OleInPlaceSiteWindowless_vtbl
= {
764 OleInPlaceSiteWindowless_QueryInterface
,
765 OleInPlaceSiteWindowless_AddRef
,
766 OleInPlaceSiteWindowless_Release
,
767 OleInPlaceSiteWindowless_GetWindow
,
768 OleInPlaceSiteWindowless_ContextSensitiveHelp
,
769 OleInPlaceSiteWindowless_CanInPlaceActivate
,
770 OleInPlaceSiteWindowless_OnInPlaceActivate
,
771 OleInPlaceSiteWindowless_OnUIActivate
,
772 OleInPlaceSiteWindowless_GetWindowContext
,
773 OleInPlaceSiteWindowless_Scroll
,
774 OleInPlaceSiteWindowless_OnUIDeactivate
,
775 OleInPlaceSiteWindowless_OnInPlaceDeactivate
,
776 OleInPlaceSiteWindowless_DiscardUndoState
,
777 OleInPlaceSiteWindowless_DeactivateAndUndo
,
778 OleInPlaceSiteWindowless_OnPosRectChange
,
779 OleInPlaceSiteWindowless_OnInPlaceActivateEx
,
780 OleInPlaceSiteWindowless_OnInPlaceDeactivateEx
,
781 OleInPlaceSiteWindowless_RequestUIActivate
,
782 OleInPlaceSiteWindowless_CanWindowlessActivate
,
783 OleInPlaceSiteWindowless_GetCapture
,
784 OleInPlaceSiteWindowless_SetCapture
,
785 OleInPlaceSiteWindowless_GetFocus
,
786 OleInPlaceSiteWindowless_SetFocus
,
787 OleInPlaceSiteWindowless_GetDC
,
788 OleInPlaceSiteWindowless_ReleaseDC
,
789 OleInPlaceSiteWindowless_InvalidateRect
,
790 OleInPlaceSiteWindowless_InvalidateRgn
,
791 OleInPlaceSiteWindowless_ScrollRect
,
792 OleInPlaceSiteWindowless_AdjustRect
,
793 OleInPlaceSiteWindowless_OnDefWindowMessage
795 static const IOleInPlaceFrameVtbl OleInPlaceFrame_vtbl
=
797 OleInPlaceFrame_QueryInterface
,
798 OleInPlaceFrame_AddRef
,
799 OleInPlaceFrame_Release
,
800 OleInPlaceFrame_GetWindow
,
801 OleInPlaceFrame_ContextSensitiveHelp
,
802 OleInPlaceFrame_GetBorder
,
803 OleInPlaceFrame_RequestBorderSpace
,
804 OleInPlaceFrame_SetBorderSpace
,
805 OleInPlaceFrame_SetActiveObject
,
806 OleInPlaceFrame_InsertMenus
,
807 OleInPlaceFrame_SetMenu
,
808 OleInPlaceFrame_RemoveMenus
,
809 OleInPlaceFrame_SetStatusText
,
810 OleInPlaceFrame_EnableModeless
,
811 OleInPlaceFrame_TranslateAccelerator
813 static const IOleControlSiteVtbl OleControlSite_vtbl
=
815 OleControlSite_QueryInterface
,
816 OleControlSite_AddRef
,
817 OleControlSite_Release
,
818 OleControlSite_OnControlInfoChanged
,
819 OleControlSite_LockInPlaceActive
,
820 OleControlSite_GetExtendedControl
,
821 OleControlSite_TransformCoords
,
822 OleControlSite_TranslateAccelerator
,
823 OleControlSite_OnFocus
,
824 OleControlSite_ShowPropertyFrame
827 static void IOCS_OnSize( IOCS
* This
, LPCRECT rect
)
833 if ( !This
->control
)
836 inPix
.cx
= rect
->right
- rect
->left
;
837 inPix
.cy
= rect
->bottom
- rect
->top
;
838 AtlPixelToHiMetric( &inPix
, &inHi
);
839 IOleObject_SetExtent( This
->control
, DVASPECT_CONTENT
, &inHi
);
841 if ( This
->fInPlace
)
843 IOleInPlaceObject
*wl
;
845 if ( SUCCEEDED( IOleObject_QueryInterface( This
->control
, &IID_IOleInPlaceObject
, (void**)&wl
) ) )
847 IOleInPlaceObject_SetObjectRects( wl
, rect
, rect
);
848 IOleInPlaceObject_Release( wl
);
853 static void IOCS_OnShow( IOCS
*This
, BOOL fShow
)
855 if (!This
->control
|| This
->fActive
|| !fShow
)
858 This
->fActive
= TRUE
;
861 static void IOCS_OnDraw( IOCS
*This
)
865 if ( !This
->control
|| !This
->fWindowless
)
868 if ( SUCCEEDED( IOleObject_QueryInterface( This
->control
, &IID_IViewObject
, (void**)&view
) ) )
870 HDC dc
= GetDC( This
->hWnd
);
873 rect
.left
= This
->size
.left
; rect
.top
= This
->size
.top
;
874 rect
.bottom
= This
->size
.bottom
; rect
.right
= This
->size
.right
;
876 IViewObject_Draw( view
, DVASPECT_CONTENT
, ~0, NULL
, NULL
, 0, dc
, &rect
, &rect
, NULL
, 0 );
877 IViewObject_Release( view
);
878 ReleaseDC( This
->hWnd
, dc
);
882 static LRESULT
IOCS_OnWndProc( IOCS
*This
, HWND hWnd
, UINT uMsg
, WPARAM wParam
, LPARAM lParam
)
884 WNDPROC OrigWndProc
= This
->OrigWndProc
;
894 SetRect(&r
, 0, 0, LOWORD(lParam
), HIWORD(lParam
));
895 IOCS_OnSize( This
, &r
);
899 IOCS_OnShow( This
, (BOOL
) wParam
);
906 return CallWindowProcW( OrigWndProc
, hWnd
, uMsg
, wParam
, lParam
);
909 static LRESULT CALLBACK
AtlHost_wndproc( HWND hWnd
, UINT wMsg
, WPARAM wParam
, LPARAM lParam
)
911 IOCS
*This
= (IOCS
*) GetPropW( hWnd
, wine_atl_iocsW
);
912 return IOCS_OnWndProc( This
, hWnd
, wMsg
, wParam
, lParam
);
915 static HRESULT
IOCS_Attach( IOCS
*This
, HWND hWnd
, IUnknown
*pUnkControl
) /* subclass hWnd */
918 IUnknown_QueryInterface( pUnkControl
, &IID_IOleObject
, (void**)&This
->control
);
919 IOleObject_SetClientSite( This
->control
, &This
->IOleClientSite_iface
);
920 SetPropW( hWnd
, wine_atl_iocsW
, This
);
921 This
->OrigWndProc
= (WNDPROC
)SetWindowLongPtrW( hWnd
, GWLP_WNDPROC
, (ULONG_PTR
) AtlHost_wndproc
);
926 static HRESULT
IOCS_Init( IOCS
*This
)
929 static const WCHAR AXWIN
[] = {'A','X','W','I','N',0};
931 IOleObject_SetHostNames( This
->control
, AXWIN
, AXWIN
);
933 GetClientRect( This
->hWnd
, &rect
);
934 IOCS_OnSize( This
, &rect
);
935 IOleObject_DoVerb( This
->control
, OLEIVERB_INPLACEACTIVATE
, NULL
, &This
->IOleClientSite_iface
,
936 0, This
->hWnd
, &rect
);
941 /**********************************************************************
942 * Create new instance of Atl host component and attach it to window *
944 static HRESULT
IOCS_Create( HWND hWnd
, IUnknown
*pUnkControl
, IUnknown
**container
)
953 This
= HeapAlloc(GetProcessHeap(), 0, sizeof(IOCS
));
956 return E_OUTOFMEMORY
;
958 This
->IOleClientSite_iface
.lpVtbl
= &OleClientSite_vtbl
;
959 This
->IOleContainer_iface
.lpVtbl
= &OleContainer_vtbl
;
960 This
->IOleInPlaceSiteWindowless_iface
.lpVtbl
= &OleInPlaceSiteWindowless_vtbl
;
961 This
->IOleInPlaceFrame_iface
.lpVtbl
= &OleInPlaceFrame_vtbl
;
962 This
->IOleControlSite_iface
.lpVtbl
= &OleControlSite_vtbl
;
965 This
->OrigWndProc
= NULL
;
967 This
->fWindowless
= This
->fActive
= This
->fInPlace
= FALSE
;
969 hr
= IOCS_Attach( This
, hWnd
, pUnkControl
);
970 if ( SUCCEEDED( hr
) )
971 hr
= IOCS_Init( This
);
972 if ( SUCCEEDED( hr
) )
973 *container
= (IUnknown
*)&This
->IOleClientSite_iface
;
977 HeapFree(GetProcessHeap(), 0, This
);
984 /***********************************************************************
985 * AtlAxCreateControl [atl100.@]
987 HRESULT WINAPI
AtlAxCreateControl(LPCOLESTR lpszName
, HWND hWnd
,
988 IStream
*pStream
, IUnknown
**ppUnkContainer
)
990 return AtlAxCreateControlEx( lpszName
, hWnd
, pStream
, ppUnkContainer
,
1003 static enum content
get_content_type(LPCOLESTR name
, CLSID
*control_id
)
1005 static const WCHAR mshtml_prefixW
[] = {'m','s','h','t','m','l',':',0};
1006 WCHAR new_urlW
[MAX_PATH
];
1007 DWORD size
= MAX_PATH
;
1009 if (!name
|| !name
[0])
1011 WARN("name %s\n", wine_dbgstr_w(name
));
1015 if (CLSIDFromString(name
, control_id
) == S_OK
||
1016 CLSIDFromProgID(name
, control_id
) == S_OK
)
1019 if (PathIsURLW (name
) ||
1020 UrlApplySchemeW(name
, new_urlW
, &size
, URL_APPLY_GUESSSCHEME
|URL_APPLY_GUESSFILE
) == S_OK
)
1022 *control_id
= CLSID_WebBrowser
;
1026 if (!strncmpiW(name
, mshtml_prefixW
, 7))
1028 FIXME("mshtml prefix not implemented\n");
1029 *control_id
= CLSID_WebBrowser
;
1036 /***********************************************************************
1037 * AtlAxCreateControlLicEx [atl100.@]
1040 * See http://www.codeproject.com/com/cwebpage.asp for some background
1043 HRESULT WINAPI
AtlAxCreateControlLicEx(LPCOLESTR lpszName
, HWND hWnd
,
1044 IStream
*pStream
, IUnknown
**ppUnkContainer
, IUnknown
**ppUnkControl
,
1045 REFIID iidSink
, IUnknown
*punkSink
, BSTR lic
)
1049 IOleObject
*pControl
;
1050 IUnknown
*pUnkControl
= NULL
;
1051 IPersistStreamInit
*pPSInit
;
1052 IUnknown
*pContainer
= NULL
;
1053 enum content content
;
1055 TRACE("(%s %p %p %p %p %p %p %s)\n", debugstr_w(lpszName
), hWnd
, pStream
,
1056 ppUnkContainer
, ppUnkControl
, iidSink
, punkSink
, debugstr_w(lic
));
1059 FIXME("semi stub\n");
1061 if (ppUnkContainer
) *ppUnkContainer
= NULL
;
1062 if (ppUnkControl
) *ppUnkControl
= NULL
;
1064 content
= get_content_type(lpszName
, &controlId
);
1066 if (content
== IsEmpty
)
1069 if (content
== IsUnknown
)
1070 return CO_E_CLASSSTRING
;
1072 hRes
= CoCreateInstance( &controlId
, 0, CLSCTX_ALL
, &IID_IOleObject
,
1073 (void**) &pControl
);
1074 if ( FAILED( hRes
) )
1076 WARN( "cannot create ActiveX control %s instance - error 0x%08x\n",
1077 debugstr_guid( &controlId
), hRes
);
1081 hRes
= IOleObject_QueryInterface( pControl
, &IID_IPersistStreamInit
, (void**) &pPSInit
);
1082 if ( SUCCEEDED( hRes
) )
1085 IPersistStreamInit_InitNew( pPSInit
);
1087 IPersistStreamInit_Load( pPSInit
, pStream
);
1088 IPersistStreamInit_Release( pPSInit
);
1090 WARN("cannot get IID_IPersistStreamInit out of control\n");
1092 IOleObject_QueryInterface( pControl
, &IID_IUnknown
, (void**) &pUnkControl
);
1093 IOleObject_Release( pControl
);
1096 hRes
= AtlAxAttachControl( pUnkControl
, hWnd
, &pContainer
);
1097 if ( FAILED( hRes
) )
1098 WARN("cannot attach control to window\n");
1100 if ( content
== IsURL
)
1102 IWebBrowser2
*browser
;
1104 hRes
= IOleObject_QueryInterface( pControl
, &IID_IWebBrowser2
, (void**) &browser
);
1106 WARN( "Cannot query IWebBrowser2 interface: %08x\n", hRes
);
1110 IWebBrowser2_put_Visible( browser
, VARIANT_TRUE
); /* it seems that native does this on URL (but do not on MSHTML:! why? */
1112 V_VT(&url
) = VT_BSTR
;
1113 V_BSTR(&url
) = SysAllocString( lpszName
);
1115 hRes
= IWebBrowser2_Navigate2( browser
, &url
, NULL
, NULL
, NULL
, NULL
);
1116 if ( FAILED( hRes
) )
1117 WARN( "IWebBrowser2::Navigate2 failed: %08x\n", hRes
);
1118 SysFreeString( V_BSTR(&url
) );
1120 IWebBrowser2_Release( browser
);
1126 *ppUnkContainer
= pContainer
;
1128 IUnknown_AddRef( pContainer
);
1132 *ppUnkControl
= pUnkControl
;
1134 IUnknown_AddRef( pUnkControl
);
1138 IUnknown_Release( pUnkControl
);
1140 IUnknown_Release( pContainer
);
1145 /***********************************************************************
1146 * AtlAxAttachControl [atl100.@]
1148 HRESULT WINAPI
AtlAxAttachControl(IUnknown
*control
, HWND hWnd
, IUnknown
**container
)
1152 TRACE("(%p %p %p)\n", control
, hWnd
, container
);
1155 return E_INVALIDARG
;
1157 hr
= IOCS_Create( hWnd
, control
, container
);
1158 return hWnd
? hr
: S_FALSE
;
1161 /**********************************************************************
1162 * Helper function for AX_ConvertDialogTemplate
1164 static inline BOOL
advance_array(WORD
**pptr
, DWORD
*palloc
, DWORD
*pfilled
, const WORD
*data
, DWORD size
)
1166 if ( (*pfilled
+ size
) > *palloc
)
1168 *palloc
= ((*pfilled
+size
) + 0xFF) & ~0xFF;
1169 *pptr
= HeapReAlloc( GetProcessHeap(), 0, *pptr
, *palloc
* sizeof(WORD
) );
1173 RtlMoveMemory( *pptr
+*pfilled
, data
, size
* sizeof(WORD
) );
1178 /**********************************************************************
1179 * Convert ActiveX control templates to AtlAxWin class instances
1181 static LPDLGTEMPLATEW
AX_ConvertDialogTemplate(LPCDLGTEMPLATEW src_tmpl
)
1183 #define GET_WORD(x) (*(const WORD *)(x))
1184 #define GET_DWORD(x) (*(const DWORD *)(x))
1185 #define PUT_BLOCK(x,y) do {if (!advance_array(&output, &allocated, &filled, (x), (y))) return NULL;} while (0)
1186 #define PUT_WORD(x) do {WORD w = (x);PUT_BLOCK(&w, 1);} while(0)
1187 const WORD
*tmp
, *src
= (const WORD
*)src_tmpl
;
1189 DWORD allocated
, filled
; /* in WORDs */
1191 WORD signature
, dlgver
, rescount
;
1194 filled
= 0; allocated
= 256;
1195 output
= HeapAlloc( GetProcessHeap(), 0, allocated
* sizeof(WORD
) );
1201 signature
= GET_WORD(src
);
1202 dlgver
= GET_WORD(src
+ 1);
1203 if (signature
== 1 && dlgver
== 0xFFFF)
1207 style
= GET_DWORD(src
);
1209 rescount
= GET_WORD(src
++);
1211 if ( GET_WORD(src
) == 0xFFFF ) /* menu */
1214 src
+= strlenW(src
) + 1;
1215 if ( GET_WORD(src
) == 0xFFFF ) /* class */
1218 src
+= strlenW(src
) + 1;
1219 src
+= strlenW(src
) + 1; /* title */
1220 if ( style
& (DS_SETFONT
| DS_SHELLFONT
) )
1223 src
+= strlenW(src
) + 1;
1227 style
= GET_DWORD(src
);
1229 rescount
= GET_WORD(src
++);
1231 if ( GET_WORD(src
) == 0xFFFF ) /* menu */
1234 src
+= strlenW(src
) + 1;
1235 if ( GET_WORD(src
) == 0xFFFF ) /* class */
1238 src
+= strlenW(src
) + 1;
1239 src
+= strlenW(src
) + 1; /* title */
1240 if ( style
& DS_SETFONT
)
1243 src
+= strlenW(src
) + 1;
1246 PUT_BLOCK(tmp
, src
-tmp
);
1250 src
= (const WORD
*)( ( ((ULONG_PTR
)src
) + 3) & ~3); /* align on DWORD boundary */
1251 filled
= (filled
+ 1) & ~1; /* depends on DWORD-aligned allocation unit */
1258 PUT_BLOCK(tmp
, src
-tmp
);
1261 if ( GET_WORD(src
) == 0xFFFF ) /* class */
1266 src
+= strlenW(src
) + 1;
1268 src
+= strlenW(src
) + 1; /* title */
1269 if ( GET_WORD(tmp
) == '{' ) /* all this mess created because of this line */
1271 static const WCHAR AtlAxWin
[] = {'A','t','l','A','x','W','i','n', 0};
1272 PUT_BLOCK(AtlAxWin
, ARRAY_SIZE(AtlAxWin
));
1273 PUT_BLOCK(tmp
, strlenW(tmp
)+1);
1275 PUT_BLOCK(tmp
, src
-tmp
);
1277 if ( GET_WORD(src
) )
1279 WORD size
= (GET_WORD(src
)+sizeof(WORD
)-1) / sizeof(WORD
); /* quite ugly :( Maybe use BYTE* instead of WORD* everywhere ? */
1280 PUT_BLOCK(src
, size
);
1289 return (LPDLGTEMPLATEW
) output
;
1292 /***********************************************************************
1293 * AtlAxCreateDialogA [atl100.@]
1295 * Creates a dialog window
1298 * hInst [I] Application instance
1299 * name [I] Dialog box template name
1300 * owner [I] Dialog box parent HWND
1301 * dlgProc [I] Dialog box procedure
1302 * param [I] This value will be passed to dlgProc as WM_INITDIALOG's message lParam
1305 * Window handle of dialog window.
1307 HWND WINAPI
AtlAxCreateDialogA(HINSTANCE hInst
, LPCSTR name
, HWND owner
, DLGPROC dlgProc
,LPARAM param
)
1313 if (IS_INTRESOURCE(name
))
1314 return AtlAxCreateDialogW( hInst
, (LPCWSTR
) name
, owner
, dlgProc
, param
);
1316 length
= MultiByteToWideChar( CP_ACP
, 0, name
, -1, NULL
, 0 );
1317 nameW
= HeapAlloc( GetProcessHeap(), 0, length
* sizeof(WCHAR
) );
1320 MultiByteToWideChar( CP_ACP
, 0, name
, -1, nameW
, length
);
1321 res
= AtlAxCreateDialogW( hInst
, nameW
, owner
, dlgProc
, param
);
1322 HeapFree( GetProcessHeap(), 0, nameW
);
1327 /***********************************************************************
1328 * AtlAxCreateDialogW [atl100.@]
1330 * See AtlAxCreateDialogA
1333 HWND WINAPI
AtlAxCreateDialogW(HINSTANCE hInst
, LPCWSTR name
, HWND owner
, DLGPROC dlgProc
,LPARAM param
)
1337 LPCDLGTEMPLATEW ptr
;
1338 LPDLGTEMPLATEW newptr
;
1341 TRACE("(%p %s %p %p %lx)\n", hInst
, debugstr_w(name
), owner
, dlgProc
, param
);
1343 hrsrc
= FindResourceW( hInst
, name
, (LPWSTR
)RT_DIALOG
);
1346 hgl
= LoadResource (hInst
, hrsrc
);
1349 ptr
= LockResource ( hgl
);
1352 FreeResource( hgl
);
1355 newptr
= AX_ConvertDialogTemplate( ptr
);
1358 res
= CreateDialogIndirectParamW( hInst
, newptr
, owner
, dlgProc
, param
);
1359 HeapFree( GetProcessHeap(), 0, newptr
);
1362 FreeResource ( hrsrc
);
1366 /***********************************************************************
1367 * AtlAxGetHost [atl100.@]
1370 HRESULT WINAPI
AtlAxGetHost(HWND hWnd
, IUnknown
**host
)
1374 TRACE("(%p, %p)\n", hWnd
, host
);
1378 This
= (IOCS
*) GetPropW( hWnd
, wine_atl_iocsW
);
1381 WARN("No container attached to %p\n", hWnd
);
1385 return IOleClientSite_QueryInterface(&This
->IOleClientSite_iface
, &IID_IUnknown
, (void**)host
);
1388 /***********************************************************************
1389 * AtlAxGetControl [atl100.@]
1392 HRESULT WINAPI
AtlAxGetControl(HWND hWnd
, IUnknown
**pUnk
)
1396 TRACE( "(%p, %p)\n", hWnd
, pUnk
);
1400 This
= (IOCS
*) GetPropW( hWnd
, wine_atl_iocsW
);
1401 if ( !This
|| !This
->control
)
1403 WARN("No control attached to %p\n", hWnd
);
1407 return IOleObject_QueryInterface( This
->control
, &IID_IUnknown
, (void**) pUnk
);
1410 /***********************************************************************
1411 * AtlAxDialogBoxA [atl100.@]
1414 INT_PTR WINAPI
AtlAxDialogBoxA(HINSTANCE hInst
, LPCSTR name
, HWND owner
, DLGPROC dlgProc
, LPARAM param
)
1420 if (IS_INTRESOURCE(name
))
1421 return AtlAxDialogBoxW( hInst
, (LPCWSTR
) name
, owner
, dlgProc
, param
);
1423 length
= MultiByteToWideChar( CP_ACP
, 0, name
, -1, NULL
, 0 );
1424 nameW
= heap_alloc( length
* sizeof(WCHAR
) );
1427 MultiByteToWideChar( CP_ACP
, 0, name
, -1, nameW
, length
);
1428 res
= AtlAxDialogBoxW( hInst
, nameW
, owner
, dlgProc
, param
);
1434 /***********************************************************************
1435 * AtlAxDialogBoxW [atl100.@]
1438 INT_PTR WINAPI
AtlAxDialogBoxW(HINSTANCE hInst
, LPCWSTR name
, HWND owner
, DLGPROC dlgProc
, LPARAM param
)
1442 LPCDLGTEMPLATEW ptr
;
1443 LPDLGTEMPLATEW newptr
;
1446 TRACE("(%p %s %p %p %lx)\n", hInst
, debugstr_w(name
), owner
, dlgProc
, param
);
1448 hrsrc
= FindResourceW( hInst
, name
, (LPWSTR
)RT_DIALOG
);
1451 hgl
= LoadResource (hInst
, hrsrc
);
1454 ptr
= LockResource ( hgl
);
1457 FreeResource( hgl
);
1460 newptr
= AX_ConvertDialogTemplate( ptr
);
1463 res
= DialogBoxIndirectParamW( hInst
, newptr
, owner
, dlgProc
, param
);
1464 heap_free( newptr
);
1467 FreeResource ( hrsrc
);
1471 /***********************************************************************
1472 * AtlAxCreateControlLic [atl100.59]
1475 HRESULT WINAPI
AtlAxCreateControlLic(const WCHAR
*lpTricsData
, HWND hwnd
, IStream
*stream
, IUnknown
**container
, BSTR lic
)
1477 return AtlAxCreateControlLicEx(lpTricsData
, hwnd
, stream
, container
, NULL
, NULL
, NULL
, lic
);
1480 /***********************************************************************
1481 * AtlAxCreateControlEx [atl100.@]
1484 HRESULT WINAPI
AtlAxCreateControlEx(const WCHAR
*lpTricsData
, HWND hwnd
, IStream
*stream
,
1485 IUnknown
**container
, IUnknown
**control
, REFIID iidSink
, IUnknown
*punkSink
)
1487 return AtlAxCreateControlLicEx(lpTricsData
, hwnd
, stream
, container
, control
, iidSink
, punkSink
, NULL
);