没有合适的资源?快使用搜索试试~ 我知道了~
程序只有一个实例运行

共18个文件
h:4个
cpp:3个
rc2:1个

需积分: 32 3 下载量 128 浏览量
2011-10-09
10:37:59
上传
评论
收藏 25KB RAR 举报
温馨提示
限制程序只有一个实例运行 bool COneInstanceApp::CheckAppIsOpen() { bool bTheFirstOne = true;; ::SetLastError(NO_ERROR); ::CreateMutex(NULL, false, "My OneInstance"); if (::GetLastError() == ERROR_ALREADY_EXISTS) { bTheFirstOne = false; } if ( !bTheFirstOne ) { HWND hReporter = ::FindWindow(COneInstanceDlg::GetInstanceName(), NULL); for (;!(hReporter = ::FindWindow(COneInstanceDlg::GetInstanceName(), NULL));) Sleep(100); int sw; if (::IsZoomed(hReporter)) sw = SW_MAXIMIZE; else if (::IsIconic(hReporter)) sw = SW_RESTORE; else sw = SW_SHOW; ::ShowWindow(hReporter, sw); ::SetForegroundWindow(hReporter); return true; } return false; }
资源推荐
资源详情
资源评论













