From: Steven Don <gitlab@shdon.com> The MSDN documentation for AtlAxWinInit states that it initialises ATL's control hosting code by registering window classes *plus a couple of custom window messages* Logging calls to `RegisterWindowMessage` showed that Visual Studio 2005, when going into Options -> Projects and Solutions -> VC++ Directories, calls this function to get the message IDs for custom messages name WM_ATLGETCONTROL and WM_ATLGETHOST. I've then registered those same messages in AtlAxWinInit and logged when they were called in `AtlAxWin_wndproc`. Since they were called with 0 for both `wParam` and `lParam`, the only sensible implementation would be routing the calls through `AtlAxGetControl` and `AtlAxGetHost` and returning the `IUnknown` pointer from the window procedure. This change now makes the VC++ Directories control in Visual Studio 2005 work as expected (and probably other stuff too). --- dlls/atl/atl_ax.c | 20 ++++++++++++++++++++ 1 file changed, 20 insertions(+) diff --git a/dlls/atl/atl_ax.c b/dlls/atl/atl_ax.c index 4ff0a796d3b..3bf2ce662e4 100644 --- a/dlls/atl/atl_ax.c +++ b/dlls/atl/atl_ax.c @@ -55,6 +55,9 @@ typedef struct IOCS { BOOL fActive, fInPlace, fWindowless; } IOCS; +static UINT wmAtlGetHost = 0; +static UINT wmAtlGetControl = 0; + /********************************************************************** * AtlAxWin class window procedure */ @@ -71,6 +74,18 @@ static LRESULT CALLBACK AtlAxWin_wndproc( HWND hWnd, UINT wMsg, WPARAM wParam, L free( ptr ); return 0; } + if ( wMsg == wmAtlGetControl ) + { + IUnknown *control = NULL; + AtlAxGetControl( hWnd, &control ); + return (LRESULT)control; + } + if ( wMsg == wmAtlGetHost ) + { + IUnknown *host = NULL; + AtlAxGetHost( hWnd, &host ); + return (LRESULT)host; + } return DefWindowProcW( hWnd, wMsg, wParam, lParam ); } @@ -132,6 +147,11 @@ BOOL WINAPI AtlAxWinInit(void) return FALSE; } + if (!wmAtlGetControl) + wmAtlGetControl = RegisterWindowMessageW( L"WM_ATLGETCONTROL" ); + if (!wmAtlGetHost) + wmAtlGetHost = RegisterWindowMessageW( L"WM_ATLGETHOST" ); + return TRUE; } -- GitLab https://gitlab.winehq.org/wine/wine/-/merge_requests/10869