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

Function PyCFrameWnd_CreateWindow

Pythonwin/win32win.cpp:3385–3451  ·  view source on GitHub ↗

@pymethod tuple|PyCFrameWnd|CreateWindow|Creates the actual window for the PyCFrameWnd object.

Source from the content-addressed store, hash-verified

3383
3384// @pymethod tuple|PyCFrameWnd|CreateWindow|Creates the actual window for the PyCFrameWnd object.
3385static PyObject *
3386PyCFrameWnd_CreateWindow(PyObject *self, PyObject *args)
3387 {
3388 CFrameWnd *pFrame=GetFramePtr(self);
3389 if (!pFrame)return NULL;
3390
3391 PythonCreateContext cc;
3392 RECT rect = CFrameWnd::rectDefault;
3393 PyObject *obRect = Py_None;
3394 PyObject *obParent = Py_None;
3395 PyObject *obContext = Py_None;
3396 PyObject *obMenuID = Py_None;
3397 TCHAR *szClass = NULL, *szTitle = NULL, *szMenuName = NULL;
3398 PyObject *obClass, *obTitle, *ret=NULL;
3399 DWORD styleEx=0;
3400 DWORD style = WS_VISIBLE | WS_OVERLAPPEDWINDOW;
3401 if(!PyArg_ParseTuple(args, "OO|lOOOOl:Create",
3402 &obClass, // @pyparm string|wndClass||The window class name, or None
3403 &obTitle, // @pyparm string|title||The window title
3404 &style, // @pyparm int|style| WS_VISIBLE \| WS_OVERLAPPEDWINDOW|The window style
3405 &obRect, // @pyparm int, int, int, int|rect|None|The default rectangle
3406 &obParent, // @pyparm parent|<o PyCWnd>|None|The parent window
3407 &obContext,// @pyparm tuple|createContext|None|A tuple representing a CREATECONTEXT structure.
3408 &obMenuID,// @pyparm string or int|menuId||The string or integer id for the menu.
3409 &styleEx)) // @pyparm int|styleEx||The extended style of the window being created.
3410 return NULL;
3411
3412 CCreateContext* pContext = NULL;
3413 if (obContext != Py_None)
3414 {
3415 cc.SetPythonObject(obContext);
3416 pContext = &cc;
3417 }
3418
3419 if (obRect != Py_None){
3420 if (!PyArg_ParseTuple(obRect, "iiii:RECT", &rect.left, &rect.top, &rect.right,&rect.bottom))
3421 return NULL;
3422 }
3423
3424 CFrameWnd *pParent = NULL;
3425 if (obParent != Py_None)
3426 {
3427 pParent = GetFramePtr(obParent);
3428 if (pParent==NULL)
3429 RETURN_TYPE_ERR("The parent window is not a valid PyFrameWnd");
3430 }
3431
3432 if (PyWinObject_AsTCHAR(obClass, &szClass, TRUE)
3433 &&PyWinObject_AsTCHAR(obTitle, &szTitle, FALSE)
3434 &&PyWinObject_AsResourceId(obMenuID, &szMenuName, TRUE)){
3435 BOOL ok;
3436 GUI_BGN_SAVE;
3437 // @pyseemfc CFrameWnd|Create
3438 ok = pFrame->Create(szClass, szTitle, style, rect,pParent,szMenuName,styleEx,pContext);
3439 GUI_END_SAVE;
3440 if (!ok)
3441 PyErr_SetString(ui_module_error, "CFrameWnd::Create failed");
3442 else{

Callers

nothing calls this directly

Calls 4

GetFramePtrFunction · 0.85
SetPythonObjectMethod · 0.80
CreateMethod · 0.45

Tested by

no test coverage detected