Microsoft KB Archive/244817

= BUG: IOleControlSite::TransformCoords Returns S_OK Instead of E_NOTIMPL =

Article ID: 244817

Article Last Modified on 12/11/2003

-

APPLIES TO

 Microsoft ActiveX Template Library 3.0, when used with:  Microsoft Visual C++ 6.0 Enterprise Edition

 Microsoft Visual C++ 6.0 Professional Edition

 Microsoft Visual C++ 6.0 Standard Edition 

-

<div class="notice_section">

This article was previously published under Q244817

<div class="symptoms_section">

SYMPTOMS
If a client calls IOleControlSite::TransformCoords on an ATL control container that is hosting ActiveX controls, the method returns S_OK but the returned values passed to TransformCoords will be incorrect.

<div class="cause_section">

CAUSE
IOleControlSite::TransformCoords in ATL has no useful implementation but returns S_OK instead of E_NOTIMPL.

<div class="resolution_section">

RESOLUTION
This can be worked around by copying the ATLHOST.h to something like FIXATLHOST.h in your \ATL\INCLUDE directory and making the change in FIXATLHOST.h to the TransformCoords function. The function should be changed such that E_NOTIMPL is returned and not S_OK. Then, in Stdafx.h, comment out Atlhost.h and use Fixatlhost.h instead: //#include <atlhost.h> NOTE: This technique will only work in Debug or ReleaseMinDependency builds. It will not work in ReleaseMinSize builds as ATL.dll would be used, not the code in FixAtlHost.h.
 * 1) include <fixatlhost.h>

<div class="status_section">

STATUS
Microsoft has confirmed that this is a bug in the Microsoft products that are listed at the beginning of this article.

<div class="moreinformation_section">

Steps to Reproduce Behavior
<ol> Use the AppWizard to create an new ATL DLL project. Name the project anything you like.</li> Select the Insert menu and under it, select the New ATL Object menu item.</li> Select the Controls item under Category and select Composite Control under Objects. Click Next</li> Fill in the Short name with whatever you like and click OK.</li> In the resource editor, right-click the dialog box that was just generated and select Insert ActiveX control from the menu.</li> Find the Microsoft Status Bar 6.0 in the list box and click OK.</li> Right-click the status bar and select Properties from the menu. Click on the Panels tab, enter some text in the Text field. Notice the Width is 54.00 (dialog units)</li> Right-click the status bar and select Events. On the left side of the dialog box, click the WM_INITDIALOG message. Then click the Add and Edit button.</li>  In the WM_INITDIALOG message handler, add following code: CComPtr<IStatusBar> pBar; CComPtr<IPanels> pPanels; CComPtr<IPanel> pPanel; float fLeft = 0.0, fWidth = 0.0;

HRESULT hr = GetDlgControl(IDC_STATUSBAR, IID_IStatusBar, (void **) &pBar); pBar->get_Panels(&pPanels);

CComVariant v(1); pPanels->get_Item(&v, &pPanel);

//*************************************************   pPanel->get_Left(&fLeft);   //Doesn't work pPanel->get_Width(&fWidth); //Doesn't work //*************************************************                       </li> Build and test this in any container.</li></ol>

Notice the incorrect values come back from get_Left, get_Width when they are called.

<div class="references_section">