rot_functions.h

来自「新版本TR1的stl」· C头文件 代码 · 共 446 行 · 第 1/2 页

H
446
字号
        COMSTL_ITF_CALL(prot)->Release(COMSTL_ITF_THIS0(prot));
    }

    return hr;
}

/** \brief [C only] Retrieves the last modification time of an object in the Running Object Table
 *
 * \ingroup group__library__utility__com
 *
 * Returns the time that an object was last modified. The object must have
 * previously been registered with the Running Object Table (ROT). This method
 * looks for the last change time recorded in the ROT.
 *
 * \param pmkObjectName Pointer to moniker on the object whose status is desired
 * \param lpfiletime Pointer to structure containing object's last change time
 * \return An HRESULT indicating success or failure
 */
STLSOFT_INLINE HRESULT comstl__Rot_GetTimeOfLastChange( LPMONIKER   pmkObjectName,
                                        FILETIME    *lpfiletime)
{
    LPRUNNINGOBJECTTABLE    prot;
    HRESULT                 hr = STLSOFT_NS_GLOBAL(GetRunningObjectTable)(0, &prot);

    if(SUCCEEDED(hr))
    {
        hr = COMSTL_ITF_CALL(prot)->GetTimeOfLastChange(COMSTL_ITF_THIS(prot) pmkObjectName, lpfiletime);

        COMSTL_ITF_CALL(prot)->Release(COMSTL_ITF_THIS0(prot));
    }

    return hr;
}

/** \brief [C only] Queries the current set of objects in the Running Object Table
 *
 * \ingroup group__library__utility__com
 *
 * Creates and returns a pointer to an enumerator that can list the monikers of
 * all the objects currently registered in the Running Object Table (ROT).
 *
 * \param ppenumMoniker Address of output variable that receives the IEnumMoniker interface pointer
 * \return An HRESULT indicating success or failure
 */
STLSOFT_INLINE HRESULT comstl__Rot_EnumRunning(IEnumMoniker **ppenumMoniker)
{
    LPRUNNINGOBJECTTABLE    prot;
    HRESULT                 hr = STLSOFT_NS_GLOBAL(GetRunningObjectTable)(0, &prot);

    if(SUCCEEDED(hr))
    {
        hr = COMSTL_ITF_CALL(prot)->EnumRunning(COMSTL_ITF_THIS(prot) ppenumMoniker);

        COMSTL_ITF_CALL(prot)->Release(COMSTL_ITF_THIS0(prot));
    }

    return hr;
}

/* /////////////////////////////////////////////////////////////////////////
 * Namespace
 */

#ifdef STLSOFT_DOCUMENTATION_SKIP_SECTION
namespace comstl
{
#endif /* !STLSOFT_DOCUMENTATION_SKIP_SECTION */

/* /////////////////////////////////////////////////////////////////////////
 * C++ functions
 */

#ifdef __cplusplus

/** \brief Registers an object in the Running Object Table
 *
 * \ingroup group__library__utility__com
 *
 * Registers an object and its identifying moniker in the Running Object Table (ROT).
 *
 * \param grfFlags Registration options
 * \param punkObject Pointer to the object being registered
 * \param pmkObjectName Pointer to the moniker of the object being registered
 * \param pdwRegister Pointer to the value identifying the registration
 * \return An HRESULT indicating success or failure
 */
inline HRESULT Rot_Register(DWORD       grfFlags,
                            LPUNKNOWN   punkObject,
                            LPMONIKER   pmkObjectName,
                            DWORD       *pdwRegister)
{
    return comstl__Rot_Register(grfFlags, punkObject, pmkObjectName, pdwRegister);
}

/** \brief Removes an object from the Running Object Table
 *
 * \ingroup group__library__utility__com
 *
 * Removes from the Running Object Table (ROT) an entry that was previously
 * registered by a call to Rot_Register().
 *
 * \param dwRegister Value identifying registration to be revoked
 * \return An HRESULT indicating success or failure
 */
inline HRESULT Rot_Revoke(DWORD dwRegister)
{
    return comstl__Rot_Revoke(dwRegister);
}

/** \brief Determines if object current in the Running Object Table
 *
 * \ingroup group__library__utility__com
 *
 * Determines whether the object identified by the specified moniker is
 * currently running. This method looks for the moniker in the Running Object
 * Table (ROT).
 *
 * \param pmkObjectName Pointer to the moniker of the object whose status is desired
 * \return An HRESULT indicating success or failure
 */
inline HRESULT Rot_IsRunning(LPMONIKER pmkObjectName)
{
    return comstl__Rot_IsRunning(pmkObjectName);
}

/** \brief Retrieves the object from the Running Object Table
 *
 * \ingroup group__library__utility__com
 *
 * Determines whether the object identified by the specified moniker is running,
 * and if it is, retrieves a pointer to that object. This method looks for the
 * moniker in the Running Object Table (ROT), and retrieves the pointer
 * registered there.
 *
 * \param pmkObjectName Pointer to the moniker of the object
 * \param ppunkObject Address of output variable that receives the IUnknown interface pointer
 * \return An HRESULT indicating success or failure
 */
inline HRESULT Rot_GetObject(   LPMONIKER   pmkObjectName,
                                LPUNKNOWN   *ppunkObject)
{
    return comstl__Rot_GetObject(pmkObjectName, ppunkObject);
}

/** \brief Retrieves the last modification time of a running object in the Running Object Table
 *
 * \ingroup group__library__utility__com
 *
 * Records the time that a running object was last modified. The object must
 * have previously been registered with the Running Object Table (ROT). This
 * method stores the time of last change in the ROT.
 *
 * \param dwRegister Value identifying registration being updated
 * \param lpfiletime Pointer to structure containing object's last change time
 * \return An HRESULT indicating success or failure
 */
inline HRESULT Rot_NoteChangeTime(  DWORD       dwRegister,
                                    FILETIME    *lpfiletime)
{
    return comstl__Rot_NoteChangeTime(dwRegister, lpfiletime);
}

/** \brief Retrieves the last modification time of an object in the Running Object Table
 *
 * \ingroup group__library__utility__com
 *
 * Returns the time that an object was last modified. The object must have
 * previously been registered with the Running Object Table (ROT). This method
 * looks for the last change time recorded in the ROT.
 *
 * \param pmkObjectName Pointer to moniker on the object whose status is desired
 * \param lpfiletime Pointer to structure containing object's last change time
 * \return An HRESULT indicating success or failure
 */
inline HRESULT Rot_GetTimeOfLastChange( LPMONIKER   pmkObjectName,
                                        FILETIME    *lpfiletime)
{
    return comstl__Rot_GetTimeOfLastChange(pmkObjectName, lpfiletime);
}

/** \brief Queries the current set of objects in the Running Object Table
 *
 * \ingroup group__library__utility__com
 *
 * Creates and returns a pointer to an enumerator that can list the monikers of
 * all the objects currently registered in the Running Object Table (ROT).
 *
 * \param ppenumMoniker Address of output variable that receives the IEnumMoniker interface pointer
 * \return An HRESULT indicating success or failure
 */
inline HRESULT Rot_EnumRunning(IEnumMoniker **ppenumMoniker)
{
    return comstl__Rot_EnumRunning(ppenumMoniker);
}

#endif /* __cplusplus */

/* /////////////////////////////////////////////////////////////////////////
 * Unit-testing
 */

#ifdef STLSOFT_UNITTEST
# include "./unittest/rot_functions_unittest_.h"
#endif /* STLSOFT_UNITTEST */

/* ////////////////////////////////////////////////////////////////////// */

#ifndef _COMSTL_NO_NAMESPACE
# if defined(_STLSOFT_NO_NAMESPACE) || \
     defined(STLSOFT_DOCUMENTATION_SKIP_SECTION)
} /* namespace comstl */
# else
} /* namespace stlsoft::comstl_project */
} /* namespace stlsoft */
# endif /* _STLSOFT_NO_NAMESPACE */
#endif /* !_COMSTL_NO_NAMESPACE */

/* ////////////////////////////////////////////////////////////////////// */

#endif /* !COMSTL_INCL_COMSTL_UTIL_H_ROT_FUNCTIONS */

/* ////////////////////////////////////////////////////////////////////// */

⌨️ 快捷键说明

复制代码Ctrl + C
搜索代码Ctrl + F
全屏模式F11
增大字号Ctrl + =
减小字号Ctrl + -
显示快捷键?