确定查找操作的状态。
命名空间: Microsoft.VisualStudio.TextManager.Interop
程序集: Microsoft.VisualStudio.TextManager.Interop(在 Microsoft.VisualStudio.TextManager.Interop.dll 中)
语法
声明
Function SetFindState ( _
pUnk As Object _
) As Integer
int SetFindState(
Object pUnk
)
int SetFindState(
[InAttribute] Object^ pUnk
)
abstract SetFindState :
pUnk:Object -> int
function SetFindState(
pUnk : Object
) : int
参数
pUnk
类型:Object[in]
返回值
类型:Int32
如果方法成功,则返回 S_OK。如果失败,它会返回一个错误代码。
备注
COM 签名
从 textmgr.idl:
HRESULT IVsFindTarget::SetFindState(
[in] IUnknown * punk
);
查找状态是委托查找引擎持有的不透明的对象。 在 Visual Studio 中对. c++ 类可以使用智能指针,或使用以下代码管理查找状态。
示例
对. c++ 类与可使用智能指针或使用以下代码管理查找状态
// Declare the following member
IUnknown * m_pUnkFindState;
// In constructor's member-initialization-list:
m_pUnkFindState(NULL)
// In destructor or ATL FinalRelease():
if (m_pUnkFindState)
{
m_pUnkFindState->Release();
m_pUnkFindState = NULL;
}
//
// method implementations
//
HRESULT MyClass::SetFindState (IUnknown * punk)
{
if (m_pUnkFindState)
{
m_pUnkFindState->Release();
m_pUnkFindState = NULL;
}
if (punk)
{
punk->AddRef();
m_pUnkFindState = punk;
}
return S_OK;
}
HRESULT MyClass::GetFindState (IUnknown **ppunk)
{
*ppunk = m_pUnkFindState;
if (m_pUnkFindState)
m_pUnkFindState->AddRef();
return S_OK;
}
.NET Framework 安全性
- 对直接调用方的完全信任。此成员不能由部分信任的代码使用。有关详细信息,请参阅通过部分受信任的代码使用库。