forked from Travis-Sun/pywin32
-
Notifications
You must be signed in to change notification settings - Fork 1
Expand file tree
/
Copy pathddeitem.cpp
More file actions
56 lines (50 loc) · 1.64 KB
/
ddeitem.cpp
File metadata and controls
56 lines (50 loc) · 1.64 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
// @doc
#include "stdafxdde.h"
#include "ddemodule.h"
PythonDDEStringItem *PyDDEStringItem::GetItem (PyObject *self)
{
return (PythonDDEStringItem *)ui_assoc_object::GetGoodCppObject( self, &type);
}
// @pymethod |PyDDEStringItem|SetData|Sets an items data, and causes any underlying notification.
PyObject *PyDDEStringItem_SetData(PyObject *self, PyObject *args)
{
TCHAR *val;
PyObject *obval;
PythonDDEStringItem *pItem = PyDDEStringItem::GetItem(self);
if (!pItem) return NULL;
// @pyparm string|data||The data to set.
if (!PyArg_ParseTuple(args, "O:SetData", &obval))
return NULL;
if (!PyWinObject_AsTCHAR(obval, &val, FALSE))
return NULL;
GUI_BGN_SAVE;
pItem->SetData(val);
GUI_END_SAVE;
PyWinObject_FreeTCHAR(val);
RETURN_NONE;
}
// @pymethod |PyDDEStringItem|Destroy|Destroys an item
PyObject *PyDDEStringItem_Destroy(PyObject *self, PyObject *args)
{
if (!PyArg_ParseTuple(args, ":Destroy"))
return NULL;
GUI_BGN_SAVE;
PythonDDEStringItem *pItem = PyDDEStringItem::GetItem(self);
GUI_END_SAVE;
if (!pItem) return NULL;
delete pItem;
RETURN_NONE;
}
// @object PyDDEStringItem|A DDE string item.
static struct PyMethodDef PyDDEStringItem_methods[] = {
{"Destroy", PyDDEStringItem_Destroy, 1},
{"SetData", PyDDEStringItem_SetData, 1}, // @pymeth SetData|Sets an items data, and causes any underlying notification.
{NULL, NULL} // sentinel
};
ui_type_CObject PyDDEStringItem::type("PyDDEStringItem",
&ui_assoc_CObject::type,
RUNTIME_CLASS(CDDEStringItem),
sizeof(PyDDEStringItem),
PYOBJ_OFFSET(PyDDEStringItem),
PyDDEStringItem_methods,
GET_PY_CTOR(PyDDEStringItem));