Your problem with a full control is that it implements IOleObject.
so you need to change your code accordingly. When the IE host
since it can use IOleObject to set the site. IObjectWithSite is
ActiveX Controls (among others, it was originally designed for OLE).
work with a full control.
hello here is my update findings
if i create simple ATL project, and if i insert class for "ATL
Object"
not
"ATL Control" it works
all is same. i added the "sitelock.h" and then
public IObjectWithSiteImpl<CTestObject>,
public IObjectSafetySiteLockImpl<CTestObject,
INTERFACESAFE_FOR_UNTRUSTED_CALLER>,
public IDispatchImpl<ITestObject, &IID_ITestObject,
&LIBID_TESTCTLLib>
and after this added the com map entry at :
COM_INTERFACE_ENTRY(IObjectWithSite)
COM_INTERFACE_ENTRY(IObjectSafety)
COM_INTERFACE_ENTRY(IObjectSafetySiteLock)
and i put a breakpoint in the file
"C:\Program Files\Microsoft Visual Studio
9.0\VC\atlmfc\include\atlcom.h"
at SetSite() method.
amazingly my Breakpoint hits. so things works
could some one tell me if i add the "ATL Control" then with the same
steps
why is it not working.
am i missing something in the class derivation? or any things else
that
is
required.i have checked that if i add class for "ATL Control" then
SetSite
never hits hence failed.
could some please tell me !
regards
deep
--
deep
"Deepak" wrote:
hello,
i am trying to make a Activex control that is aware of Domain.for this
i
went to this link
for the respective files "sitelock.h"
http://www.microsoft.com/Downloads/details.aspx?FamilyID=43cd7e1e-5719-45c0-88d9-ec9ea7fefbcb&displaylang=en
i fired the VS2008. create the ATL simple project.
after this i added a "ATL control" and provided the necessary
details.
i clicked on Finish button. it generates a lot of template based code.
threading model is "apartment" . i added simple messagebox handler for
it
here is the template based code
public CComObjectRootEx<CComSingleThreadModel>,
public IDispatchImpl<ICAT, &IID_ICAT, &LIBID_testLib, /*wMajor =*/ 1,
/*wMinor =*/ 0>,
public IPersistStreamInitImpl<CCAT>,
public IOleControlImpl<CCAT>,
public IOleObjectImpl<CCAT>,
public IOleInPlaceActiveObjectImpl<CCAT>,
public IViewObjectExImpl<CCAT>,
public IOleInPlaceObjectWindowlessImpl<CCAT>,
public ISupportErrorInfo,
public IPersistStorageImpl<CCAT>,
public ISpecifyPropertyPagesImpl<CCAT>,
public IQuickActivateImpl<CCAT>,
#ifndef _WIN32_WCE
public IDataObjectImpl<CCAT>,
#endif
public IProvideClassInfo2Impl<&CLSID_CAT, NULL, &LIBID_testLib>,
#ifdef _WIN32_WCE // IObjectSafety is required on Windows CE for the
control
to be loaded correctly
public IObjectSafetyImpl<CCAT, INTERFACESAFE_FOR_UNTRUSTED_CALLER>,
#endif
public CComCoClass<CCAT, &CLSID_CAT>,
public CComControl<CCAT>
i added the sitelock.h and removed the all #def for Win_CE made full
code
for the Windows.
i added these things more
public IObjectSafetySiteLockImpl<CCAT, INTERFACESAFE_FOR_...>
COM_INTERFACE_ENTRY(IObjectSafetySiteLock)
i initialise these variable
static const SiteList rgslTrustedSites[length];
public IObjectWithSiteImpl<CCAT>
COM_INTERFACE_ENTRY(IObjectWithSite)
and build the project.
it runs but it fails in the sitelock.h at this line
hr = pT->GetSite(IID_IServiceProvider, (void**)&spSrvProv);
saying that E_FAIL..
i investigated and found that untill the SetSite is not get callled it
will
return E_FAIL. i have added the template class for it . the SetSite
never
gets called .
then i found this link
http://www.codeguru.com/forum/showthread.php?t=349180
the last response to this thread contains a sample. that works
but mine created default by wizard did not work could some one clerify
it
deep