What does this all mean?
this may be dum to you lot but i am learning to write game in VB and i would like to know what these things mean.
Kernel32
gdi32
and then there is this
option explicit
option base o
oh and
dim done as boolean
please help me.
Merlin the soon to be game magician!
Merlin the soon to be game magician!
Kernel32 and gdi32 are DLL files that are very important to Windows. They are used in VB when you want to declare external functions stored in the DLLs. My VB is a bit rusty so I can''t provide an example of such a statement. But an example of a function that many VBers do pull in from gdi32 is BitBlt (), which may be of interest to you if you''re doing a game.
option explicit and option base o I can''t recall the use of for the life of me. Sorry...
The last one:
dim done as boolean
is just a variable declaration. I''m hoping you were thrown off by the "boolean" part. A boolean is a type of variable that can have two values: true or false.
-Auron
option explicit and option base o I can''t recall the use of for the life of me. Sorry...
The last one:
dim done as boolean
is just a variable declaration. I''m hoping you were thrown off by the "boolean" part. A boolean is a type of variable that can have two values: true or false.
-Auron
As Auron stated, gdi32, and kernel32 are dll''s, which are sometimes linked to in VB.
Option explicit - I believe that this line will force a variable to be declared before getting used. Otherwise, you may mistype the name of a variable, and VB will still see it as a valid variable (Integer I believe). Using this can help avoid some headaches later on.
Option base 0 - This sets the default array base to 0. I think that VB defaults to a base of 1. Setting the base to 0, makes arrays behave like arrays in most other languages, where element 0 is the first element, with a base of 1, element 1 is the first element in the array.
i.e.
option base 0
dim array(6) as Integer
option base 1
dim array2(6)
array holds 7 elements from element 0 to 6, whereas array2 holds 6 elements from element 1 to 6.
J.W.
Option explicit - I believe that this line will force a variable to be declared before getting used. Otherwise, you may mistype the name of a variable, and VB will still see it as a valid variable (Integer I believe). Using this can help avoid some headaches later on.
Option base 0 - This sets the default array base to 0. I think that VB defaults to a base of 1. Setting the base to 0, makes arrays behave like arrays in most other languages, where element 0 is the first element, with a base of 1, element 1 is the first element in the array.
i.e.
option base 0
dim array(6) as Integer
option base 1
dim array2(6)
array holds 7 elements from element 0 to 6, whereas array2 holds 6 elements from element 1 to 6.
J.W.
thnx u two so when ever i start a project i should always put in option explicit in the forms declerations?
and use boolean wen?
Merlin the soon to be game magician!
and use boolean wen?
Merlin the soon to be game magician!
Merlin the soon to be game magician!
Yes, get in the habit of making VB yell at you when you don''t explicitly declare your variables..
But Option Base 0 is default. Unless you want to start messing with the people who read your code, i wouldn''t worry about this one.
You will want to use a boolean value when you need to test for a situation where it is either true or false. Initialization defaults the value to false...
For example:
Dim bContinueGame as Boolean
''bContinueGame = False
If bContinueGame = True Then
''continue the game
Else
''end the game
End If
You could use it for other things as well, you just need to be imaginative...
But Option Base 0 is default. Unless you want to start messing with the people who read your code, i wouldn''t worry about this one.
You will want to use a boolean value when you need to test for a situation where it is either true or false. Initialization defaults the value to false...
For example:
Dim bContinueGame as Boolean
''bContinueGame = False
If bContinueGame = True Then
''continue the game
Else
''end the game
End If
You could use it for other things as well, you just need to be imaginative...
------------------------------------------VOTE Patrick O'GradyWrite in Presidential CandidateThe Candidate who Cares.
Show''s how long it''s been since I''ve used VB. I thought that Option Base 1 was the default, but you''re right, it defaults to 0.
J.W.
J.W.
This topic is closed to new replies.
Advertisement
Popular Topics
Advertisement
Recommended Tutorials
Advertisement