This might be a pretty basic question, but I've been searching and cannot find an explanation. I'm playing with API functions for dialog boxes in VBA and I want to declare constants for the Window Styles as defined here so I can try to use the CreateDialog API function: http://msdn.microsoft.com/en-us/library/windows/desktop/ms632600(v=vs.85).aspx
Normally I see windows constants in VBA defined as long types with a value something like &H000
or something like that. But, I can't find the &H000
format value for these constants, I can only find the 0x00000000
format values.
For example, see the OpenFileName documentation here and scroll down to the flags. The constant expressions are listed with values in the format 0x00000000
. However, if we look at the CommonDialog constants here, we can see the same constants listed with their values in the format &H000
.
So I guess I have at least three questions:
What do the 0x0000000 values represent?
What do the &H000 values represent?
Is their a way to convert between them?
Because I tried declaring Public Const WS_BORDER as Long=0x00800000L
and I get a syntax area after the "x" saying expected end of statement.
The 0x...L
format is explained here for C++ (I believe it's the same in a few other languages). The 0x
signifies that the number is hexadecimal, and the L
signifies that it should be interpreted by the compiler as a Long
.
The equivalent VBA syntax would be &H...&
Where &H
signifies hexadecimal and &
signifies Long
.
So for example, your statement:
Public Const WS_BORDER as Long = 0x00800000L
Should be:
Public Const WS_BORDER as Long = &H00800000&