MCPcopy Create free account
hub / github.com/mhammond/pywin32 / AppendMenu

Method AppendMenu

Pythonwin/win32menu.cpp:96–118  ·  view source on GitHub ↗

Menu Methods @pymethod |PyCMenu|AppendMenu|Appends a new item to the end of a menu. Python can specify the state of the menu item by setting values in nFlags.

Source from the content-addressed store, hash-verified

94// Menu Methods
95// @pymethod |PyCMenu|AppendMenu|Appends a new item to the end of a menu. Python can specify the state of the menu item by setting values in nFlags.
96PyObject *PyCMenu::AppendMenu(PyObject *self, PyObject *args)
97{
98 HMENU hMenu = GetMenu( self );
99 if (!hMenu)
100 return NULL;
101 TCHAR *value = NULL;
102 PyObject *obvalue=Py_None;
103 int id=0;
104 int flags;
105 if (!PyArg_ParseTuple(args,"i|iO",
106 &flags, // @pyparm int|flags||Specifies information about the state of the new menu item when it is added to the menu. May be a combination of the win32con.MF_* values.
107 &id, // @pyparm int|id|0|Specifies either the command ID of the new menu item.
108 &obvalue)) // @pyparm string/None|value|None|Specifies the content of the new menu item. If used, flags must contain win32con.MF_STRING.
109 return NULL;
110 if (!PyWinObject_AsTCHAR(obvalue, &value, TRUE))
111 return NULL;
112 if (!::AppendMenu( hMenu, flags, id, value)){
113 PyWinObject_FreeTCHAR(value);
114 RETURN_API_ERR("::AppendMenu");
115 }
116 PyWinObject_FreeTCHAR(value);
117 RETURN_NONE;
118}
119
120// @pymethod string|PyCMenu|DeleteMenu|Deletes the specified menu item.
121PyObject *PyCMenu::DeleteMenu(PyObject *self, PyObject *args)

Callers 3

_SetupMenuMethod · 0.45
OnTaskbarNotifyMethod · 0.45
icon_wndprocFunction · 0.45

Calls

no outgoing calls

Tested by

no test coverage detected