ACC: How to Pass a Single Byte of Data to Windows API CallsLast reviewed: June 8, 1997Article ID: Q93141 |
The information in this article applies to:
SUMMARYAdvanced: Requires expert coding, interoperability, and multiuser skills. Microsoft Access versions 1.x and 2.0 do not have a single-byte data type. To pass a byte to an external function, such as a Windows application programming interface (API) function or a dynamic-link library (DLL) in Microsoft Access versions 1.x and 2.0, you should declare the byte as an integer. If you need to pass a single byte of information in a data type, such as the RGBQUAD structure, you should pass the data structure as a string type. NOTE: Microsoft Access for Windows 95 version 7.0 now has a Byte data type.
MORE INFORMATIONThe Intel chip supports only a full word on the stack. You cannot put just 8 bits on the stack; you must use the full 16 bits. If you attempt to pass only 8 bits, you will end up passing 16 bits (your 8 bits of data plus an additional 8 bits that will be "padded"). This is a limitation of the processor, not of Microsoft Access. To pass a single byte of data in a structure such as the RGBQUAD, use a fixed-length string of 1. For example, suppose you want to pass a single byte in the "C" RGBQUAD data structure, which looks like this:
typedef struct tagRGBQUAD{ BYTE rgbBlue; BYTE rgbGreen; BYTE rgbRed; BYTE rgbReserve; } RGBQUADYou can redefine this structure with Access Basic as:
Type RGBQUAD rgbBlue As String * 1 rgbGreen As String * 1 rgbRed As String * 1 rgbReserve As String * 1 End Type Dim RGB As RGBQUAD RGB.rgbBlue = Chr$(10) RGB.rgbRed = Chr$(14) RGB.rgbGreen = Chr$(15) NOTE: In the above example, Blue=10, Red=14, and Green=15. REFERENCESFor more information about this topic, search for "Type Statement" using the Microsoft Access Help menu.
|
Additional query words: windows api data type
© 1998 Microsoft Corporation. All rights reserved. Terms of Use. |