Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Appearance settings

Latest commit

 

History

History
History
64 lines (57 loc) · 1.3 KB

File metadata and controls

64 lines (57 loc) · 1.3 KB
Copy raw file
Download raw file
Open symbols panel
Edit and raw actions
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
57
58
59
60
61
62
63
64
#include "Python.h"
#include <windows.h>
static PyObject *
_GetForegroundWindow(PyObject *module, PyObject *args)
{
HWND handle = GetForegroundWindow();
if (!PyArg_ParseTuple(args, ":GetForegroundWindow"))
{
return NULL;
}
return PyLong_FromSize_t((size_t)handle);
}
static PyObject *
_SetForegroundWindow(PyObject *module, PyObject *args)
{
HWND handle;
if (!PyArg_ParseTuple(args, "n:SetForegroundWindow", &handle))
{
return NULL;
}
if (!SetForegroundWindow(handle))
{
return PyErr_Format(PyExc_RuntimeError,
"Error setting window");
}
Py_INCREF(Py_None);
return Py_None;
}
static PyMethodDef _windowing_methods[] =
{
{"GetForegroundWindow", _GetForegroundWindow, METH_VARARGS},
{"SetForegroundWindow", _SetForegroundWindow, METH_VARARGS},
{NULL, NULL}
};
#if PY_MAJOR_VERSION >= 3
static struct PyModuleDef moduledef = {
PyModuleDef_HEAD_INIT,
"_windowing",
"",
-1,
_windowing_methods,
NULL,
NULL,
NULL,
NULL
};
PyMODINIT_FUNC PyInit__windowing(void)
{
PyObject *module = PyModule_Create(&moduledef);
return module;
}
#else
PyMODINIT_FUNC init_windowing()
{
Py_InitModule("_windowing", _windowing_methods);
}
#endif
Morty Proxy This is a proxified and sanitized view of the page, visit original site.