PC Review
Forums
Newsgroups
Microsoft Outlook
Microsoft Outlook VBA Programming
How to insert menu items to pop-up context menu in inspectors?
Forums
Newsgroups
Microsoft Outlook
Microsoft Outlook VBA Programming
How to insert menu items to pop-up context menu in inspectors?
![]() |
How to insert menu items to pop-up context menu in inspectors? |
|
|
Thread Tools | Rate Thread |
|
|
#1 |
|
Guest
Posts: n/a
|
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 |
|
|
|
#2 |
|
Guest
Posts: n/a
|
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 |
|
|
|
#3 |
|
Guest
Posts: n/a
|
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 |
|
|
|
#4 |
|
Guest
Posts: n/a
|
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 |
|
![]() |
|
| Thread Tools | |
| Rate This Thread | |
|
|

Main Page 

