How do we decide whether the constant is required when use any API ?
Printable View
How do we decide whether the constant is required when use any API ?
Generally, you can tell if you need any constant by looking at the documentation of that API function.
Could you be more speciffic ? I mean what API function are you talking about ? Maybe I could find some help for ya...
I was looking at the example of the "GetFileTime" from one of the site, and the example did not shows we need to use the constant. Result of the example return a value 0. From the experience on the current project which I copied the code from one of the thread, it uses the constant and it works. I tried remark the constant, and I got the same "0" value.
Curious about how to find out whether constant is required if I use the other API.
Look in the API Text viewer.
A constant is simply making a large number more memoriable. For example, It's easier to remember Pi, then 3.142857...
Basically, it just makes something shorter. Say for example, you use the blue values:
Or, VB's own constant:Code:'Form delcarations:
Const blue = &HFF0000
Private Sub Form_Load()
Me.BackColor = blue
End Sub
Constants can make your programs self-documenting and easy to modify. Unlike variables, constants can't be inadvertently changed while your program is running.Code:'Form delcarations:
Const blue = vbBlue
Private Sub Form_Load()
Me.BackColor = blue
End Sub
..just makin' life easier for ya :rolleyes:.
Not really. I think the correct definition is that they make things more understandable.Quote:
Originally posted by Matthew Gates
Basically, it just makes something shorter