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

Function ui_find_open_document

Pythonwin/win32app.cpp:216–237  ·  view source on GitHub ↗

@pymethod |PyCWinApp|FindOpenDocument|Returns an existing document with the specified file name.

Source from the content-addressed store, hash-verified

214
215// @pymethod <o PyCDocument>|PyCWinApp|FindOpenDocument|Returns an existing document with the specified file name.
216static PyObject *
217ui_find_open_document(PyObject *self, PyObject *args)
218{
219 TCHAR *fileName;
220 PyObject *obfileName;
221 // @pyparm string|fileName||The fully qualified filename to search for.
222 if (!PyArg_ParseTuple(args,"O", &obfileName))
223 return NULL;
224 CProtectedWinApp *pApp = GetProtectedApp();
225 if (!pApp) return NULL;
226
227 if (!PyWinObject_AsTCHAR(obfileName, &fileName, FALSE))
228 return NULL;
229 // Let MFC framework search for a filename for us.
230 GUI_BGN_SAVE;
231 CDocument *pDoc=pApp->FindOpenDocument(fileName);
232 GUI_END_SAVE;
233 PyWinObject_FreeTCHAR(fileName);
234 if (pDoc==NULL)
235 RETURN_NONE;
236 return ui_assoc_object::make(PyCDocument::type, pDoc)->GetGoodRet();
237}
238
239// @pymethod <o PyCWinApp>|win32ui|GetApp|Retrieves the application object.
240PyObject *

Callers

nothing calls this directly

Calls 3

GetProtectedAppFunction · 0.85
GetGoodRetMethod · 0.80
FindOpenDocumentMethod · 0.45

Tested by

no test coverage detected