[python-win32] Re: WIN32 API?
ChuckEsterbrook at yahoo.com
Thu Jun 5 14:55:47 EDT 2003
On Thursday 05 June 2003 02:21 am, Thomas Heller wrote:
> Chuck Esterbrook <ChuckEsterbrook at yahoo.com> writes:
> > On Tuesday 03 June 2003 12:51 am, Thomas Heller wrote:
> > > There's a win32gui.PumpWaitingMessages() which contains the
> > > complete message loop.
> > Thanks for the numerous tips! I'm still interested in getting what
> > I would call "full access". Here's what I've been doing/thinking:
> > I was looking at win32all because it seems to already "know" what
> > the proper return types and arg types are for functions. However,
> > the disadvantage is that several functions (and possibly structs)
> > are not available. While I understand that win32 is somehwhat of a
> > moving target, many funcs such as beginpaint, drawtext and endpaint
> > are not.
> > ctypes can call just about anything which is fantastic. But it
> > doesn't "know" the structs or the function types.
> For additional ctypes' based function declarations and type
> definitions you can also look into Henk Punt's venster project, he
> build a native windows gui framework using ctypes.
Already have. He's doing all the declarations manually as he needs them.
BTW Is anyone in touch with him? I emailed him asking if he would start
a mailing list for Venster, but never got a reply...
> > I then briefly contemplated writing a C preprocessor and C parser
> > that would suck up *.H out of the VC98 directory and spew the
> > Python "declarations" for ctypes. After all, the information is all
> > right there in *.H.
> Except for one thing: the include file doesn't have info in which dll
> a function actually is (although the search could be done by ctypes
> from a known list of dlls).
Exactly. I already wrote a little bit of code to do the search.
> > If I were to preprocess and parse the C headers, would anything
> > prevent me from generating Python source for ctypes to specify the
> > return types, arg types and structs?
> No, it should work.
> Niki spahiev mentioned Simon Burton's cdecl.py module in the
> ctypes-users mailing list. I did some experiments with is and the
> results are quite promising.
> I sent VC98's windows.h file through the cl preprocessor (which
> resulted in a 46000 line file after removing chunks of empty lines,
> and fed it to the cdecl module.
> I had to fix one bug with hex constants, and had to hack around
> several windows specific problems (__cdecl, __stdcall, and other MS
> qualifiers), and unnamed structures. cdecl does not yet parse the
> file completely, but it looks promising. Maybe the end result can be
> something like Python's h2py script.
Great. Another thought I had was that we could put all this info in a
little database, perhaps through mxBeeBase, and only pull in the stuff
that gets used. I believe there are over 10,000 constants, funcs and
structs, but a given app would probably only use a fraction of them.
Is there any chance of getting your fixes merged back into cdecl?
More information about the Python-win32