• Welcome to Valhalla Legends Archive.
 

[Python] MakeLong

Started by Yegg, December 13, 2004, 06:42 PM

Previous topic - Next topic

Yegg

Ok, I need a little help with putting MakeLong in python. I'm assuming it is something like GetDWORD and GetWORD.

    def MakeDWORD(n):
        return struct.pack("< I", n)


Banana fanna fo fanna showed me this code and helped me with it. I'm guessing that since both MakeLong and MakeWORD/DWORD use CopyMemory in VB6 that in Python they would both use the struct module. For MakeLong I have,

    def MakeLong(x):
        if len(x) < 4:
            pass
        return struct.pack("< L", x)


My problem is that I'm not sure if I use L for unsigned long or if I use something else. And this probably isn't the only problem.

Zakath

Why are you making a long when you already have a DWORD?

DWORD is the exact same thing as an unsigned long.
Quote from: iago on February 02, 2005, 03:07 PM
Yes, you can't have everybody...contributing to the main source repository.  That would be stupid and create chaos.

Opensource projects...would be dumb.

Yegg


Banana fanna fo fanna

Yegg, will you please RTFM. I've told you twice already; this is number 3. There's a nice easy table for you to use.

BaDDBLooD

Quote from: Zakath on December 14, 2004, 02:21 AM
Why are you making a long when you already have a DWORD?

DWORD is the exact same thing as an unsigned long.

The reason why, is because he uses code that uses the "MakeLong" function, as well as the "Make DWORD", not knowing they are the same thing.  IMHO
There are only two kinds of people who are really fascinating: people who know absolutely everything, and people who know absolutely nothing.