掲示板システム
ホーム
アクセス解析
カテゴリ
ログアウト
exeファイルを終了させたい (ID:52852)
名前
ホームページ(ブログ、Twitterなど)のURL (省略可)
本文
void CMyDlg::OnButton1() { // TODO: この位置にコントロール通知ハンドラ用のコードを追加してください /*WinExec("notepad.exe",SW_SHOW); char cMsg[128]; wsprintf(cMsg, "メモ帳を使用しますか?"); int iMsg = MessageBox(cMsg,"メッセージボックス", MB_YESNO | MB_ICONQUESTION); if(iMsg==IDYES) { CDialog::OnCancel(); }*/ STARTUPINFO si; PROCESS_INFORMATION pi; ZeroMemory( &si, sizeof(si) ); si.cb = sizeof(si); ZeroMemory( &pi, sizeof(pi) ); // Start the child process. if( !CreateProcess( "notepad.exe", // No module name (use command line). "MyChildProcess", // Command line. NULL, // Process handle not inheritable. NULL, // Thread handle not inheritable. FALSE, // Set handle inheritance to FALSE. 0, // No creation flags. NULL, // Use parent's environment block. NULL, // Use parent's starting directory. &si, // Pointer to STARTUPINFO structure. &pi ) // Pointer to PROCESS_INFORMATION structure. ) { ErrorExit( "CreateProcess failed." ); } // Wait until child process exits. WaitForSingleObject( pi.hProcess, INFINITE ); // Close process and thread handles. CloseHandle( pi.hProcess ); CloseHandle( pi.hThread ); } -------------------------------------------------------------------- エラー:'ErrorExit' : 定義されていない識別子です。 とまたエラーが出てしまいました。 実際の所、ボタンを押したら本当はメモ帳ではなく、"wmplayer.exe" Windows Media Playerを立ち上げたいんです。 「Windows Media Playerを使用しますか??」とメッセージボックスを表示させ、「いいえ」を押したら、Windows Media Playerを終了させたいんですが…。
←解決時は質問者本人がここをチェックしてください。
戻る
掲示板システム
Copyright 2021 Takeshi Okamoto All Rights Reserved.