Alejandrarm12

I wrote a DocObject following all the MS specification. It works perfectly in IE (any version) when I use URL with the appropriate file extension. The only problem is that I cannot define the Icon Zone in the IE status bar.

I used the following document to specify the Icon zone:

http://msdn2.microsoft.com/en-us/library/aa770042.aspx

Internet Explorer calls the IOleCommandTarget::Exec method but never with value 39:

#define SBCMDID_MIXEDZONE 39

Does exist a missing part that I never considered, such as categories or registry entries missed that allow IE to call the Exec method with this value .

thanks in advance.



Re: Internet Explorer Extension Development DocObject - Icon Zone

John Sudds - MSFT

Try this:

#define GUID_SECURITYCHANGED L"{50941612-1392-419f-8515-1E195A7D5C14}"
UINT umsg = RegisterWindowMessage(GUID_SECURITYCHANGED);

PostMessage(hwndDocObjectHost, umsg, 0L, 0L);

According to what I've read, this should trigger the frame to invoke your DocObject with SBCMDID_MIXEDZONE.






Re: Internet Explorer Extension Development DocObject - Icon Zone

Alejandrarm12

Thanks for your help, but still doesn't work. Let me show you the code that I'm working

Code Snippet

#define GUID_SECURITYCHANGED L"{50941612-1392-419f-8515-1E195A7D5C14}"
UINT umsg = RegisterWindowMessage(GUID_SECURITYCHANGED);


template <class T>
class ATL_NO_VTABLE IOleDocumentViewImpl : public IOleDocumentView
{
public:
STDMETHOD(Show)(BOOL fShow)
{
ATLTRACE(_T("IOleDocumentView::Show\n"));
T* pT = static_cast<T*>(this);
HRESULT hr = S_OK;

if (fShow)
{
if (!pT->m_bUIActive)
hr = pT->ActiveXDocActivate(OLEIVERB_INPLACEACTIVATE);

// I Wrote this code here only for testing.
// Send message to InPlaceSite (DOESN'T WORK)
HWND hWnd = NULL;
pT->m_spInPlaceSite->GetWindow(&hWnd);
PostMessage(hWnd, umsg, 0L, 0L);

// Send message to InPlaceFrame (DOESN'T WORK)
pT->m_spInPlaceFrame->GetWindow(&hWnd);
PostMessage(hWnd, umsg, 0L, 0L);

// Who is the DocObjectHost
}
else
{
hr = pT->UIActivate(FALSE);
::ShowWindow(pT->m_hWnd, SW_HIDE);
}
return hr;
}
};


class CActiveDoc :
...
public IOleDocumentImpl<CActiveDoc>,
public IOleDocumentViewImpl<CActiveDoc>,
public IOleCommandTarget,
...
{
// IOleCommandTarget
STDMETHOD(QueryStatus)(const GUID* pguidCmdGroup, ULONG cCmds,
OLECMD prgCmds[], OLECMDTEXT* pCmdText)
{
ATLTRACE(_T("CActiveDoc::QueryStatus\n"));
return S_OK;
}

STDMETHOD(Exec)(const GUID* pguidCmdGroup, DWORD nCmdID, DWORD nCmdexecopt, VARIANT* pvaIn, VARIANT* pvaOut)
{
ATLTRACE(_T("CActiveDoc::Exec(%ld)\n"), nCmdID);
if (pguidCmdGroup && CGID_Explorer == *pguidCmdGroup)
{
switch (nCmdID)
{
// NEVER CALLED USING THIS VALUE.
case SBCMDID_MIXEDZONE:
if (pvaOut != NULL)
{
pvaOut->vt = VT_UI4;
pvaOut->ulVal = URLZONE_INTERNET;
}
break;
}
}
return S_OK;
}

};

I Post the message just when the docobject is showing. At this time the DocObject has m_spInPlaceSite and m_spInPlaceFrame members referenced. I post the message to both member but nobody calls Exec method implementation in CActiveDoc class. So the question here is, who is the DocObjectHost in a DocObject .

The DocObject implementation that I'm using to test is located at :

http://msdn2.microsoft.com/en-us/library/65t81w8a(VS.80).aspx

and the name is ACTIVEDOC Sample.





Re: Internet Explorer Extension Development DocObject - Icon Zone

Alejandrarm12

OK John thanks for your answer, I fixed the problem with the example and right now IE calls Exec with value:

#define SBCMDID_MIXEDZONE 39

But the Icon Zone doesn't change. This is the code that I'm using

Code Snippet

STDMETHOD(Exec)(const GUID* pguidCmdGroup, DWORD nCmdID, DWORD nCmdexecopt, VARIANT* pvaIn, VARIANT* pvaOut)
{
ATLTRACE(_T("CActiveDoc::Exec(%ld)\n"), nCmdID);
if (pguidCmdGroup && CGID_Explorer == *pguidCmdGroup)
{
switch (nCmdID)
{
// NEVER CALLED USING THIS VALUE.
case SBCMDID_MIXEDZONE:
if (pvaOut != NULL)
{
pvaOut->vt = VT_UI4;
pvaOut->ulVal = URLZONE_INTRANET;
}
break;
}
}
return S_OK;
}

Something else is missing .

Thanks for your help.





Re: Internet Explorer Extension Development DocObject - Icon Zone

Alejandrarm12

John excuse me the comment : // NEVER CALLED USING THIS VALUE. <- forget it.
IE calls Exec, but IE don't change the Icon Zone.

thanks





Re: Internet Explorer Extension Development DocObject - Icon Zone

John Sudds - MSFT

OK, forget what I said about the custom window message. You should be able to trigger IE to call you by calling it first, with NULL parameters, as in the following code extract:

IShellBrowser *psbTop;
if (SUCCEEDED(pWB2->QueryService(SID_STopLevelBrowser, IID_PPV_ARGS(&psbTop))))
{
CmdTargExec(psbTop, &CGID_Explorer, SBCMDID_MIXEDZONE, 0, NULL, NULL);
psbTop->Release();
}

This code path is ultimately simpler than sending a full-blown SECURITYCHANGED message. However, it doesn't do anything new.

Another thing: you won't be able to set the zone lower than that already assigned by the default security manager.

Again, as far as I can tell (I'm reading through source code to trace the function call), your return value is correct.

Just for debugging, have you tried setting the return VARIANTARG to VT_NULL, which should set the zone icon to Mixed