I have a question using the EnumWindows function.
What I'm trying to do:
I want to call EnumWindows and subsequently my EnumVisiWindowTitles function. EnumVisiWindowTitles should get each handle and title of all visible AND STORE THESE windows in the "lumpi" structure.
Later basically I want to access "lumpi" and find a specific signature string.
My problem is that I am unable to pass a pointer pointing to lumpi[0] on EnumVisiWindowTitles as LPARAM .
Perhaps my brilliant plan is not so bright, so if you could help me or show me a solution that performs the same task, I would be very happy for your help!
I have a main view:
int _tmain(int argc, _TCHAR* argv[]) { MYHANDLES lumpi[10]; EnumWindows(EnumVisiWindowTitles, (LPARAM) &lumpi[0]); blabla }
Myhandles is defined as:
#ifndef handlestruct_H #define handlestruct_H struct MYHANDLES { public: MYHANDLES();
And my EnumWindowsProc looks like this:
using namespace std; BOOL CALLBACK EnumVisiWindowTitles(HWND hWnd, LPARAM lumpi) { TCHAR String[200]; if (!hWnd) return TRUE;// Not a window, return TRUE to Enumwindows in order to get the next handle if (!::IsWindowVisible(hWnd)) return TRUE;// Not visible, return TRUE to Enumwindows in order to get the next handle if (!SendMessageW(hWnd, WM_GETTEXT, sizeof(String), (LPARAM)String)) return TRUE;// No window title, return TRUE to Enumwindows in order to get the next handle lumpi[lumpi[0].count].haendchen = hWnd; for (int n=0; n<201; n++)//copy the caption to lumpi struct { lumpi[lumpi[0].count].title[n] = String[n]; } lumpi[0].count++; //Increase counter wcout<<String<<'\n'; return true; //return true to get next handle }
I get the expression "Expression must have a pointer to the type of object" specified in each [0]
Arne
Lumpi source share