[python-win32] Handle to a Driver
Tim Roberts
timr at probo.com
Mon Apr 4 19:24:35 CEST 2005
Chi Tai wrote:
> Cool, thanks a lot :)
>
> this is absolutely the better solution.
The "struct" module is a very helpful tool when you're doing Win32 API
programming like this, especially with the new changes that make it more
difficult to manipulate binary values as dwords. It would be worth your
time to spend a few minutes playing with it, to figure out for yourself
what it does.
For example, Win32 programmers are used to combining two 16-bit values
into a 32-bit value using this C code (which also happens to be valid
Python code):
dword = (hi << 16) | (lo & 0xffff);
This gets you a deprecation warning in Python 2.3. You can do this same
function without the warning using struct:
dword = struct.pack( "<HH", hi, lo )
--
- Tim Roberts, timr at probo.com
Providenza & Boekelheide, Inc.
More information about the Python-win32
mailing list