Win32 Dll Extention Module Problem

Jeffrey Drake jpt.d at home.com
Sun Oct 28 01:08:54 EST 2001


In my python program, whenever calling the following function it freezes and
I have to kill python.

Otherwise the program works fine.

Here is the source to the function:

static PyObject *
Win32X_InitializeFlatSB(
  PyObject *self,
  PyObject *args)
{
 HWND hwnd;
 BOOL ret;

 if (!PyArg_ParseTuple(args, "i", &hwnd))
  return NULL;

 ret = InitializeFlatSB(hwnd);

 return Py_BuildValue("i", 1);
}

and...
static PyMethodDef Win32X_methods[] = {
 {"InitializeFlatSB", Win32X_InitializeFlatSB, METH_VARARGS,
"InitializeFlatSB will initialize flat scrollbars for your window. Just pass
the window handle."},

and...  (inside initWin32X)
Py_InitModule("Win32X", Win32X_methods);


The only problem I can think of is the data conversion.

"i" is the closest or "l" that is listed to be able to convert the HWND.
HWND natively is a void* i believe.

Notes: I know win32all exists, but it doesn't have these methods.

Any help appreciated.

BTW, is there a conversion for void*?

Regards,
Jeffrey Drake.





More information about the Python-list mailing list