//this is my example,maybe help you EnumChildWindows(hwnd,EnumChildProc,0);//hwnd is the parent window handleBOOL CALLBACK EnumChildProc(HWND hwndChild, LPARAM lParam) { char temp[100]; memset(temp,0,100); GetClassName(hwndChild, temp, sizeof(temp)); long l =GetWindowLong(hwndChild, GWL_STYLE); if(!strcmp(temp,_T("Edit")))// Edit输入框 { if(l & ES_READONLY) { ... } if(l & ES_PASSWORD) //普通密码输入框 { .. } } if(!strcmp(temp,_T("Static")) ) { .. } return TRUE; }
HWND FindWindowEx( HWND hwndParent, // handle to parent window HWND hwndChildAfter, // handle to a child window LPCTSTR lpszClass, // pointer to class name LPCTSTR lpszWindow // pointer to window name );
BOOL EnumChildWindows(
HWND hWndParent,
WNDENUMPROC lpEnumChildFunc,
LPARAM lParam
);在 EnumChildFunc 中 使用 (CWnd::FromHandle(hWnd))->IsKindof(RUNTIME_CLASS(CEdit));
EnumChildWindows(hwnd,EnumChildProc,0);//hwnd is the parent window handleBOOL CALLBACK EnumChildProc(HWND hwndChild, LPARAM lParam)
{
char temp[100];
memset(temp,0,100);
GetClassName(hwndChild, temp, sizeof(temp));
long l =GetWindowLong(hwndChild, GWL_STYLE); if(!strcmp(temp,_T("Edit")))// Edit输入框
{
if(l & ES_READONLY)
{
...
}
if(l & ES_PASSWORD) //普通密码输入框
{
..
}
}
if(!strcmp(temp,_T("Static")) )
{
..
}
return TRUE;
}
HWND hwndParent, // handle to parent window
HWND hwndChildAfter, // handle to a child window
LPCTSTR lpszClass, // pointer to class name
LPCTSTR lpszWindow // pointer to window name
);
while(pWnd)
{
pWnd = pWnd ->GetWindow(GW_HWNDNEXT);
}
这个很简单,记得给粉啊?
EnumChildWindows好久不来了,熟人都哪去了?