c++builder 关闭系统计算器
用WinExec( "calc.exe ",SW_SHOW)打开了系统计算器,要用程序关闭已打开的计算器,应该怎样做???
[解决办法]
h=FindWindow(Handle,"计算器");
SendMessage(h,WM_CLOSE,0,0);
随手写的,试试。
[解决办法]
LZ对的找到计算器句柄,发送关闭消息或去找下对应的函数 雷同与打开一样WinExec( "calc.exe ",Clsoe)?
[解决办法]
SHELLEXECUTEINFO sei;// ---------------------------------------// 启动计算器void __fastcall TForm1::Button1Click(TObject *Sender){ ZeroMemory(&sei, sizeof(SHELLEXECUTEINFO)); sei.cbSize = sizeof(SHELLEXECUTEINFO); sei.fMask = SEE_MASK_NOCLOSEPROCESS; sei.hwnd = NULL; sei.lpVerb = NULL; sei.lpFile = "Calc.exe"; sei.lpParameters = ""; sei.lpDirectory = NULL; sei.nShow = SW_SHOW; sei.hInstApp = NULL; ShellExecuteEx(&sei);}// ---------------------------------------// 需要关闭计算器时void __fastcall TForm1::Button2Click(TObject *Sender){ TerminateProcess(sei.hProcess, 0);}
[解决办法]