|
-
Nov 14th, 2000, 12:20 AM
#1
Thread Starter
Lively Member
How do we decide whether the constant is required when use any API ?
-
Nov 14th, 2000, 05:21 AM
#2
Lively Member
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...
-
Nov 14th, 2000, 10:59 AM
#3
Thread Starter
Lively Member
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.
-
Nov 14th, 2000, 02:54 PM
#4
Addicted Member
Look in the API Text viewer.
-
Nov 14th, 2000, 03:40 PM
#5
A constant is simply making a large number more memoriable. For example, It's easier to remember Pi, then 3.142857...
-
Nov 14th, 2000, 08:37 PM
#6
Basically, it just makes something shorter. Say for example, you use the blue values:
Code:
'Form delcarations:
Const blue = &HFF0000
Private Sub Form_Load()
Me.BackColor = blue
End Sub
Or, VB's own constant:
Code:
'Form delcarations:
Const blue = vbBlue
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.
..just makin' life easier for ya .
-
Nov 15th, 2000, 03:58 PM
#7
Originally posted by Matthew Gates
Basically, it just makes something shorter
Not really. I think the correct definition is that they make things more understandable.
Posting Permissions
- You may not post new threads
- You may not post replies
- You may not post attachments
- You may not edit your posts
-
Forum Rules
|
Click Here to Expand Forum to Full Width
|