![]()
![]() Code
Code
HWND GetWindowHandleByPID(DWORD dwProcessID)
{
    HWND h = GetTopWindow(0);
    while ( h )
    {
        DWORD pid = 0;
        DWORD dwTheardId = GetWindowThreadProcessId( h,&pid);
        if (dwTheardId != 0)
        {
            if ( pid == dwProcessID/*your process id*/ )
            {
                // here h is the handle to the window
                return h;
            }
        }
        h = GetNextWindow( h , GW_HWNDNEXT);
    }
    return NULL;
}
 
		 
		posted @ 
2009-10-29 21:25 
凌点 
阅读(
3779) 
评论() 
 
收藏 
举报