How to Get Program Manager Group Names into Combo Box in VBLast reviewed: June 21, 1995Article ID: Q80410 |
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
SUMMARYTo get a list of group names in the Windows 3.0 Program Manager, you can call the Windows API GetPrivateProfileString function from a Visual Basic program. This article describes a method of using the Windows API GetPrivateProfileString function to get all the group names from Program Manager and place them into a Visual Basic combo box.
MORE INFORMATIONWindows initialization (.INI) files contain information that defines your Windows environment. Examples of Windows initialization files are WIN.INI and SYSTEM.INI, which are commonly found in the C:\WINDOWS subdirectory. Windows and Windows-based applications can use the information stored in these files to configure themselves to meet your needs and preferences. For a description of initialization files, read the WININI.TXT file that comes with Microsoft Windows 3.0. An initialization file is composed of at least an application name and a key name. The contents of Windows initialization files have the following format:
[Application name] keyname=valueThe GetPrivateProfile family of API functions are used to retrieve information from any initialization file that you specify. To declare this API function within your program, include the following Declare statement in the global module or the general Declarations section of a Visual Basic form. The entire Declare statement must be on one, single line.
Declare Function GetPrivateProfileString% Lib "Kernel" (ByVal lpAppName$, ByVal lpKeyName$, ByVal lpDefault$, ByVal lpReturnedString$, ByVal nSize%, ByVal lpFileName$)The formal arguments to these functions are described as follows:
Argument Description
lpAppName$ Name of a Windows-based application that appears in the .INI file. lpKeyName$ Key name that appears in the .INI file. lpFileName$ Points to a string that names the .INI file. If lpFileName does not contain a path to the file, Windows searches for the file in the Windows directory. lpDefault$ Specifies the default value for the given key if the key cannot be found in the .INI file.lpReturnedString$ Specifies the buffer that receives the character string. nSize% Specifies the maximum number of characters (including the last null character) to be copied to the buffer. Code ExampleTo get the group names from Program Manager into a combo box, do the following:
|
Additional reference words: 1.00 2.00 3.00
© 1998 Microsoft Corporation. All rights reserved. Terms of Use. |