ACC: Conversions for C Data Types in Visual and Access Basic

Last reviewed: August 29, 1997
Article ID: Q96578
The information in this article applies to:
  • Microsoft Access versions 1.0, 1.1, 2.0, 7.0, 97

SUMMARY

Advanced: Requires expert coding, interoperability, and multiuser skills.

This article describes some of the conversions between Visual Basic for Applications in Microsoft Access 7.0 and 97 (or Access Basic in Microsoft Access versions 1.x and 2.0) and C arguments.

MORE INFORMATION

The following are general data type conversions:

   hWnd            ByVal var As Integer
   LPSTR           ByVal var As String
   hDC             ByVal var As Integer
   WORD            ByVal var As Integer
   DWORD           ByVal var As Long
   INT             ByVal var As Integer
   INT FAR *       var As Integer
   CHAR FAR *      ByVal var As String
   LONG            ByVal var As Long
   LONG FAR *      var As Long
   BYTE            ByVal var As Integer
   BOOL            ByVal var As Integer
   UNSIGNED SHORT  ByVal var As Integer
   UNSIGNED CHAR   ByVal var As Integer - must convert with Asc(var)
   UNSIGNED LONG   ByVal var As Long

The following list shows how to define the C data type in a Visual Basic for Applications or an Access Basic data type:

   BYTE, BOOL            Var As String * 1

   LPSTR, CHAR FAR *     Var As Long       - Use API lstrcpy() to get
                                             the string pointer.

   anything FAR *        Var As Long       - This does not give the correct
                                             data type but contains the
                                             correct number of bytes; you
                                             may have to convert.

The following list describes the differences returned from a function:

   LPSTR               Function As Long    - Use lstrcpy() to get the
                                             string from the pointer.


Additional query words: conversion
Keywords : kbprg PgmApi PgmDecl PgmOthr
Version : 1.0 1.1 2.0 7.0 97
Platform : WINDOWS
Hardware : x86
Issue type : kbinfo


THE INFORMATION PROVIDED IN THE MICROSOFT KNOWLEDGE BASE IS PROVIDED "AS IS" WITHOUT WARRANTY OF ANY KIND. MICROSOFT DISCLAIMS ALL WARRANTIES, EITHER EXPRESS OR IMPLIED, INCLUDING THE WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE. IN NO EVENT SHALL MICROSOFT CORPORATION OR ITS SUPPLIERS BE LIABLE FOR ANY DAMAGES WHATSOEVER INCLUDING DIRECT, INDIRECT, INCIDENTAL, CONSEQUENTIAL, LOSS OF BUSINESS PROFITS OR SPECIAL DAMAGES, EVEN IF MICROSOFT CORPORATION OR ITS SUPPLIERS HAVE BEEN ADVISED OF THE POSSIBILITY OF SUCH DAMAGES. SOME STATES DO NOT ALLOW THE EXCLUSION OR LIMITATION OF LIABILITY FOR CONSEQUENTIAL OR INCIDENTAL DAMAGES SO THE FOREGOING LIMITATION MAY NOT APPLY.

Last reviewed: August 29, 1997
© 1998 Microsoft Corporation. All rights reserved. Terms of Use.