Click here to Skip to main content
15,896,730 members
Please Sign up or sign in to vote.
0.00/5 (No votes)
See more:
Hi All,

I have a Form with almost 50 Items ( buttons, labels, Edit ...). I m looking for sth that give me the ability to act on those items by using a loop

C++
for (i =0; i< COUNT; i++)
{
   GetDlgItem( ITEM i );
}


thx
Posted

If your form is a CFormView derived class, you may use CWnd::GetNextDlgTabItem() and CWnd::GetNextDlgGroupItem().
 
Share this answer
 
Comments
Schehaider_Aymen 8-Feb-12 9:33am    
Thx You Jochen ;)
Why don't you use the EnumChildWindows[^] function?

Schehaider_Aymen wrote:
I don't even know how to use that function !
[update]
Well, you have the documentation, after all.
Roughly speaking you call EnumChildWindows passing a the handle of ythedialog and a function pointer. Then Windows will call your function many times, each time passing the handle of a different dialog's child window.
[/update]
 
Share this answer
 
v2
Comments
Schehaider_Aymen 8-Feb-12 8:27am    
I don't even know how to use that function !
Schehaider_Aymen 8-Feb-12 9:21am    
ok i did the EnumChildWindow as belolw :


BOOL CALLBACK EnumChildProc( HWND hwnd, LPARAM lParam )
{
int CtrlID = GetDlgCtrlID( hwnd );
GetDlgItem(CtrlID);
return TRUE;
}


and in the OnInitialupdate i added :


EnumChildWindows(GetSafeHwnd(),EnumChildProc, 0 );


But i think that int the pointed fuct i could not use teh GetDlgItem(CtrlID)->SetFont().

Confused !!!
CPallini 8-Feb-12 9:34am    
You may send the WM_SETFONT message:
http://msdn.microsoft.com/en-us/library/windows/desktop/ms632642(v=vs.85).aspx
Schehaider_Aymen 8-Feb-12 9:56am    
That's what i was looking for and in a fewer lines. Great Job, thk for the Help.

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)



CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900