PC Review


Reply
Thread Tools Rate Thread

How to disable standard menus/buttons

 
 
robert dugal
Guest
Posts: n/a
 
      13th Nov 2003
Is there a way to disable the buttons/menus for "Reply" and "Reply to All"?
I tried doing the following in IExchExtCommands::InitMenu() but this doesn't work.


STDMETHODIMP_(VOID) MyExchExt::InitMenu( LPEXCHEXTCALLBACK lpeecb )
{
HMENU hmenu;
HRESULT hr = lpeecb->GetMenu( &hmenu );
if ( hr == S_OK )
{
EnableMenuItem( hmenu, EECMDID_ComposeReplyToSender, MF_GRAYED );
EnableMenuItem( hmenu, EECMDID_ComposeReplyToAll, MF_GRAYED );
}
 
Reply With Quote
 
 
 
 
Dmitry Streblechenko
Guest
Posts: n/a
 
      13th Nov 2003
Try to use Outlook Object Model instead - use IOutlookExtCallback to get
Application object, then use
Application.ActiveExplorer.CommandBars.FindControl to find the button, then
set the CommandBarButton.Enabled property.

Dmitry Streblechenko (MVP)
http://www.dimastr.com/
OutlookSpy - Outlook, CDO
and MAPI Developer Tool


"robert dugal" <(E-Mail Removed)> wrote in message
news:(E-Mail Removed)...
> Is there a way to disable the buttons/menus for "Reply" and "Reply to

All"?
> I tried doing the following in IExchExtCommands::InitMenu() but this

doesn't work.
>
>
> STDMETHODIMP_(VOID) MyExchExt::InitMenu( LPEXCHEXTCALLBACK lpeecb )
> {
> HMENU hmenu;
> HRESULT hr = lpeecb->GetMenu( &hmenu );
> if ( hr == S_OK )
> {
> EnableMenuItem( hmenu, EECMDID_ComposeReplyToSender, MF_GRAYED );
> EnableMenuItem( hmenu, EECMDID_ComposeReplyToAll, MF_GRAYED );
> }



 
Reply With Quote
 
robert dugal
Guest
Posts: n/a
 
      14th Nov 2003
It took me a lot of work to get the Outlook Object Model working from
C++. While trying to figure this out I saw this post from you:

>Date: Thu, 23 Jan 2003 01:08:16 -0700
>Reply-To: MAPI Developers Forum <MAPI-(E-Mail Removed)>
>Sender: MAPI Developers Forum <MAPI-(E-Mail Removed)>
>From: Dmitry Streblechenko <(E-Mail Removed)>
>Subject: Re: Toolbar (complete)
>Content-Type: text/plain; charset="utf-8"
>
>I usually do the following:
>1. Grab Application in IExchExt::Install() when eecontext ==

EECONTEXT_SESSION

However, when I tried this code based on a post by Michael Tissington:

if ( EECONTEXT_SESSION == eecontext )
{
if ( m_pOutlook == NULL )
{
HRESULT hr2;
IOutlookExtCallback * pOutlookExt = NULL;
hr2 = peecb->QueryInterface( IID_IOutlookExtCallback,
(LPVOID *)&pOutlookExt );
if ( SUCCEEDED( hr2 ) )
{
IUnknown * pUnk = NULL;
hr2 = pOutlookExt->GetObject( &pUnk );
if ( SUCCEEDED( hr2 ) )
{
LPDISPATCH pDispatch = NULL;

hr2 = pUnk->QueryInterface( IID_IDispatch,
(LPVOID *)&pDispatch );
if ( SUCCEEDED( hr2 ) )
{
OLECHAR * szApplication = L"Application";
DISPPARAMS dispparamsNoArgs = {NULL, NULL, 0, 0 };
DISPID dspid;
VARIANT vtResult;

pDispatch->GetIDsOfNames(
IID_NULL,
&szApplication,
1,
LOCALE_SYSTEM_DEFAULT,
&dspid );

pDispatch->Invoke(
dspid,
IID_NULL,
LOCALE_SYSTEM_DEFAULT,
DISPATCH_METHOD,
&dispparamsNoArgs,
&vtResult,
NULL,
NULL );

pDispatch->Release();

m_pOutlook = vtResult.pdispVal;
}

pUnk->Release();
}

pOutlookExt->Release();
}
}
}

pUnk->QueryInterface() returns 0x80004002. But it is successfull in
EECONTEXT_VIEWER and EECONTEXT_SENDNOTEMESSAGE.

Having gotten this far I'm now playing with OOM, trying to add my own
buttons to the Standard toolbar. It's been very difficult because
there is so little information relating to doing things in C++. I can
now add a button with text and an image (I still need to figure out
the transparency issue though) to the main viewer window but cannot
figure out how to add it to the Send Note form. Instead I end up
getting 2 copies of the button on the Standard toolbar of the main
viewer window. Here's my code:


CommandBarControlsPtr pCtls;
try { pCtls = m_pOutlook->ActiveExplorer()->CommandBars->
GetItem("Standard")->GetControls(); } catch (_com_error) {}

if ( pCtls )
{
//CommandBarControlPtr pBtn;
_CommandBarButtonPtr pBtn;
try { pBtn = pCtls->Add ( (long)msoControlButton, vtMissing,
vtMissing, vtMissing, true ); } catch (_com_error) {}
if ( pBtn )
{
pBtn->Caption = "Test Caption";
pBtn->Tag = "Test Tag";
pBtn->TooltipText = "This is a test";
pBtn->PutStyle( msoButtonIconAndCaption );
pBtn->PutFaceId( 0 );

try
{
OpenClipboard(NULL);
EmptyClipboard();
HBITMAP hBitmap = LoadBitmap( hInst,
MAKEINTRESOURCE( IDB_TEST ) );
SetClipboardData(CF_BITMAP, hBitmap);
CloseClipboard();
pBtn->PasteFace();
OpenClipboard(NULL);
EmptyClipboard();
CloseClipboard();
}
catch(...){}
}
}
 
Reply With Quote
 
Dmitry Streblechenko
Guest
Posts: n/a
 
      14th Nov 2003
To add a button to an Inspector (as opposed to Explorer), trap the
Application.Inspectors.NewInspector event, new Inspector will be passed as a
parameter, check if your button is already there (since Outlook reuses
inspectors), if yes, delete it, if no, add it as a temporary button
(Inspectors.CommandBars.Item("Standard").Controls.Add(...Temporary:=true,
....)) and sink the CommandBarButton.Click event.

Dmitry Streblechenko (MVP)
http://www.dimastr.com/
OutlookSpy - Outlook, CDO
and MAPI Developer Tool


"robert dugal" <(E-Mail Removed)> wrote in message
news:(E-Mail Removed)...
> It took me a lot of work to get the Outlook Object Model working from
> C++. While trying to figure this out I saw this post from you:
>
> >Date: Thu, 23 Jan 2003 01:08:16 -0700
> >Reply-To: MAPI Developers Forum <MAPI-(E-Mail Removed)>
> >Sender: MAPI Developers Forum <MAPI-(E-Mail Removed)>
> >From: Dmitry Streblechenko <(E-Mail Removed)>
> >Subject: Re: Toolbar (complete)
> >Content-Type: text/plain; charset="utf-8"
> >
> >I usually do the following:
> >1. Grab Application in IExchExt::Install() when eecontext ==

> EECONTEXT_SESSION
>
> However, when I tried this code based on a post by Michael Tissington:
>
> if ( EECONTEXT_SESSION == eecontext )
> {
> if ( m_pOutlook == NULL )
> {
> HRESULT hr2;
> IOutlookExtCallback * pOutlookExt = NULL;
> hr2 = peecb->QueryInterface( IID_IOutlookExtCallback,
> (LPVOID *)&pOutlookExt );
> if ( SUCCEEDED( hr2 ) )
> {
> IUnknown * pUnk = NULL;
> hr2 = pOutlookExt->GetObject( &pUnk );
> if ( SUCCEEDED( hr2 ) )
> {
> LPDISPATCH pDispatch = NULL;
>
> hr2 = pUnk->QueryInterface( IID_IDispatch,
> (LPVOID *)&pDispatch );
> if ( SUCCEEDED( hr2 ) )
> {
> OLECHAR * szApplication = L"Application";
> DISPPARAMS dispparamsNoArgs = {NULL, NULL, 0, 0 };
> DISPID dspid;
> VARIANT vtResult;
>
> pDispatch->GetIDsOfNames(
> IID_NULL,
> &szApplication,
> 1,
> LOCALE_SYSTEM_DEFAULT,
> &dspid );
>
> pDispatch->Invoke(
> dspid,
> IID_NULL,
> LOCALE_SYSTEM_DEFAULT,
> DISPATCH_METHOD,
> &dispparamsNoArgs,
> &vtResult,
> NULL,
> NULL );
>
> pDispatch->Release();
>
> m_pOutlook = vtResult.pdispVal;
> }
>
> pUnk->Release();
> }
>
> pOutlookExt->Release();
> }
> }
> }
>
> pUnk->QueryInterface() returns 0x80004002. But it is successfull in
> EECONTEXT_VIEWER and EECONTEXT_SENDNOTEMESSAGE.
>
> Having gotten this far I'm now playing with OOM, trying to add my own
> buttons to the Standard toolbar. It's been very difficult because
> there is so little information relating to doing things in C++. I can
> now add a button with text and an image (I still need to figure out
> the transparency issue though) to the main viewer window but cannot
> figure out how to add it to the Send Note form. Instead I end up
> getting 2 copies of the button on the Standard toolbar of the main
> viewer window. Here's my code:
>
>
> CommandBarControlsPtr pCtls;
> try { pCtls = m_pOutlook->ActiveExplorer()->CommandBars->
> GetItem("Standard")->GetControls(); } catch (_com_error) {}
>
> if ( pCtls )
> {
> //CommandBarControlPtr pBtn;
> _CommandBarButtonPtr pBtn;
> try { pBtn = pCtls->Add ( (long)msoControlButton, vtMissing,
> vtMissing, vtMissing, true ); } catch (_com_error) {}
> if ( pBtn )
> {
> pBtn->Caption = "Test Caption";
> pBtn->Tag = "Test Tag";
> pBtn->TooltipText = "This is a test";
> pBtn->PutStyle( msoButtonIconAndCaption );
> pBtn->PutFaceId( 0 );
>
> try
> {
> OpenClipboard(NULL);
> EmptyClipboard();
> HBITMAP hBitmap = LoadBitmap( hInst,
> MAKEINTRESOURCE( IDB_TEST ) );
> SetClipboardData(CF_BITMAP, hBitmap);
> CloseClipboard();
> pBtn->PasteFace();
> OpenClipboard(NULL);
> EmptyClipboard();
> CloseClipboard();
> }
> catch(...){}
> }
> }



 
Reply With Quote
 
 
 
Reply

Thread Tools
Rate This Thread
Rate This Thread:

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are Off


Similar Threads
Thread Thread Starter Forum Replies Last Post
How to remove the standard menus? =?Utf-8?B?Y2xhcmE=?= Microsoft Excel Programming 3 23rd Mar 2007 06:16 PM
Standard Menus Missing =?Utf-8?B?Sm9uYXRoYW4=?= Windows XP Security 0 8th May 2006 11:16 AM
standard right click menus under XP runtime SJ Microsoft Access 3 7th Apr 2006 04:23 AM
Disable standard action buttons in PP XP? Greg Prong Microsoft Powerpoint 1 11th Oct 2005 02:57 PM
Skin pocket pc, disable hardware buttons, disable start button Tizio Incognito Microsoft Dot NET Compact Framework 1 3rd Feb 2005 09:13 AM


Features
 

Advertising
 

Newsgroups
 


All times are GMT +1. The time now is 08:21 PM.