Fonction ADsPropCreateNotifyObj (adsprop.h)

La fonction ADsPropCreateNotifyObj permet de créer ou d’obtenir un objet de notification à utiliser par une extension de feuille de propriétés services de domaine Active Directory.

Syntaxe

HRESULT ADsPropCreateNotifyObj(
  [in]  LPDATAOBJECT pAppThdDataObj,
  [in]  PWSTR        pwzADsObjName,
  [out] HWND         *phNotifyObj
);

Paramètres

[in] pAppThdDataObj

Pointeur vers l’objet IDataObject qui représente l’objet directory auquel la page de propriétés s’applique. Il s’agit de l’IDataObject passé à la méthode IShellExtInit ::Initialize de la page de propriétés.

[in] pwzADsObjName

Le nom de l’objet services de domaine Active Directory obtenu en appelant la méthode IDataObject ::GetData pour le format CFSTR_DSOBJECTNAMES presse-papiers sur l’objet IDataObject représenté par pAppThdDataObj.

[out] phNotifyObj

Pointeur vers une valeur HWND qui reçoit le handle de l’objet de notification.

Valeur retournée

Retourne S_OK en cas de réussite, ou une valeur d’erreur définie par OLE dans le cas contraire.

Remarques

La fonction ADsPropCreateNotifyObj est utilisée dans l’implémentation d’une extension de feuille de propriétés services de domaine Active Directory. L’extension doit d’abord demander les données CFSTR_DSOBJECTNAMES de l’interface IDataObject passées à IShellExtInit ::Initialize en appelant IDataObject ::GetData. Cela fournit l’objet de données et le nom d’objet requis pour appeler ADsPropCreateNotifyObj.

Lorsque l’objet de notification n’est plus nécessaire, un message WM_ADSPROP_NOTIFY_EXIT est envoyé à l’objet de notification. Cela entraîne la destruction de l’objet de notification. Lorsque le message WM_ADSPROP_NOTIFY_EXIT est envoyé, le handle de l’objet de notification doit être considéré comme non valide.

Exemples

L’exemple C++ suivant montre comment utiliser la fonction ADsPropCreateNotifyObj .

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;
}

Configuration requise

Condition requise Valeur
Client minimal pris en charge Windows Vista
Serveur minimal pris en charge Windows Server 2008
Plateforme cible Windows
En-tête adsprop.h
Bibliothèque Dsprop.lib
DLL Dsprop.dll

Voir aussi

CFSTR_DSOBJECTNAMES

Idataobject

IDataObject ::GetData

IShellPropSheetExt ::AddPages

WM_ADSPROP_NOTIFY_EXIT