Accessing all child windows from the main window
-
I have to get all the child windows from my main window. Once I have the hwnd How do I find out which window it is, I know I can call GetClassName on the hwnd but that's not good enough for me because most of my windows don't have names, I tried calling GetDlgCtrlID on the hwnd but it crashes because my hwnd is just enumerated. So what can I call to get either the resource ID of the window or some other information that will tell me which window it is. The following is the code I wrote to get the windows: if(!EnumChildWindows ( AfxGetMainWnd()->m_hWnd, EnumChildProc, NULL)) { TRACE("Unable to get child windows???\n"); return; } BOOL CALLBACK CMyDlg::EnumChildProc(HWND hwnd,LPARAM lParam) { TRACE ("Enumerated Child Window : %x\n", hwnd); } Is there some other function besides EnumChildWindows that can be used & will give me more useful data? Thanks in advance
-
I have to get all the child windows from my main window. Once I have the hwnd How do I find out which window it is, I know I can call GetClassName on the hwnd but that's not good enough for me because most of my windows don't have names, I tried calling GetDlgCtrlID on the hwnd but it crashes because my hwnd is just enumerated. So what can I call to get either the resource ID of the window or some other information that will tell me which window it is. The following is the code I wrote to get the windows: if(!EnumChildWindows ( AfxGetMainWnd()->m_hWnd, EnumChildProc, NULL)) { TRACE("Unable to get child windows???\n"); return; } BOOL CALLBACK CMyDlg::EnumChildProc(HWND hwnd,LPARAM lParam) { TRACE ("Enumerated Child Window : %x\n", hwnd); } Is there some other function besides EnumChildWindows that can be used & will give me more useful data? Thanks in advance
There are plenty of ways to accomplish this... You can iterate with GetWindowTop, GetNextWindow; To get class name: GetClassName If you are the one creating them make all windows support some protocol: make them all respond to some message like "WM_APP+100" with some value, or use existing message such as WM_GETTEXT. If not, install some hook via InitCommonControlSex.... Anyway... good luck
-
I have to get all the child windows from my main window. Once I have the hwnd How do I find out which window it is, I know I can call GetClassName on the hwnd but that's not good enough for me because most of my windows don't have names, I tried calling GetDlgCtrlID on the hwnd but it crashes because my hwnd is just enumerated. So what can I call to get either the resource ID of the window or some other information that will tell me which window it is. The following is the code I wrote to get the windows: if(!EnumChildWindows ( AfxGetMainWnd()->m_hWnd, EnumChildProc, NULL)) { TRACE("Unable to get child windows???\n"); return; } BOOL CALLBACK CMyDlg::EnumChildProc(HWND hwnd,LPARAM lParam) { TRACE ("Enumerated Child Window : %x\n", hwnd); } Is there some other function besides EnumChildWindows that can be used & will give me more useful data? Thanks in advance
Hi Rgarf! I am also exploring same area in which U are dwelling. Hope we both us have something for each other. Just be in touch. The solution to Ur problem is Use FindWindow and FindWindowEx. What my problem is if there are two edit controls in the same window how to uniquely identify them. Please, reply me if U knw. U can mail me in to_siddharth@indiatimes.com. Cheers!!!!!! Siddharth