[VBA - active X] Identifying a shortcut menu

Hello, I'm trying to modify the POP502 popupmenu and only that one. I've found some code one Afralisp site, and on Autocad 2000 VBA
programmation manual But i don't find solution to clearely identify which popup is my "command edition contextual menu" (the pop502 one) I don't want to modify the POP0 one.
The other problem is that the POP502 don't have the Shortcutmenu = True until the user has activate it one time !!
Is there is someone that now how to get the "label" or "Alias" (POP502.CMEDIT) of a popupmenu ?
Thanks a lot Gérald Lemoine
PS: I place there the code that i've made: It works, but i'me never shure of the menu i modify !
;**************************************************************************** ;§/menu/add an item to a contextual menu/pos StrItem StrMacro AddSeparator ;;pos = integer for Menuitem position. Pos = 0 ad ythe beginning ;;StrItem = string label of item ;;StrMacro = String macro associated to item ;;Addseparator nil : none , T : before & after , 1 after , 0 before
(defun pw_addItem2ContextualMenu ( pos StrItem StrMacro AddSeparator / ok i j acadObject AcadMenuGroup NbMenuGroup currMenuGroup currMenuGroupMenus scMenu AlreadyExist)
;;sous-commande pour tester la pré-existance de l'entrée de menu ;;---------------------------------- (defun AlreadyExist (popMenu label / k nb Oui ssMenu)      (setq nb (vlax-get-property popMenu 'Count))      ;;parcours le menus pour trouver le même label      (setq k 0)      (while (and (< k nb) (not oui))      (setq ssMenu (vlax-invoke-method popMenu 'Item k ))      ;;(vlax-invoke-method id 'Delete )      (if (= label (vlax-get-property ssMenu 'label))      (setq Oui T )      )      (setq k (+ 1 k))      ) Oui ) ;;----------------------------------
(vl-Load-Com) (setq acadObject (vlax-get-acad-object)) (setq AcadMenuGroup (vla-get-MenuGroups acadObject)) (setq NbMenuGroup (vlax-get-property AcadMenuGroup 'Count))
(setq j 0)
(while (and (< j NbMenuGroup) (not ok))      (setq currMenuGroup (vlax-invoke-method AcadMenuGroup 'Item j )) (setq currMenuGroupMenus (vla-get-Menus currMenuGroup))      (setq nb (vlax-get-property currMenuGroupMenus 'Count))      ;;parcours les menus pour trouver celui qui est contextuel      (setq i 0)      (while (and (< i nb) (not ok))      (setq scMenu (vlax-invoke-method currMenuGroupMenus 'Item i ))      (if (= ':VLAX-TRUE (vlax-get-property scMenu 'ShortcutMenu))      (setq ok T )      )      (setq i (+ 1 i))      )      (setq j (+ 1 j))     )
(if ok (progn (prompt "\nFinded contextual menu") ;;verifie si item n'existe pas, et ajoute l'item (if (not (AlreadyExist scMenu StrItem)) (progn      (vlax-invoke-method      scMenu 'AddMenuItem pos StrItem StrMacro)      (cond      ((= Addseparator T)      (vlax-invoke-method scMenu 'AddSeparator pos)      (vlax-invoke-method scMenu 'AddSeparator (+ pos 1))      )      ((= Addseparator 1)      (vlax-invoke-method scMenu 'AddSeparator (+ pos 1))      )      ((= Addseparator 0)      (vlax-invoke-method scMenu 'AddSeparator pos)      )      )      ;;(vlax-method-applicable-p currMenuGroup 'Save )      (vlax-invoke-method currMenuGroup 'Save acMenuFileCompiled) (prompt (Strcat "\n" StrItem " item added to contextual menu"))      ) (prompt      (Strcat "\n" StrItem " already exist in contextual menu") ) ) ) (prompt "\nUnable to Find contextual menu") ) )
Add pictures here
✖
<% if( /^image/.test(type) ){ %>
<% } %>
<%-name%>
Add image file
Upload
Check for the desired shortcut menu's name in place of this: (if (= ':VLAX-TRUE (vlax-get-property scMenu 'ShortcutMenu))
use this (if (eq (vlax-get-property scMenu 'NameNoMnemonic) "command edition contextual menu");;make sure to use the POP502's name
HTH, Jeff

Add pictures here
✖
<% if( /^image/.test(type) ){ %>
<% } %>
<%-name%>
Add image file
Upload
This is a multi-part message in MIME format. --------------040006020306070908030800 Content-Type: text/plain; charset=ISO-8859-1; format=flowed Content-Transfer-Encoding: 8bit
Jeff a écrit :

Jeff, I initially thought to use a similar solution, but for me it's a little dangerous : It is designed to install an application on Worlwide Autocad localisation version. So the 'NameNoMnemonic property cannot be used very safely. I can't explain that a so significant information, the identifiant, cannot be accessed. The 'Tagstring vary from a session to another, so it cannot be used.
Something i can do is to ask on this forum for the name of their command menu edition : In German in Italian, in Spanish ... even in Korean ...
But it is still dangerous, because user can have changed this name. so initially, the shortcutproperty was very interresting, but it's not working
Thanks, Gérald
PowerClic : http://www.g-eaux.com/powerclic/explorer/english.html
--------------040006020306070908030800 Content-Type: text/html; charset=ISO-8859-1 Content-Transfer-Encoding: 7bit
<!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN"> <html> <head> <meta content="text/html;charset=ISO-8859-1" http-equiv="Content-Type"> <title></title> </head> <body bgcolor="#ffffff" text="#000000"> Jeff a &eacute;crit&nbsp;: <blockquote cite="mid43e98533$0$95982$ snipped-for-privacy@news.sonic.net" type="cite"> <pre wrap="">Check for the desired shortcut menu's name in place of this: (if (= ':VLAX-TRUE (vlax-get-property scMenu 'ShortcutMenu))
use this (if (eq (vlax-get-property scMenu 'NameNoMnemonic) "command edition contextual menu");;make sure to use the POP502's name </pre> </blockquote> Jeff,<br> I initially thought&nbsp; to use a similar solution, but for me it's a little dangerous : <br> It is designed to install an application on Worlwide Autocad localisation version.<br> So the 'NameNoMnemonic property cannot be used very safely.<br> I can't explain that a so significant information, the identifiant, cannot be accessed.<br> The 'Tagstring vary from a session to another, so it cannot be used.<br> <br> Something i can do is to ask on this forum for the name of their command menu edition :<br> In German in Italian, in Spanish ... even in Korean ...<br> <br> But it is still dangerous, because user can have changed this name.<br> so initially, the shortcutproperty was very interresting, but it's not working<br> <br> Thanks,<br> G&eacute;rald <br> <br> <font face="Courier New" size="2">PowerClic : <a class="moz-txt-link-freetext" href="http://www.g-eaux.com/powerclic/explorer/english.html ">http://www.g-eaux.com/powerclic/explorer/english.html </a></font><br> </body> </html>
--------------040006020306070908030800--
Add pictures here
✖
<% if( /^image/.test(type) ){ %>
<% } %>
<%-name%>
Add image file
Upload

Polytechforum.com is a website by engineers for engineers. It is not affiliated with any of manufacturers or vendors discussed here. All logos and trade names are the property of their respective owners.