Recent

Author Topic: how to implement atl.dll's function AtlAxAttachControl in freepascal?  (Read 6820 times)

zzsczz

  • Newbie
  • Posts: 5
AtlAxAttachControl  can create an interface from a coclass and show it on an windows.









the atl's  code is :




ATLINLINE ATLAPI AtlAxAttachControl(IUnknown* pControl, HWND hWnd, IUnknown** ppUnkContainer)
{
   AtlAxWinInit();
   if (pControl == NULL)
      return E_INVALIDARG;
   CComPtr<IUnknown> spUnkContainer;


   HRESULT hr = CAxHostWindow::_CreatorClass::CreateInstance(NULL, __uuidof(IUnknown), (void**)&spUnkContainer);
   if (SUCCEEDED(hr))
   {
      CComPtr<IAxWinHostWindow> spAxWindow;
      hr = spUnkContainer->QueryInterface(&spAxWindow);
      if (SUCCEEDED(hr))
         hr = spAxWindow->AttachControl(pControl, hWnd);
   }
   if (ppUnkContainer != NULL)
   {
      *ppUnkContainer = SUCCEEDED(hr) ? spUnkContainer.Detach() : NULL;
   }
   return hr;
}
fpc : fixes_2_6      r19871
lazarus : fixes_0_9_30 r34261

ludob

  • Hero Member
  • *****
  • Posts: 1173
Re: how to implement atl.dll's function AtlAxAttachControl in freepascal?
« Reply #1 on: December 20, 2011, 04:44:43 pm »
Are you looking for this http://lazarus.freepascal.org/index.php/topic,9311.15/topicseen.html? Drop a panel on the form, run the code and the ActiveX control will be displayed on the panel.
The original demo at http://lists.lazarus.freepascal.org/pipermail/lazarus/2011-May/063491.html shows also how to sink events coming from the ActiveX control.

zzsczz

  • Newbie
  • Posts: 5
Re: how to implement atl.dll's function AtlAxAttachControl in freepascal?
« Reply #2 on: December 20, 2011, 06:02:11 pm »
Are you looking for this http://lazarus.freepascal.org/index.php/topic,9311.15/topicseen.html? Drop a panel on the form, run the code and the ActiveX control will be displayed on the panel.
The original demo at http://lists.lazarus.freepascal.org/pipermail/lazarus/2011-May/063491.html shows also how to sink events coming from the ActiveX control.

Function  AtlAxAttachControl  could be written by  freepascal to remove  the dependence of atl.dll  >:D

input args :
1 an interface of FactoryClass ( the  coClass) of the activex control
2 handle of the  window  to which the  activex control was attached to
3 ??nil



 
fpc : fixes_2_6      r19871
lazarus : fixes_0_9_30 r34261

ludob

  • Hero Member
  • *****
  • Posts: 1173
Re: how to implement atl.dll's function AtlAxAttachControl in freepascal?
« Reply #3 on: December 20, 2011, 06:25:34 pm »
Yes, please, do go ahead :)
 
A good starting point is here http://doxygen.reactos.org/da/de4/atl__ax_8c_source.html. Don't forget that the implementation of IOleControlSite, IOleClientSite and IOleInPlaceSite is also missing.

BTW. Have you found a windows version that doesn't come with atl.dll out of the box?

 

TinyPortal © 2005-2018