部分代码如下:HWND hprint,hchild0,
hprint=FindWindow(NULL,"打印设置");//找到“打印设置”窗体
SendMessage(hprint,WM_SETFOCUS,NULL,NULL);
Sleep(200);
hchild0 = GetWindow(hprint,GW_CHILD);
GetWindowText(hchild0,title,20);//char title[20];
GetClassName(hchild0,strclass,20);//char strclass[20];
len0=_stricmp(title,"属性(&P)...");
while(len0 != 0)//找“属性”按钮
{
    hchild0 = GetWindow(hchild0,GW_HWNDNEXT);
    GetWindowText(hchild0,title,20);
    GetClassName(hchild0,strclass,20);
    len0=_stricmp(title,"属性(&P)...");
}
Sleep(200);
SendMessage(hchild0,WM_SETFOCUS,NULL,NULL);
Sleep(200);
SendMessage(hchild0,BM_CLICK,NULL,NULL);//按下“属性按钮”可程序运行到最后一句的时候就停下来了,但是如果我将按下“属性”按钮后弹出的对话框关闭,程序又能够运行,到底是那里出错了,请指教!