Page 1 of 1

Posted: Fri Feb 15, 2002 10:08 am
by BackupUser
Restored from previous forum. Originally posted by darryl_bartlett.

Hi guys,

Just a really quick question for you. I was looking around some Visual Basic API examples and I came across some constants for it, namely:

CDS_UPDATEREGISTRY = &H1
CDS_TEST = &H2

DM_BITSPERPEL = &H40000
DM_PELSWIDTH = &H80000
DM_PELSHEIGHT = &H100000

Obviously, PureBasic doesn't like the &Hxxxxx bit. How would I convert these numbers into a form which PureBasic would accept?

Thanks in advance.

Regards,
Darryl.

Posted: Fri Feb 15, 2002 10:21 am
by BackupUser
Restored from previous forum. Originally posted by FAKEFACTORY.

Change "&H" to "$". This should work:

CDS_UPDATEREGISTRY = $1
CDS_TEST = $2

DM_BITSPERPEL = $40000
DM_PELSWIDTH = $80000
DM_PELSHEIGHT = $100000


Registered PureBasic Coder

Posted: Fri Feb 15, 2002 10:41 am
by BackupUser
Restored from previous forum. Originally posted by darryl_bartlett.

Thanks for you quick reply. It worked like a charm. Thank you for you help.

Posted: Fri Feb 15, 2002 10:56 am
by BackupUser
Restored from previous forum. Originally posted by PB.

Don't forget that when converting Visual Basic apps to PureBasic, you don't
normally need to declare constants. For example, you can usually just throw
a hash (#) in front of the constant like so:

Visual Basic:
Public Const GW_CHILD=&H2
r=GetWindow_(GetDesktopWindow_(),GW_CHILD)

PureBasic:
; No need to declare API constants in PureBasic!
r=GetWindow_(GetDesktopWindow_(),#GW_CHILD)

As you can see, this is one of PureBasic's major advantages over Visual Basic.
Therefore, Darryl, you can most likely just use the following in your example,
without having to declare any constants in your PureBasic code:

#CDS_UPDATEREGISTRY, #CDS_TEST, #DM_BITSPERPEL, #DM_PELSWIDTH, #DM_PELSHEIGHT


PB - Registered PureBasic Coder


Edited by - PB on 15 February 2002 10:58:16

Posted: Fri Feb 15, 2002 10:57 am
by BackupUser
Restored from previous forum. Originally posted by fred.

BTW, there are constants, so you shoud convert it to :

#CDS_UPDATEREGISTRY = $1
#CDS_TEST = $2

#DM_BITSPERPEL = $40000
#DM_PELSWIDTH = $80000
#DM_PELSHEIGHT = $100000


Fred - AlphaSND