发布网友
共2个回答
热心网友
// 添加一个回调函数
BOOL CALLBACK EnumWndProc( HWND hwnd, LPARAM lParam )
{
// lParam == 0
static char str[1024];
::GetWindowText( hwnd , str , 1024 );
TRACE( str );
TRACE( "\r\n" );
return TRUE;
}
// 然后在程序里,执行下面的语句,实现输出所有窗口名.
EnumWindows( EnumWndProc , 0 );
够清楚,够简单了吧?
热心网友
LRESULT CALLBACK WndProc( HWND hWnd, UINT message, WPARAM wParam, LPARAM lParam )
{
switch (message) {
case WM_CREATE: 这里写WM_CREATE时候的事件
case WM_PAINT: 这里写WM_PAINT时候的事件
......等等等等
default: break;
}
return ( DefWindowProc( hWnd, msg, wParam, lParam ) );
}