GetItemState method

GetItemState method allows you to get file object state (hidden/visible) at the specified “hide list” index.

BOOL GetItemState(
LONG lItemIndex,
BOOL *pbState
);

Parameters   lItemIndex     [in] A zero-based “hide list” index of necessary item.   pbState     [out] A pointer to Boolean value that will hold file object state.

Return Values   GetItemState method returns TRUE if file object state was successfully retrieved and FALSE otherwise.

Remarks   pbState has TRUE value if file object is hidden and FALSE is file object is visible.

Code Example

 

// For instance, we would like to test Windows Notepad executable file 

extern CHideMyFoldersAx  m_ctrlHMFAx;

CString strFileName("c:\windows\notepad.exe");

//You MUST initialize BSTR value by NULL or your application will crash.

BSTR bstrFileName = NULL;      // initialize BSTR here
BOOL bItemState   = FALSE;

if(m_ctrlHMFAx.GetItemFile(i,&bstrFileName) && m_ctrlHMFAx.GetItemState(i,&bItemState)){
		CString strTmp(bstrFileName);
		strTmp += (" is ");
		strTmp += (bItemState? _T("Hidden"):_T("Visible"));
		MessageBox(strTmp);
}

 


See also

AddItem, RemoveAt, Clear, Count, GetItemFile, SetItemFile, SetItemState, Find