IVsFindTarget.GetFindState(Object) Method
Definition
Important
Some information relates to prerelease product that may be substantially modified before it’s released. Microsoft makes no warranties, express or implied, with respect to the information provided here.
Determines the state of a previous Find operation.
public:
int GetFindState([Runtime::InteropServices::Out] System::Object ^ % ppunk);
int GetFindState([Runtime::InteropServices::Out] winrt::Windows::Foundation::IInspectable const & & ppunk);
public int GetFindState (out object ppunk);
abstract member GetFindState : obj -> int
Public Function GetFindState (ByRef ppunk As Object) As Integer
Parameters
- ppunk
- Object
[out, retval] The find state as pointer to IUnknown.
Returns
If the method succeeds, it returns S_OK. If it fails, it returns an error code.
Examples
A C++ class in VS can use a smart pointer, or use the following code to manage the Find state
// 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;
}
Remarks
COM Signature
From textmgr.idl:
HRESULT IVsFindTarget::GetFindState(
[out, retval] IUnknown **ppunk
);
Find state is an opaque object held on behalf of the find engine.