Microsoft KB Archive/210567

= OFF2000: Conversions for C Data Types in Visual Basic for Application =

Article ID: 210567

Article Last Modified on 10/11/2006

-

APPLIES TO


 * Microsoft Access 2000 Standard Edition

-



This article was previously published under Q210567



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



SUMMARY
This article describes some of the conversions between Visual Basic for Applications and C arguments.



MORE INFORMATION
The following are general data type conversions:

  hWnd            ByVal var As Long LPSTR          ByVal var As String hDC            ByVal var As Long WORD           ByVal var As Integer DWORD          ByVal var As Long INT            ByVal var As INT INT FAR *      intValue As Integer CHAR FAR *     ByVal var As String LONG           ByVal var As Long LONG FAR *     var As Long BYTE           ByVal var As Byte BOOL           ByVal var As Boolean 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 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 inf

Keywords: kbhowto kbprogramming KB210567

-

[mailto:TECHNET@MICROSOFT.COM Send feedback to Microsoft]

© Microsoft Corporation. All rights reserved.