- Appendix A: Data Types -


CHOOSECOLORS Type

Type CHOOSECOLORS
  lStructSize As Long
  hwndOwner As Long
  hInstance As Long
  rgbResult As Long
  lpCustColors As String
  flags As Long
  lCustData As Long
  lpfnHook As Long
  lpTemplateName As String
End Type
Variables declared with the CHOOSECOLORS type are designed to work with the ChooseColor function. It holds all the data passed to and returned from the function. The parameters you pass tell Windows how to make the ChooseColor box. (Note: In the API Text Viewer, this type is called CHOOSECOLOR. I have renamed it to avoid a conflict with the identically-named ChooseColor function.)
lStructSizeThe length in bytes of the variable (use the Len function).
hwndOwnerThe handle of the form calling the ChooseColor box.
hInstance?
rgbResultThe color chosen by the user, in RGB format.
lpCustColorsA string holding a numeric array's custom colors data converted into Unicode format using the StrConv function. For a clearer explanation, look at the example for the ChooseColor function itself.
flagsZero or more color dialog flags telling how to render the box.
lCustData?
lpfnHook?
lpTemplateName?
Used by: ChooseColor
Back to the index.


JOYCAPS Type

Type JOYCAPS
  wMid As Integer
  wPid As Integer
  szPname As String * 32
  wXmin As Long
  wXmax As Long
  wYmin As Long
  wYmax As Long
  wZmin As Long
  wZmax As Long
  wNumButtons As Long
  wPeriodMin As Long
  wPeriodMax As Long
End Type
Variable declared with this type are designed to hold information about a joystick. This is not to be confused with the current status of the joystick. This mainly holds the minumum and maximum values along the axes.
wMid?
wPid?
szPnameThe name of the joystick's device driver.
wXminThe minimum x-axis coordinate value.
wXmazThe maximum x-axis coordinate value.
wYminThe minimum y-axis coordinate value.
wYmaxThe maximum y-axis coordinate value.
wZminThe minimum z-axis coordinate value.
wZmaxThe maximum z-axis coordinate value.
wNumButtonsHow many buttons the joystick has.
wPeriodMin?
wPeriodMax?
Used by: joyGetDevCaps
Back to the index.


JOYINFO Type

Type JOYINFO
  wXpos As Long
  wYpos As Long
  wZpos As Long
  wButtons As Long
End Type
Variables declared with this type are designed to hold the current position of a joystick. It reads the x, y, and z axes and also the button status.
wXposThe current x-axis coordinate.
wYposThe current y-axis coordinate.
wZposThe current z-axis coordinate.
wButtonsThe status of the buttons. AND the value with 1 to test button 1, 2 for button 2, 4 for button 3, 8 for button 4, etc. A non-zero return value means that it is being pressed.
Used by: joyGetPos
Back to the index.


OPENFILENAME Data Type

Type OPENFILENAME
  lStructSize As Long
  hwndOwner As Long
  hInstance As Long
  lpstrFilter As String
  lpstrCustomFilter As String
  nMaxCustomFilter As Long
  nFilterIndex As Long
  lpstrFile As String
  nMaxFile As Long
  lpstrFileTitle As String
  nMaxFileTitle As Long
  lpstrInitialDir As String
  lpstrTitle As String
  flags As Long
  nFileOffset As Long
  nFileExtension As Long
  lpstrDefExt As String
  lCustData As Long
  lpfnHook As Long
  lpTemplateName As String
End Type
Variables declared with the OPENFILENAME are designed to be used with the two Windows 95 file dialog box API functions. The multitude of settings in the type are used both to tell Windows how to make the dialog box, as well as return the needed data to the program. (Note: vbNullChar is a Visual Basic constant)
lStructSizeThe size in bytes of the variable (use the Len function). Set this after setting all other parts of the variable.
hwndOwnerThe handle of the form using the file dialog box.
hInstance?
lpstrFilterFills in the File Type drop-down box. The format is "name of file type" & vbNullChar & "mask" & vbNullChar ... for as many types as you want. The end of it should be vbNullChar & vbNullChar. A mask sorts the files (such as *.txt or *.html or even *.*).
lpstrCustomFilter?
nMaxCustFilter?
nFilterIndexWhat data type of lpstrFilter should be the default. The first one is 1, the second 2, etc.
lpstrFileSet it as a series of blank spaces before the function call. A good size is at least Space(255), since it must be large enough to hold the filename and path. After, it holds file(s) selected. If one is selected, the path and filename are returned, followed by vbNullChar and a series of spaces. If multiple files are selected, the value is the path & vbNullChar & the first filename & the second filename ..., the last filename ending with 2 vbNullChars.
nMaxFileThe length in characters of lpstrFile when you first set it.
lpstrFileTitleVery similar to lpstrFile, this will hold only the filename of the selected file. Again, set it to at least Space(255). If multiple files are selected, this is not set to any useful value.
nMaxFileTitleThe length in characters of lpstrFileTitle
lpstrInitialDirThe directory to start in. If omitted, it looks in the current directory first.
lpstrTitleWhat appears in the title bar of the file dialog box (its caption property, basically).
flagsZero or more of the file dialog flags telling how to create the file dialog box.
nFileOffset?
nFileExtension?
lpstrDefExtThe default extension of a file (Save As box only). If the users saves a file with a *.* mask chosen in the file type box, the file gets this extension. Don't put a period on the extension. Also, the extension cannot be greater that 3 characters (a bug in Windows 95).
lCustData?
lpfnHook?
lpTemplateName?
Used by: GetOpenFileName, GetSaveFileName
Back to the index.


OSVERSIONINFO Type

Type OSVERSIONINFO
  dwOSVersionInfoSize As Long
  dwMajorVersion As Long
  dwMinorVersion As Long
  dwBuildNumber As Long
  dwPlatformId As Long
  szCSDVersion As String * 128
End Type
Variables defined with type OSVERSIONINFO are designed to hold version information for the version of Windows currently running. The various parts of OSVERSIONINFO hold different values stating the version number, platform, and other information about Windows.
dwOSVersionInfoSizeSet this to the size in bytes of the entire variable, i.e., Len(OSVERSIONINFOSIZE_variable).
dwMajorVersionThe part of the version number before the first period.
dwMinorVersionThe part of the version number after the first period.
dwBuildNumberThe build number of the version.
dwPlatformIDOne of the platform ID constants identifying which platform on Windows is running (for example, Windows 95 or Windows NT).
szCSDVersionA null-terminated string holding other information about the operating system.
Used by: GetVersionEx
Back to the index.


POINTAPI Type

Type POINTAPI
  x As Long
  y As Long
End Type
Variables declared with this type are designed to hold a point's coordinates.
xThe x-axis coordinate.
yThe y-axis coordinate.
Used by: GetCursorPos, MoveToEx
Back to the index.


RECT Type

Type RECT
  Left As Long
  Top As Long
  Right As Long
  Bottom As Long
End Type
Variables defined with type RECT are designed to hold some sort of rectangle. Oftentimes the information is the size of a window. The parts of RECT hold the coordinates of the extreme corners of the rectangle.
LeftThe x coordinate of the upper-left corner of the rectangle.
TopThe y coordinate of the upper-left corner of the rectangle.
RightThe x coordinate of the lower-right corner of the rectangle.
BottomThe y coordinate of the lower-right corner of the rectangle.
Used By: ClipCursor, CopyRect, EqualRect, GetClipCursor, GetWindowRect, InflateRect, IntersectRect, IsRectEmpty, OffsetRect, PtInRect, SetRect, SetRectEmpty, SubtractRect, UnionRect
Back to the index.


SYSTEMTIME Type

Type SYSTEMTIME
  wYear As Integer
  wMonth As Integer
  wDayOfWeek As Integer
  wDay As Integer
  wHour As Integer
  wMinute As Integer
  wSecond As Integer
  wMilliseconds As Integer
End Type
Variables defined with the SYSTEMTIME type are designed to hold very precise date and time information, down to the millisecond. There are two ways to store dates: absolute and relative. Absolute dates are "normal" dates, like January 15, 1998 or December 25, 2001. Relative dates are used when wYear is set to 0. In this case, the dates are of a form like "the first Sunday in June" or "the third Wednesday in November". In this case, wDay holds the first, second, third, fourth, or fifth information.
wYearIn an absolute date, the four-digit year. In a relative date, 0.
wMonthThe number of the month. 1 is January, 2 is February, 3 is March, etc.
wDayOfWeekThe number of the weekday. 0 is Sunday, 1 is Monday, 2 is Tuesday, etc.
wDayIn an absolute date, the number of the day (such as the 21 [of June]). In a relative date, 1 is the first, 2 is the second, all the way to 5 is the fifth/last.
wHourThe hour, in 24-hour format.
wMinuteThe minutes.
wSecondThe seconds.
wMillisecondsThe milliseconds (1000 milliseconds = 1 second).
Used by: GetLocalTime, GetSystemTime, TIME_ZONE_INFORMATION
Back to the index.


TIME_ZONE_INFORMATION Type

Type TIME_ZONE_INFORMATION
  Bias As Long
  StandardName(32) As Integer
  StandardDate As SYSTEMTIME
  StandardBias As Long
  DaylightName(32) As Integer
  DaylightDate As SYSTEMTIME
  DaylightBias As Long
End Type
Variables dimensioned with the TIME_ZONE_INFORMATION are designed to hold information about the computer's selected time zone. Normally, you don't have to worry about these settings, because Windows 95 keeps tract of daylight savings time and such. Interestingly (and aggravatingly) enough, the two arrays are actually C-style strings! In the C language (which Windows seems to mainly be written in), there are no string variables -- instead, numeric arrays are used, each value holding an ASCII value. This is how these two arrays work. To read them, start at the beginning and read the ASCII code one by one. The end of the string is marked by a null character (ASCII code 0), after which is garbage data. The example for GetTimeZoneInformation demonstrates how to read these strings.
BiasThe difference in minutes between UTC time and local time. In other words, UTC time = local time + Bias.
StandardName(32)A C-style string holding the name of the time zone in standard time.
StandardDateHolds the relative date when daylight savings time ends (if applicable).
StandardBiasA number to add to the Bias to form the bias during standard time.
DaylightName(32)A C-style string holding the name of the time zone in daylight savings time.
DaylightDateHolds the relative date when daylight savings time begins (if applicable).
DaylightBiasA number to add to the Bias to form the bias during daylight savings time (normally -60).
Used by: GetTimeZoneInformation
Back to the index.


Home
Paul Kuliniewicz
E-mail: Borg953@aol.com
All material presented on these pages is Copyright © Paul Kuliniewicz, except for other copyrighted material.
http://members.aol.com/Borg953/api/appa.html