Can anyone help me in this code

Hi to all well i have a following Code that gives me the Url and Title of all windows of IE and folders. what i want is to get the Url and Title of only current window if u can help me out or have another idea plz kindly do that thank you.

m_List.ResetContent();

IDispatchPtr spDisp;

long nCount = m_spSHWinds->GetCount();

//
// Enum all Shell Windows and list them
//
for (long i = 0; i < nCount; i++)
{
_variant_t va(i, VT_I4);

spDisp = m_spSHWinds->Item(va);

SHDocVw::IWebBrowser2Ptr spBrowser(spDisp);

if (spBrowser != NULL)
{
_bstr_t str = spBrowser->GetLocationName();
int index = m_List.AddString(str);
spBrowser->AddRef();
m_List.SetItemDataPtr(index,spBrowser);

}
}
[842 byte] By [librallguy] at [2007-11-19 18:29:12]
# 1 Re: Can anyone help me in this code
You can compare the window handles you get with that from GetForegroundWindow().
philkr at 2007-11-10 23:46:39 >
# 2 Re: Can anyone help me in this code
hi again well i tried to use it and i have included the file windows.h as well but i get the compilation error everytime

HWND currenthwnd,hwnd;
char s[1024];
hwnd=NULL;

TITLEBARINFO tbi;
tbi.cbSize = sizeof(TITLEBARINFO);


while (1)
{
currenthwnd=GetForegroundWindow();
if (currenthwnd!=hwnd)
{
hwnd=currenthwnd;
GetTitleBarInfo(hwnd, &tbi);

break;
}
}

Errors are

'TITLEBARINFO' : undeclared identifier
syntax error : missing ';' before identifier 'tbi'
error C2065: 'tbi' : undeclared identifier
error C2228: left of '.cbSize' must have class/struct/union type
error C2065: 'GetTitleBarInfo' : undeclared identifier

And if i use the it in my previous code

HWND currenthwnd,hwnd;

for (long i = 0; i < nCount; i++)
{
_variant_t va(i, VT_I4);

spDisp = m_spSHWinds->Item(va);

SHDocVw::IWebBrowser2Ptr spBrowser(spDisp);

currenthwnd = GetForegroundWindow();

//if (spBrowser != NULL)
if (spBrowser->HWND == currenthwnd)
{
_bstr_t str = spBrowser->GetLocationName();
int index = m_List.AddString(str);
spBrowser->AddRef();
m_List.SetItemDataPtr(index,spBrowser);

}
}

i get these errors so know what to do ?

'=' : cannot convert from 'class CWnd *' to 'struct HWND__ *'
==' : no conversion from 'struct HWND__ *' to 'long'
'==' : 'long' differs in levels of indirection from 'struct HWND__ *'
librallguy at 2007-11-10 23:47:44 >