PC Review Forums Newsgroups Microsoft Outlook Microsoft Outlook VBA Programming How to insert menu items to pop-up context menu in inspectors?

Reply

How to insert menu items to pop-up context menu in inspectors?

 
Thread Tools Rate Thread
Old 03-03-2005, 03:33 AM   #1
Yuan Nan via OfficeKB.com
Guest
 
Posts: n/a
Default How to insert menu items to pop-up context menu in inspectors?


Hi,
I followed several aticles's instruction and complete this function in
main form in Outlook 2003.
But I met problem when I want to do the same work in mail item
inspector, since the context menu seems dynamically created and destructed,
not belongs to CommandBars object, just like its name: "Temporary Context
Menu"(get from spy++).
When the mouse hover/click on the mail address of sender/recipients in
mail inspector, A MSN-style icon appears and click it, the context menu
poped up is just the menu I want to insert items to.
I'm very thankful to your kind help.

--
Message posted via http://www.officekb.com
  Reply With Quote
Old 03-03-2005, 06:34 AM   #2
Michael Bauer
Guest
 
Posts: n/a
Default Re: How to insert menu items to pop-up context menu in inspectors?

Hi Yuan,

unfortunately there is no way.

--
Viele Grüße
Michael Bauer


"Yuan Nan via OfficeKB.com" <forum@OfficeKB.com> wrote in message
news:fb134068d8424995acfbc657034329ab@OfficeKB.com...
> Hi,
> I followed several aticles's instruction and complete this

function in
> main form in Outlook 2003.
> But I met problem when I want to do the same work in mail item
> inspector, since the context menu seems dynamically created and

destructed,
> not belongs to CommandBars object, just like its name: "Temporary

Context
> Menu"(get from spy++).
> When the mouse hover/click on the mail address of

sender/recipients in
> mail inspector, A MSN-style icon appears and click it, the context

menu
> poped up is just the menu I want to insert items to.
> I'm very thankful to your kind help.
>
> --
> Message posted via http://www.officekb.com


  Reply With Quote
Old 04-03-2005, 01:13 AM   #3
Yuan Nan via OfficeKB.com
Guest
 
Posts: n/a
Default Re: How to insert menu items to pop-up context menu in inspectors?

I use WINAPI FindWindow to get the Menu's HWND successfully. And also use
WINAPI InsertMenuItem to insert the item in it. Like this:

Dim hwnd As Long
Dim ItemInfo As MENUITEMINFO
Dim ID As Long
On Error Resume Next
hwnd = FindWindow("MsoCommandBarPopup", "Temporary context menu")
If hwnd = 0 Then Exit Sub
ID = 1
With ItemInfo
.cbSize = LenB(ItemInfo)
.fMask = .....
.fType = &H0
.fState = &H0
.wID = ID
.dwItemData = True
.cch = Len("test")
.dwTypeData = "test"
End With
i = InsertMenuItem(hwnd, ID, False, ItemInfo)

But the code does not function. Is the hwnd returned by FindWindow
equal to the hMenu (1st Param. of InsertMenuItem)?
Variable i always return FAIL but GetLastError return NO-ERROR!

--
Message posted via http://www.officekb.com
  Reply With Quote
Old 04-03-2005, 11:01 PM   #4
Dmitry Streblechenko
Guest
 
Posts: n/a
Default Re: How to insert menu items to pop-up context menu in inspectors?

Outlook and Office menus are *not* the regular Windows menus, they are
custom controls.

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

"Yuan Nan via OfficeKB.com" <forum@OfficeKB.com> wrote in message
news:636e3910d9084d528d1c311a8ffe6284@OfficeKB.com...
> I use WINAPI FindWindow to get the Menu's HWND successfully. And also use
> WINAPI InsertMenuItem to insert the item in it. Like this:
>
> Dim hwnd As Long
> Dim ItemInfo As MENUITEMINFO
> Dim ID As Long
> On Error Resume Next
> hwnd = FindWindow("MsoCommandBarPopup", "Temporary context menu")
> If hwnd = 0 Then Exit Sub
> ID = 1
> With ItemInfo
> .cbSize = LenB(ItemInfo)
> .fMask = .....
> .fType = &H0
> .fState = &H0
> .wID = ID
> .dwItemData = True
> .cch = Len("test")
> .dwTypeData = "test"
> End With
> i = InsertMenuItem(hwnd, ID, False, ItemInfo)
>
> But the code does not function. Is the hwnd returned by FindWindow
> equal to the hMenu (1st Param. of InsertMenuItem)?
> Variable i always return FAIL but GetLastError return NO-ERROR!
>
> --
> Message posted via http://www.officekb.com



  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

vB code is On
Smilies are On
[IMG] code is On
HTML code is Off