龙盟编程博客 | 无障碍搜索 | 云盘搜索神器
快速搜索
主页 > 软件开发 > VC开发 >

VC程序设置桌面的分辨率(2)

时间:2009-12-30 15:42来源:未知 作者:admin 点击:
分享到:
return true; } bool SetSolution(const HWND hwndscroll,const HWND hwndtext,const char *so1,char *so2) { int n_con; char c_str[21]; char *n_po1; char *n_po2; if(hwndscroll==NULL||hwndtext==NULL) return f
 return true;
}

bool SetSolution(const HWND hwndscroll,const HWND hwndtext,const char *so1,char *so2)
{
    int n_con;
 char c_str[21];
 char *n_po1;
 char *n_po2;
   
 if(hwndscroll==NULL||hwndtext==NULL)
  return false;
 
    if(so1==NULL||so2==NULL)
  return false;
 
 n_con=0;
 while(n_con<20)
 {
  PostMessage(hwndscroll,WM_KEYDOWN,VK_DOWN,0);
  n_con++;
 }
   
 Sleep(1000);
 GetWindowText(hwndtext,c_str,20);
 n_po1=strstr(c_str,so1);
 n_po2=strstr(c_str,so2);
 n_con=0;
 while(((!n_po1||!n_po2)||(n_po1>n_po2))&&n_con<20)
 {
  PostMessage(hwndscroll,WM_KEYDOWN,VK_UP,0);
 
  Sleep(1000);
 
  GetWindowText(hwndtext,c_str,20);
  n_po1=strstr(c_str,so1);
  n_po2=strstr(c_str,so2);
  n_con++;
 }
 
 if(n_con==20)
  return false;
   
 return true;
}

bool GetOkWindow(const HWND hwnd,const PROCESS_INFORMATION pi,HWND &hwndok)
{
    DWORD d_pid;
 int n_con;
   
 if(hwnd==NULL)
  return false;
 
 n_con=0;
 while(n_con<20)
 {
  Sleep(1000);
  for(hwndok=GetWindow(GetDesktopWindow(),GW_CHILD);
  hwndok;
  hwndok=GetWindow(hwndok,GW_HWNDNEXT))
  {
   ::GetWindowThreadProcessId(hwndok,&d_pid);

精彩图集

赞助商链接