Well actually this is how I get all the open windows into a menu...
Quote: remove the & from in front of WinProc. Functions are always passed by reference so the & symbol is not needed.
R. I didn't know that, thanks!
Quote: line 20: what is the value of WndList.size() at that point? Answer: 0 because it was emptied on line 15. Consequently lines 23 and 24 will never get executed.
Maybe things will clear up if you have a look at this -
WndList.push_back(hWnd2);
That's basically what is happening in EnumWindows(...). Every three seconds(202, this is in WM_TIMER - which is why I am using a number) a menu called WindowList lists all the windows in the taskbar. You should now be able to see why I use WndList.clear() to clear all the windows in the array; to get a fresh list of new ones.
Quote: line 9: why are you deleting the same menu multiple times? The first parameter is supposed to be HWND, don't know what WindowList is, but its value never changes inside that loop. Its possible that is whats producing the problem -
R. Soory, the first parameter is HMENU
Any ideas?
Thanks.