Posted on 2010-08-28 05:28
傅先生 阅读(178)
评论(0) 编辑 收藏 引用 所属分类:
各类常用接口
Window知料整理2010-08-09 19:17
1,
2,
3,
BOOL CALLBACK EnumWindowsProc(HWND hWnd, LPARAM lParam)
int main(){
EnumWindows( EnumWindowsProc, NULL );
}
BOOL CALLBACK EnumWindowsProc(HWND hWnd, LPARAM lParam)
{
if(::GetWindowLong(hWnd,GWL_STYLE) & WS_VISIBLE)
{
char sBuf[256];
//获取窗口标题
::GetWindowText( hWnd, sBuf, 256 );
if ( strcmp( sBuf, "我的电脑" ) == 0 )
{
//在发现我的电脑时设置其标题为www.a3gs.com
::SetWindowText( hWnd, "www.a3gs.com" );
}
char sclassname[256];
GetClassName(
hWnd,sclassname,256
);
if(strcmp(sclassname,"TXGuiFoundation")==0)
{
printf( "------------------------ \n");
printf( "%s -- %d\n --%s---%s \n", sBuf ,hWnd ,lParam,sclassname );
printf( " \n" );
}
m_hwndFind[m_num] = hWnd;
m_num++;
}
return 1;
}
HWND hWnd = GetForegroundWindow();//GetActiveWindow(); //'得到活动窗口的句柄
GetWindowText(hWnd,s_Buf,255);
printf("tttt %s \n",s_Buf);