Hi Thanks for ur reply
I just changed code little bit like this
BOOL CGuiEzAutomator::GetBoolVal(const char* szWndName, const char* szTreeCtrlId)
{
BOOL bRet = FALSE;
TV_ITEM *tvi;
HWND hWnd = GetTreeViewHandleForDW(szWndName, szTreeCtrlId);
HANDLE hProcess = OpenProcessHandle(hWnd);
HGLOBAL hClipData = GlobalAlloc(GMEM_MOVEABLE | GMEM_DDESHARE, sizeof(TCHAR) * 10240);
LPTSTR pClipData = (LPTSTR) GlobalLock(hClipData);
pClipData[0] = 0;
if(NULL != hWnd)
{
int nCount = TreeView_GetCount(hWnd);
HTREEITEM hItem = TreeView_GetRoot( hWnd );
tvi=(TV_ITEM*)VirtualAllocEx(hProcess, NULL, sizeof(TV_ITEM), MEM_RESERVE | MEM_COMMIT, PAGE_READWRITE);
TVITEMEX item;
item.hItem = hItem;
item.mask = TVIF_TEXT | TVIF_HANDLE ;
item.pszText = (LPTSTR) (tvi + 1);
item.cchTextMax = 100;
while(item.hItem)
{
BOOL WRITE = WriteProcessMemory(hProcess, tvi, &item, sizeof(item), NULL);
if (BOOL ret = TreeView_GetItem(hWnd, tvi))
{
BOOL READ = ReadProcessMemory(hProcess, tvi, &pClipData[0], 1024, NULL);
CString csCurrentNode(pClipData);
if(csCurrentNode.CompareNoCase("Given Text //assuming ") == 0 )
{
bRet = TRUE;
}
}
item.hItem = TreeView_GetNextItem(hWnd, item.hItem, TVGN_NEXT);
}
VirtualFreeEx(hProcess, tvi, 0, MEM_RELEASE);
}
GlobalFree(hClipData);
CloseHandle(hProcess);
return bRet;
}
By doing this also i m getting the Text of the hItem
Not getting where i m lacking
Help! :)