PrfCloseProfile

Call this function when you are done with a profile you have created with PrfOpenProfile. The Handle to an Initialization file (HINI) you pass to PrfCloseProfile will be then be invalid, and should not be used for any further API calls.

Syntax
PrfCloseProfile ( hini )

Parameters

 * HINI hini (input):Handle to an initialization file to close. This is any valid handle returned by PrfOpenProfile. Passing HINI_PROFILE, HINI_USERPROFILE, or HINI_SYSTEMPROFILE is not permitted.

Returns
BOOL bRC This return value is always either: If FALSE, you may use WinGetLastError to find out what went wrong. Possible errors PrfCloseProfile may incur:

Include Info
or or
 * 1) define INCL_WINSHELLDATA
 * 1) define INCL_WIN
 * 1) define INCL_PM
 * 2) include 

Gotchas
Don't pass the system or user profile handles to this function. They are opened initially by the operating system, and can't be closed by an application.

Sample Code
/* * Assume for the sake of this example that there exists two functions, *  one named RestOfProgram, which will contain everything after we *   get the profile opened, and WhineAboutErrors, which displays an *   error message, and terminates the program. */


 * 1) define INCL_WIN
 * 2) include

int main(void) {   HAB hab; HINI hiniMyProfile;

hab = WinInitialize(0); hiniMyProfile = PrfOpenProfile(hab, "MYPROF.INI");

if (hiniMyProfile != NULLHANDLE) RestOfProgram(hiniMyProfile); else WhineAboutErrors("Couldn't open profile.");

/* After RestOfProgram returns, close the profile we are done with. */

if (PrfCloseProfile(hiniMyProfile) == FALSE) WhineAboutErrors("Couldn't close profile.");

return(0); } /* main */