compiler error error C2228: left of '.AddTail' must have class/struct/union type
I use CList to store my define node but the compiler show this error C2228: left of '.AddTail' must have class/struct/union type message I don;t know what wrong with this error message. my code is as follow
TCHAR title[MAX_LEN];
TCHAR titlestring[MAX_LEN];
process_node node1;
if (IsWindowVisible(hWnd))
{
int n=GetWindowText(hWnd, title, MAX_LEN-1);
if(n>0)
{
_tcsncpy_s(titlestring,_countof(titlestring),(LPCTSTR)lparam,_TRUNCATE);
_tprintf(_T("title=%s\n"),title);
}
if(_tcsstr(title,titlestring)!=NULL)
{
DWORD id=0;
TCHAR name[MAX_LEN];
if(hWnd)
{
GetWindowThreadProcessId(hWnd,&id);
GetProcessName(id,name);
node1.ProcessID=id;
node1.ProcessName=name;
Pr开发者_开发技巧ocessList.AddTail(node1);
AfxMessageBox(_T("find"));
_tprintf(_T("title=%s,id=%ld,name=%s\n"), title,id,name);
return TRUE;//找完還要繼續找下一個因為有可能不只一個
}
}
}
return TRUE;
ProcessList just not declared. If it does declared somethere else you should add #include to you stdafx file.
You have this line of code:
ProcessList.AddTail(node1);
My guess is you need something like this line of code:
ProcessList myProcessList;
myProcessList.AddTail(node1);
精彩评论