Better GUID macro

Share your advanced PureBasic knowledge/code with the community.
Trond
Always Here
Always Here
Posts: 7446
Joined: Mon Sep 22, 2003 6:45 pm
Location: Norway

Better GUID macro

Post by Trond »

This macro only requires you to replace the -'s with commas.

Code: Select all

Macro GUID(name, l1, w1, w2, b1b2, brest) 
  DataSection
  name:
    Data.l $l1
    Data.w $w1, $w2
    Data.b $b1b2 >> 8, $b1b2 & $FF
    Data.b $brest >> 40 & $FF
    Data.b $brest >> 32 & $FF
    Data.b $brest >> 24 & $FF
    Data.b $brest >> 16 & $FF
    Data.b $brest >> 8 & $FF
    Data.b $brest & $FF
  EndDataSection
EndMacro

GUID(CLSID_Test, 332C4425, 26CB, 11D0, B483, 00C04FD90119)
SFSxOI
Addict
Addict
Posts: 2970
Joined: Sat Dec 31, 2005 5:24 pm
Location: Where ya would never look.....

Post by SFSxOI »

Whats the difference in use of this macro and just defining the GUID in a DataSection? Advantages - disadvantages?

Thanks :)
Trond
Always Here
Always Here
Posts: 7446
Joined: Mon Sep 22, 2003 6:45 pm
Location: Norway

Post by Trond »

You don't have to split up the last number by hand. (It's for the lazy among us :wink: )
SFSxOI
Addict
Addict
Posts: 2970
Joined: Sat Dec 31, 2005 5:24 pm
Location: Where ya would never look.....

Post by SFSxOI »

Oh ...well...DuH!...LoL....I kept trying to find some advantage and disadvantage with it in trying to answer my own question...never even thought of the simple answer you gave ...LoL :)
Post Reply