On Mar 26, 2012, at 3:20 PM, Tim Roberts wrote:

> Scott Leerssen wrote:
>> I'm trying to write a DWORD value to the registry using _winreg.SetValueEx 
>> and anything greater than 0x7fffffff yields a "ValueError: Could not convert 
>> the data to the specified type."  I've seen a few posts saying that taking 
>> the complement of the large integer (basically making it a negative value) 
>> satisfies the API and fools it into storing the value, but that has the same 
>> result in my experiments.  Any hints as to how to write large integers int a 
>> DWORD?
> 
> Ugly but functional:
>   dw = struct.unpack('l',struct.pack('L', 0x80102030))[0]

Thanks, that does the trick.

Scott

_______________________________________________
python-win32 mailing list
python-win32@python.org
http://mail.python.org/mailman/listinfo/python-win32

Reply via email to