Currently viewing: GipsySoft » Front Page» Articles

CLoadLibrary

Wrapper class that allows exception safe and convienient calls to LoadLibray. Calls FreeLibrary when it goes out of scope.

Tested in UNICODE.

Example

#include <LoadLibrary.h>

...

CLoadLibrary lib( "Kernel32" );
if( lib.IsLoaded() )
{
	if( lib.GetProcAddress( "SomeFunction" ) )
	{
		//
		//	Do something with the library
	}
}

 

Click to view the source code

See also RealGetDiskFreeSpace for an example