-
Hi there!
Are API constants to be used in the same format like the one seen below?
Public Const ERROR_SUCCESS = 0&
Public Const HKEY_DYN_DATA = &H80000006
Can I give a different name to the constant?
Well I could understand some of the functions. But where can I find the whole API constants?
why '&' is used in almost all the declarations?
Please help.
Thanx,
Calm Indian.
-
The & means that it's a hexidecimal value. You can get a lot of other info on APIs by clicking the VB API link at the left.
-
Here's another way to find API Constants. Open your API Text Viewer and select the file Win32api.txt. At the top CombBox where it says "Declares", switch it to Constants and a list should come up.
-
& means string addition and long integer, not hex. The hex is &H and a hexvalue following it. You could get the decimal value from hex by throwing it into immediate window and put a ? before it and press enter.
No you do not have to use hexvalues if you don't want to. If you feel more comfortable with dec values, then just do as i said and replace them.
-
I made a couple of mistakes in my original reply to you. When I said that the & meant hexidecimal I meant to say &H as in the HKEY_DYN_DATA value. I also overlooked that you also asked about ERROR_SUCCESS which as kedaman correctly points out is defined as a Long via the &. I'm not sure however that he is right when he implies that you can use use decimal values in the place of hex values in API calls. All I know is that API calls, especially under NT, are very sensitive to the expected data type.
-
Well answering the original question by INDIAN.
"Can I give a different name to the constant?"
YES ! you can... but you can also call a donkey a cat,
a goat a rat and so on... Then there will be no standard on who should call which donkey as what ?
To avoid all this, there is a standard way of naming windows
api constants. And this is used in win32 programming ..whether u chose to do that in vb or c++ or in MASM.
-
Thanks...
Thanks a lot guys!!!
;)
Calm Indian.