Directory Services |
The ADsPropCreateNotifyObj function is used to create, or obtain, a notification object for use by an Active Directory property sheet extension.
HRESULT ADsPropCreateNotifyObj( LPDATAOBJECT pAppThdDataObj, PWSTR pwzADsObjName, HWND* phNotifyObj );
The ADsPropCreateNotifyObj function is used in the implementation of an Active Directory property sheet extension. The extension must first request the CFSTR_DSOBJECTNAMES data from the IDataObject interface passed to IShellExtInit::Initialize by calling IDataObject::GetData. This provides the data object and object name required to call ADsPropCreateNotifyObj.
When the notification object is no longer required, a WM_ADSPROP_NOTIFY_EXIT message is sent to the notification object. This causes the notification object to destroy itself. When the WM_ADSPROP_NOTIFY_EXIT message is sent, the notification object handle should be considered invalid.
The following example shows how to use the ADsPropCreateNotifyObj function.
HWND CreateADsNotificationObject(IDataObject *pDataObject) { STGMEDIUM stm; FORMATETC fe; HRESULT hr; HWND hwndNotifyObject = NULL; if(NULL == pDataObject) { return NULL; } fe.cfFormat = RegisterClipboardFormat(CFSTR_DSOBJECTNAMES); if(0 == fe.cfFormat) { return NULL; } fe.ptd = NULL; fe.dwAspect = DVASPECT_CONTENT; fe.lindex = -1; fe.tymed = TYMED_HGLOBAL; hr = pDataObject->GetData(&fe, &stm); if(SUCCEEDED(hr)) { LPDSOBJECTNAMES pdson = (LPDSOBJECTNAMES)GlobalLock(stm.hGlobal); if(pdson) { LPWSTR pwszName = (LPWSTR)((LPBYTE)pdson + pdson->aObjects[0].offsetName); hr = ADsPropCreateNotifyObj(pDataObject, pwszName, &hwndNotifyObject); GlobalUnlock(stm.hGlobal); } ReleaseStgMedium(&stm); } return hwndNotifyObject; }
Client: Included in Windows XP and
Windows 2000 Professional.
Server: Included in Windows Server 2003 and
Windows 2000 Server.
Header: Declared in Adsprop.h.
Library: Use DsProp.lib.
IDataObject, IDataObject::GetData, IShellPropSheetExt::AddPages, CFSTR_DSOBJECTNAMES, WM_ADSPROP_NOTIFY_EXIT