ObjectARX菜单编程涉及到如下函数,现将函数列出。以下英文解释默认是参考ObjectARX for AutoCAD2010,部分参考MSDN.
1.acedGetAcadFrame() (参考ObjectARX for AutoCAD2010)
Description:
This function is used to get the pointer to AutoCAD's main frame window.
For building ObjectARX applications with a static MFC library, or when not using the same shared MFC DLL as AutoCAD, a pointer to a window cannot be used. Instead, use the window handle. To get the window handle, use acedGetAcadFrame()->m_hWnd;
2.GetMenuItemCount() (参考MSDN,菜单部分有疑问可参考MSDN)
Description:
Determines the number of items in a pop-up or top-level menu.
Return Value:
The number of items in the menu if the function is successful; otherwise –1.
3.CreateMenu() (参考MSDN)
Description:
Creates a menu and attaches it to the CMenu object.
Return Value:
Nonzero if the menu was created successfully; otherwise 0.
4.CreatePopupMenu() (参考MSDN)
Description:
Creates a pop-up menu and attaches it to the CMenu object.
Return Value:
Nonzero if the pop-up menu was successfully created; otherwise 0.
5.AppendMenu() (参考MSDN)
Description:
Appends a new item to the end of a menu.
Return Value:
Nonzero if the function is successful; otherwise 0.
6.AppendMenu() (参考MSDN)
Description:
Detaches a Windows menu from a CMenu object and returns the handle.
Return Value:
The handle, of type HMENU, to a Windows menu, if successful; otherwise NULL.
7.acedRegisterFilterWinMsg() (参考ObjectARX for AutoCAD2010)
Description:
Register a filter message hook into AutoCAD's Windows message loop. The message passed to your application can be changed and can be blocked out.
Returns TRUE if successfully registers the hook. Otherwise, returns FALSE.
AcedFilterWinMsgFn is typedef BOOL (* AcedFilterWinMsgFn)(MSG*);
The function pointed to by pfn can change the value of MSG passed to it. If the function returns FALSE, the message will be passed to other hook functions and AutoCAD, provided that the other hooks don't block out the message.
If the function returns TRUE, the message will not be passed to other hook functions or AutoCAD. The message is terminated.