Results 1 to 7 of 7

Thread: may be stupid question..

  1. #1

    Thread Starter
    New Member
    Join Date
    Apr 2000
    Posts
    11

    Cool

    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.

  2. #2

  3. #3
    Guest
    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.


  4. #4
    transcendental analytic kedaman's Avatar
    Join Date
    Mar 2000
    Location
    0x002F2EA8
    Posts
    7,221
    & 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.
    Use
    writing software in C++ is like driving rivets into steel beam with a toothpick.
    writing haskell makes your life easier:
    reverse (p (6*9)) where p x|x==0=""|True=chr (48+z): p y where (y,z)=divMod x 13
    To throw away OOP for low level languages is myopia, to keep OOP is hyperopia. To throw away OOP for a high level language is insight.

  5. #5
    Former Admin/Moderator MartinLiss's Avatar
    Join Date
    Sep 1999
    Location
    San Jose, CA
    Posts
    33,431
    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.

  6. #6
    Addicted Member
    Join Date
    Feb 2000
    Posts
    224
    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.
    If you can't pronounce my name, call me GURU

  7. #7

    Thread Starter
    New Member
    Join Date
    Apr 2000
    Posts
    11

    Cool Thanks...

    Thanks a lot guys!!!


    Calm Indian.

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  



Click Here to Expand Forum to Full Width