利用SendMessage,在2000中测试成功,但只是一个原理
// TODO: Add your control notification handler code here
UINT k=WinExec("rundll32.exe shell32.dll,Control_RunDLL desk.cpl",SW_SHOW);
if(k<32)
{
CString x;
x.Format("%d",k);
MessageBox(x); // 要在error后返回,下同
}
HWND wd=::FindWindow(NULL,"显示 属性");
if (wd==NULL)
MessageBox("Error1");
::ShowWindow(wd,SW_HIDE);
HWND wtd=FindWindowEx(wd,NULL,"SysTabControl32",NULL);
if (wtd==NULL)
MessageBox("Error2");
TabCtrl_SetCurFocus(wtd,2);
HWND wd1=FindWindowEx(wd,NULL,NULL,"外观");
if (wd1==NULL)
MessageBox("Error3");
HWND cb1=FindWindowEx(wd1,NULL,"ComboBox",NULL);
if (cb1==NULL)
MessageBox("Error4");
::SendMessage(cb1,CB_SELECTSTRING,-1,(long)"淡绿色");
long id=::GetDlgCtrlID(cb1);
::SendMessage(wd1,WM_COMMAND, MAKELONG(id,CBN_SELCHANGE),(long)cb1);
HWND cb2=FindWindowEx(wd1,cb1,"ComboBox",NULL);
if (cb2==NULL)
MessageBox("Error5");