Skip to main content

Problem:

This example program demonstrates how to use the Windows SDK functions to read and write to a system .INI file.

These functions have been replaced by the Registry functions in 32-bit programs (see COBREG sample) but still exist to maintain compatibility with 16-bit programs. This program will read the WIN.INI file looking for the following entry: [NetExpressApp] NetExpressKey= If it finds the entry it will display the value associated with NetExpressKey. If it does not find the entry it will go ahead and create it and then read it back and display the value associated with NetExpressKey.

Resolution:

INTRODUCTION

==========

This example program demonstrates how to use the Windows SDK functions to read and write to a system .INI file. These functions have been replaced by the Registry functions in 32-bit programs (see COBREG sample) but still exist to main- tain compatibility with 16-bit programs.

This program will read the WIN.INI file looking for the following entry: [NetExpressApp]   NetExpressKey= If it finds the entry it will display the value associated with NetExpressKey. If it does not find the entry it will go ahead and create it and then read it back and display the value associated with NetExpressKey.

SOURCE FILES:

==========

Program Files         Description

-------------------     -----------------------------------------------------------

COBINI.CBL           program that calls the WINAPI functions to read and write to the system .INI

                              files.

MINIWIN.CPY        Copy file containing the Win32 API entry point names and environment

                              constants.

MPR.LIB                 Import library from the Windows SDK. This file is linked into COBINI.EXE to

                               resolve the references to the ProfileString functions. This is provided with the

                              Windows SDK. See requirements.

REQUIREMENTS:

==========

This sample should run in all environments providing that you have sufficient user rights to modify the system .INI files and Registry.

In order to link this program you need to install the Microsoft Windows 32-bit SDK. This CD-ROM is supplied with Net Express. The installation should create a directory MSTOOLS\\LIB directory. The project build settings for COBINI.EXE currently reference the file C:\\MSTOOLS\\LIB\\MPR.LIB. This import library is required in order to link this program as an .EXE. If you have the Windows SDK installed in a different location then you will need to modify the settings for COBINI.EXE under Project/Build Settings/Link/Advanced and change the location of MPR.LIB to point to the directory containing this file on your system.

OPERATION:

========

Rebuild this project to create the file cobini.exe. This is a character mode program that will display its progress to an application output window.

NOTE:

====

The file MPR.LIB is specified under Project/Build Settings/ Link/Advanced in the Link with these LIB's field. It must be included in any program that makes a call to one of the ProfileString functions.

==========================================================

Keywords: demonstration, sample, example, demo, win32 api, cobini.zip

demo.ex

demo.me

demo.ne

Attachments:

cobini.zip

Old KB# 4162