Skip to content

Latest commit

 

History

History
82 lines (62 loc) · 2.89 KB

GetProfileString.md

File metadata and controls

82 lines (62 loc) · 2.89 KB

Home

Function name : GetProfileString

Group: Registry - Library: kernel32


Retrieves the string associated with a key in the specified section of the Win.ini file.


Code examples:

Reading keys in the specified section of the Win.ini file
Retrieving list of supported paper names (for example, Letter or Legal) for a given printer
Printing text with the Escape function
Retrieving default spooling directory name
Retrieving the name of the default printer for the current user on the local computer (Win NT/XP)
How to retrieve the number of print jobs queued for the printer
Enumerating print jobs and retrieving information for default printer (JOB_INFO_1 structures)
How to retrieve configuration data for a specified printer stored in the registry (PrinterDriverData key)
How to delete all print jobs for a printer
Displaying printer-properties Property Sheet for the specified printer
Simple printer queue monitor: deletes, pauses, resumes print jobs for local printer
Configuring DEVMODE structure for a printer
Enumerating forms supported by a specified printer

Declaration:

DWORD GetProfileString(
  LPCTSTR lpAppName,        // section name
  LPCTSTR lpKeyName,        // key name
  LPCTSTR lpDefault,        // default string
  LPTSTR lpReturnedString,  // destination buffer
  DWORD nSize               // size of destination buffer
);  

FoxPro declaration:

DECLARE INTEGER GetProfileString IN kernel32;
	STRING   lpAppName,;
	STRING   lpKeyName,;
	STRING   lpDefault,;
	STRING @ lpReturnedString,;
	INTEGER  nSize  

Parameters:

lpAppName [in] Pointer to a null-terminated string that specifies the name of the section containing the key.

lpKeyName [in] Pointer to a null-terminated string specifying the name of the key whose associated string is to be retrieved.

lpDefault [in] Pointer to a null-terminated default string.

lpReturnedString [out] Pointer to a buffer that receives the character string.

nSize [in] Specifies the size, in TCHARs, of the buffer pointed to by the lpReturnedString parameter.


Return value:

The return value is the number of characters copied to the buffer, not including the null-terminating character.


Comments:

A section in the Win.ini file must have the following form:
[section]
key=string