Win32gui... file dialogs?

Neil Hodgson neilh at scintilla.org
Sat Aug 26 06:12:17 EDT 2000


Alex Martelli wrote

> So far, so good.  Most of the fields are either DWORD's with
> values that are easy to understand, or can be left at 0 without
> too much pain.  Only issue: how does one set the various
> LPCTSTR and LPCSTR parameters with struct?  The only way
> I see with struct to place a pointer/extract a pointer is with
> format 'p' -- but that corresponds to a Python int; how do I
> get the int equivalent of a string's initial address, and vv...?

   You can use the array module to create character array objects and
retrive their addresses to use in Win32 API calls. There are examples of
this in python\pythonwin\pywin\scintilla\control.py such as:

def SCIInsertText(self, text, pos=-1):
    sma = array.array('c', text+"\0")
    (a,l) = sma.buffer_info()
    self.SendScintilla(SCI_INSERTTEXT, pos, a)

   Where 'a' is the address of the constructed array buffer object.

   Neil





More information about the Python-list mailing list