Article ID: 187674 - View products that this article applies to.
This article was previously published under Q187674
This article has been archived. It is offered "as is" and will no longer be updated.
This article demonstrates how to get the value of a constant required by a Windows API function call if the constant is undocumented in the API Text Viewer. It shows how to declare this constant and value for use in Visual Basic. You can use this information to determine the value of a constant or verify that the values of the constants documented in the API Text Viewer are correct.
The API Text files that ship with Visual Basic document most of the API constants required by Visual Basic programmers. However, some API constants are not documented in these text files. To look up the constants used by API functions, you will need the header files shipped in Visual Studio 97, Visual C++, or the Platform SDK.
The Platform SDK can be downloaded from the following site:
When you run the self-extracting file, the header files are expanded into the \include directory.
These header files are the same ones used to create the DLL files containing the Windows API functions. This article assumes you are familiar with using Visual Basic to access the functions in the Windows API.
To find this value, use the Advanced tab of the Find Files menu item in the Start menu of the Windows operating system. If you are using the Active Desktop that is included with Internet Explorer 4.0, specify the Name & Location tab. After finding the appropriate header file, open this header file in a text editor with search capabilities, such as the WordPad program that ships with Windows.
Once you find the value of this constant, you declare it and its value in the appropriate place in your Visual Basic code. Our example will declare the constant in the General Declarations section of Form1.
For example, the function SHGetSpecialFoldersLocation returns the PIDL value of a specified special folder. To return the PIDL, the function requires the name of the special folder as one of the parameters. In our example, you want the PIDL value for the Drives special folders, which is defined in the SHLOBJ.H header file as CSIDL_DRIVES.
To Find the Value of a Constant
To Declare a Constant
Article ID: 187674 - Last Review: February 23, 2014 - Revision: 3.2
Contact us for more help
Connect with Answer Desk for expert help.