Previous | Next |
You can use the IPropertyMap interface to retrieve properties from different context objects. For example, the user name property of the user context object can be retrieved through this interface. To get the user name from the user context object, you must:
The following code demonstrates how to retrieve the user name from the user context:
INSSUserContext* pUser;
//Declare a pointer that points to the user context object.
IPropertyMap* pIUserPropMap;
//Declare a pointer that points to the IpropertyMap interface.
HRESULT hres;
VARIANT UserName;
//Declare a VARIANT type of variable that will hold the user name.
VariantInit(&UserName);
//Call the VariantInit() method to initialize the variable
hres = pUser->QueryInterface(IID_IPropertyMap,
(void**) &pIUserPropMap);
//Pass in IID_IpropertyMap and get the address of a pointer that points
//to the interface.
hres = pIUserPropMap->Read(_T("NSS_USER_NAME"),
&userName);
//Retrieve the user name through the Read() method supported by the interface.
Note You must initialize the variable UserName before you call the Read() method each time you retrieve the user name property.
Previous | Next |