WINAPI.TXT: Windows API Declarations and Constants for VB

Last reviewed: September 25, 1997
Article ID: Q73694
1.00 2.00 3.00 WINDOWS kbprg kbfile

The information in this article applies to:

- Standard and Professional Editions of Microsoft Visual Basic for

  Windows, versions 2.0 and 3.0
- Microsoft Visual Basic programming system for Windows, version 1.0

SUMMARY

The file WINAPI.TXT supplies declarations for Microsoft Visual Basic programmers who want to call Windows API routines.

You can find WINAPI.EXE (size: 40811 bytes) 
                       , a self-extracting file, on these services:

  • Microsoft's World Wide Web site on the Internet

          On the www.microsoft.com home page, click the Support icon
          Click Knowledge Base, and select the product
    
          Enter kbfile WINAPI.EXE (size: 40811 bytes) 
                                 , and click GO!
          Open the article, and click the button to download the file
    
    
  • Internet (anonymous FTP)

          ftp ftp.microsoft.com
          Change to the Softlib/Mslfiles folder
          Get WINAPI.EXE (size: 40811 bytes) 
    
  • The Microsoft Network

          On the Edit menu, click Go To, and then click Other Location
          Type "mssupport" (without the quotation marks)
          Double-click the MS Software Library icon
          Find the appropriate product area
          Locate and Download WINAPI.EXE
    
  • Microsoft Download Service (MSDL)

          Dial (425) 936-6735 to connect to MSDL
          Download WINAPI.EXE (size: 40811 bytes) 
    

    For additional information about downloading, please see the following article in the Microsoft Knowledge Base:

       ARTICLE-ID: Q119591
       TITLE     : How to Obtain Microsoft Support Files from Online Services
    
    
    To use WINAPI.TXT, you need a reference for Windows API calls, such as the documentation provided with the Microsoft Windows Software Development Kit (SDK). If you don't have a reference manual for Windows API calls, you can obtain the Visual Basic add-on kit number 1-55615-413-5, "Microsoft Windows Programmer's Reference" and Online Resource (which includes WINAPI.TXT on disk), available from Microsoft for a fee.

    MORE INFORMATION

    WINAPI.TXT is an ASCII text file containing the functions and constants in the Microsoft Windows 3.0 API, declared in the format used by Microsoft Visual Basic.

    To use WINAPI.TXT, you must have the book "Microsoft Windows Programmer's Reference" for Windows version 3.0 (published by Microsoft Press, 1990), or you must have the reference manuals provided with the Microsoft Windows SDK.

    WINAPI.TXT includes the following:

    • External procedure declarations for all the Microsoft Windows API functions that can be called from Visual Basic.
    • Global constant declarations for all the constants used by the Microsoft Windows API.
    • Type declarations for the user-defined types (structures) used by the Microsoft Windows API.

    WINAPI.TXT is too large to be loaded directly into a Visual Basic module. Attempting to load it directly into Visual Basic will cause an "Out of Memory" error message.

    WINAPI.TXT is also too large for the Notepad editor supplied with Microsoft Windows, but it can be loaded by Microsoft Write. To use WINAPI.TXT, load it into an editor (such as Microsoft Write) that can handle large files. Copy the declarations you want and paste them into the global module in your Visual Basic application.

    NOTE: Some of the Windows API declarations are very long. Some editors will wrap these onto a second line, and will copy them as multiple lines rather than a single line. Declarations in Visual Basic cannot span lines, so if you paste these as multiple lines, Visual Basic will report an error. If an error occurs, you can either adjust the margins in the editor before copying or remove the line break after pasting.

    The global module is the recommended place for the declarations that you copy from the WINAPI.TXT file; however, you can place the external procedure declarations in the Declarations section of any form or module. You can also place the constant declarations anywhere in any module or form code if you remove the Global keyword. Type declarations must be placed in the global module.

    Once you have pasted the declaration for a Windows API routine (as well as any associated constant and type declarations) into your application, you can call that routine as you would call any Visual Basic procedure.

    For more information about declaring and calling external procedures, see Chapter 23, "Extending Visual Basic," in "Microsoft Visual Basic: Programmer's Guide."

    WARNING: Visual Basic cannot verify the data you pass to Microsoft Windows API routines. Calling a Microsoft Windows API routine with an invalid argument can result in unpredictable behavior: your application, Visual Basic, or Windows may crash or hang. When experimenting with Windows API routines, save your work often.


  • Additional reference words: 1.00 2.00 3.00 softlib
    KBCategory: kbprg kbfile
    KBSubcategory: APrgOther
    Keywords : APrgOther kbfile kbprg
    Version : 1.00 2.00 3.00
    Platform : WINDOWS


    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: September 25, 1997
    © 1998 Microsoft Corporation. All rights reserved. Terms of Use.