If this is your first visit, be sure to check out the FAQ by clicking the link above. You may have to register before you can post: click the register link above to proceed. To start viewing messages, select the forum that you want to visit from the selection below. How do I use the following functions to get all handles of top level windows?
EnumDesktopWindows
EnumWindowsProc
The help provided in MSDN, is not that much helpful. I did not understand much of it...
Please help... CornedBee
"Writing specifications is like writing a novel. Writing code is like writing poetry."
- Anonymous, published by Raymond Chen
Don't PM me with your problems, I scan most of the forums daily. If you do PM me, I will not answer your question.
BOOL CALLBACK EnumWindowsProc( HWND hwnd, LONG lParam ); void CSendMessageTrialDlg::OnButton1() EnumWindows( (WNDENUMPROC)EnumWindowsProc, (LPARAM) 0); LRESULT CSendMessageTrialDlg::OnGreet(WPARAM p1, LPARAM p2) CEdit* pEdit = (CEdit* ) GetDlgItem( IDC_EDIT1); SetDlgItemText( IDC_EDIT1, "I Greet You!!! Hello.."); return 0; BOOL CALLBACK EnumWindowsProc( HWND hwnd, LONG lParam ) ::SendMessage( hwnd, WM_GREET, 0, 0); return TRUE; The one with line which have been boldfaced generates an error if it is replaced with this statement:
Code:
EnumWindows( EnumWindowsProc,  0 );
Why is this so? Because your EnumWindowsProc has the wrong parameters. As a general rule, if you need a cast when passing callbacks then something's wrong.
The second parameter must be LPARAM, not LONG. CornedBee
"Writing specifications is like writing a novel. Writing code is like writing poetry."
- Anonymous, published by Raymond Chen
Don't PM me with your problems, I scan most of the forums daily. If you do PM me, I will not answer your question.
Originally posted by CornedBee
Because your EnumWindowsProc has the wrong parameters. As a general rule, if you need a cast when passing callbacks then something's wrong.
The second parameter must be LPARAM, not LONG.
I actually changed long into LPARAM but it still generates errors I guess I overlooked something...
Anyway tnx for the advice... CornedBee
"Writing specifications is like writing a novel. Writing code is like writing poetry."
- Anonymous, published by Raymond Chen
Don't PM me with your problems, I scan most of the forums daily. If you do PM me, I will not answer your question.
Advertiser Disclosure: Some of the products that appear on this site are from companies from which TechnologyAdvice receives compensation. This compensation may impact how and where products appear on this site including, for example, the order in which they appear. TechnologyAdvice does not include all companies or all types of products available in the marketplace.