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

ID: Q96578

The information in this article applies to:

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
Version           : 1.0 1.1 2.0 7.0 97
Platform          : WINDOWS
Hardware          : x86
Issue type        : kbinfo

Last Reviewed: November 20, 1998