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

Function PyShellExecuteEx

com/win32comext/shell/src/shell.cpp:2430–2533  ·  view source on GitHub ↗

@pymethod dict|shell|ShellExecuteEx|Performs an operation on a file.

Source from the content-addressed store, hash-verified

2428
2429// @pymethod dict|shell|ShellExecuteEx|Performs an operation on a file.
2430static PyObject *PyShellExecuteEx(PyObject *self, PyObject *args, PyObject *kw)
2431{
2432 PyObject *ret = NULL;
2433 BOOL ok;
2434 SHELLEXECUTEINFO info;
2435 memset(&info, 0, sizeof(info));
2436 info.cbSize = sizeof(info);
2437
2438 static char *kw_items[]= {
2439 "fMask","hwnd","lpVerb","lpFile", "lpParameters", "lpDirectory",
2440 "nShow", "lpIDList", "lpClass", "hkeyClass", "dwHotKey",
2441 "hIcon", "hMonitor", NULL,
2442 };
2443 PyObject *obhwnd=Py_None, *obVerb = NULL, *obFile = NULL, *obParams = NULL;
2444 PyObject *obDirectory = NULL, *obIDList = NULL, *obClass = NULL;
2445 PyObject *obhkeyClass = NULL, *obHotKey = NULL, *obhIcon = NULL;
2446 PyObject *obhMonitor = NULL;
2447 // @pyparm int|fMask|0|The default mask for the structure. Other
2448 // masks may be added based on what paramaters are supplied.
2449 if (!PyArg_ParseTupleAndKeywords(args, kw, "|lOOOOOlOOOOOO", kw_items,
2450 &info.fMask,
2451 &obhwnd, // @pyparm <o PyHANDLE>|hwnd|0|
2452 &obVerb, // @pyparm string|lpVerb||
2453 &obFile, // @pyparm string|lpFile||
2454 &obParams, // @pyparm string|lpParameters||
2455 &obDirectory, // @pyparm string|lpDirectory||
2456 &info.nShow, // @pyparm int|nShow|0|
2457 &obIDList, // @pyparm <o PyIDL>|lpIDList||
2458 &obClass, // @pyparm string|obClass||
2459 &obhkeyClass, // @pyparm int|hkeyClass||
2460 &obHotKey, // @pyparm int|dwHotKey||
2461 &obhIcon, // @pyparm <o PyHANDLE>|hIcon||
2462 &obhMonitor)) // @pyparm <o PyHANDLE>|hMonitor||
2463 goto done;
2464 if (!PyWinObject_AsHANDLE(obhwnd, (HANDLE *)&info.hwnd))
2465 goto done;
2466 if (obVerb && !PyWinObject_AsTCHAR(obVerb, (TCHAR **)&info.lpVerb))
2467 goto done;
2468 if (obFile && !PyWinObject_AsTCHAR(obFile, (TCHAR **)&info.lpFile))
2469 goto done;
2470 if (obParams && !PyWinObject_AsTCHAR(obParams, (TCHAR **)&info.lpParameters))
2471 goto done;
2472 if (obDirectory && !PyWinObject_AsTCHAR(obDirectory, (TCHAR **)&info.lpDirectory))
2473 goto done;
2474 if (obIDList) {
2475 info.fMask |= SEE_MASK_IDLIST;
2476 if (!PyObject_AsPIDL(obIDList, (ITEMIDLIST **)&info.lpIDList))
2477 goto done;
2478 }
2479 if (obClass) {
2480 info.fMask |= SEE_MASK_CLASSNAME;
2481 if (!PyWinObject_AsTCHAR(obClass, (TCHAR **)&info.lpClass))
2482 goto done;
2483 }
2484 if (obhkeyClass) {
2485 info.fMask |= SEE_MASK_CLASSKEY;
2486 if (!PyWinObject_AsHKEY(obhkeyClass, &info.hkeyClass))
2487 goto done;

Callers

nothing calls this directly

Calls 7

PyWinObject_AsHANDLEFunction · 0.85
PyObject_AsPIDLFunction · 0.85
PyWinObject_AsHKEYFunction · 0.85
PyWinObject_FromHANDLEFunction · 0.85
PyWin_SetAPIErrorFunction · 0.85
PyWinObject_FreeStringFunction · 0.85
PyObject_FreePIDLFunction · 0.85

Tested by

no test coverage detected