金牌会员
 
- 积分
- 1406

- 威望
- 692
- 贡献
- 288
- 兑换币
- 0
- 注册时间
- 2011-12-10
- 在线时间
- 213 小时
|
源代码就这么点。
void CEnableBtnDlg::OnCheckRun()
{
if(IsDlgButtonChecked(IDC_CHECK_RUN))
{
SetTimer(TIME_ID,1000,NULL);
}
else
{
KillTimer(TIME_ID);
}
}
BOOL CALLBACK EnumChildProc(
HWND hwnd, // handle to child window
LPARAM lParam // application-defined value
)
{
if(IsWindow(hwnd)&&!IsWindowEnabled(hwnd))
{
EnableWindow(hwnd,TRUE);
}
return TRUE;
}
void CEnableBtnDlg::OnTimer(UINT nIDEvent)
{
// TODO: Add your message handler code here and/or call default
if(nIDEvent == TIME_ID)
{
HWND hForeWnd = ::GetForegroundWindow();
if(IsWindow(hForeWnd))
{
EnumChildWindows(hForeWnd,EnumChildProc,0);
}
}
CDialog::OnTimer(nIDEvent);
}
|
|