Process::Start( String::Concat(pstrStartupPathOn , patrOnlineExe) );

   private: System::Void menuItemInformation_Click(System::Object *  sender, System::EventArgs *  e)
   {
   
    ms->ShowDialog();
   
   }
   

private: System::Void HOCMNUFormMENU_Load(System::Object *  sender, System::EventArgs *  e)
   {
    this->ms=new HOCMNUFormINFO();

    patrOfflineExe = S"HVSOffline.exe";

    patrOnlineExe = S"HVSOnline.exe";

    pstrMN0101001_W = S"アプリケーションを終了して、よろしいですか?";

 

    pstrStartupPathOff = String::Concat(Application::StartupPath, S"\\OFF\\");
    pstrStartupPathOn = String::Concat(Application::StartupPath, S"\\ONL\\");


    pstrMN0101002_W = S"オンラインは動作中です。";

    pstrMN0101003_W = S"オフラインは動作中です。";
   }

private: System::Void buttonOffline_Click(System::Object *  sender, System::EventArgs *  e)
   {
    //オンライン畫面が開いているかどうか?
    bRequestInitialOwnershipOn = true;

    pMutexOn = new Mutex(bRequestInitialOwnershipOn,
         "HVSOnlineJSMutex",
         &bMutexWasCreatedOn);

    if (!(bRequestInitialOwnershipOn && bMutexWasCreatedOn))
    {
     pMutexOn->Close();
     MessageBox::Show(pstrMN0101002_W,
         S"HVS",
         MessageBoxButtons::OK,
         MessageBoxIcon::Warning);
     return ;
    }
    pMutexOn->ReleaseMutex();
    pMutexOn->Close();


    try
    {
    Process::Start( String::Concat(pstrStartupPathOff , patrOfflineExe) );

    }
    catch(Exception * e)
    {
     MessageBox::Show(e->Message, S"HVS");
    }
 
   }

private: System::Void buttonOnline_Click(System::Object *  sender, System::EventArgs *  e)
   {
    //オフライン畫面が開いているかどうか?
    bRequestInitialOwnershipOff = true;

    pMutexOff = new Mutex(bRequestInitialOwnershipOff,
        "HVSOfflineJSMutex",
        &bMutexWasCreatedOff);

    if (!(bRequestInitialOwnershipOff && bMutexWasCreatedOff))
    {
    pMutexOff->Close();
    MessageBox::Show(pstrMN0101003_W,
        S"HVS",
        MessageBoxButtons::OK,
        MessageBoxIcon::Warning);
    return ;
    }
    pMutexOff->ReleaseMutex();
    pMutexOff->Close();


    try
    {
     Process::Start( String::Concat(pstrStartupPathOn , patrOnlineExe)  );
    }
    catch( Exception * e)
    {
     MessageBox::Show(e->Message, S"HVS");
    }

   }

private: System::Void HOCMNUFormMENU_Closing(System::Object *  sender, System::ComponentModel::CancelEventArgs *  e)
   {
   String* caption = S"HVS";
   MessageBoxButtons buttons = MessageBoxButtons::YesNo;
   System::Windows::Forms::DialogResult result;
   ///確認メッセージを出力する。(メッセージID:-W)

   ///「キャンセル」の場合、畫面へ戻る。  
   result = MessageBox::Show(this,
          pstrMN0101001_W,
          caption,
          buttons,
          //EDIT BY FANG 20060304 START
          //MessageBoxIcon::Question,
          MessageBoxIcon::Warning,
          //EDIT BY FANG 20060304 END
          MessageBoxDefaultButton::Button1 );
      
   ///「OK」の場合、終了する。  
   if (result == DialogResult::No)
   {
    e->Cancel = true;
   }
   else
   {
    //オンライン畫面が開いているかどうか?
    bRequestInitialOwnershipOn = true;

    pMutexOn = new Mutex(bRequestInitialOwnershipOn,
         "HVSOnlineJSMutex",
         &bMutexWasCreatedOn);

    if (!(bRequestInitialOwnershipOn && bMutexWasCreatedOn))
    {
     pMutexOn->Close();
     MessageBox::Show(pstrMN0101002_W,
         S"HVS",
         MessageBoxButtons::OK,
         MessageBoxIcon::Warning);
     e->Cancel = true;
     return ;
    }
    pMutexOn->ReleaseMutex();
    pMutexOn->Close();

   

    //オフライン畫面が開いているかどうか?
    bRequestInitialOwnershipOff = true;

    pMutexOff = new Mutex(bRequestInitialOwnershipOff,
         "HVSOfflineJSMutex",
         &bMutexWasCreatedOff);

    if (!(bRequestInitialOwnershipOff && bMutexWasCreatedOff))
    {
     pMutexOff->Close();
     MessageBox::Show(pstrMN0101003_W,
         S"HVS",
         MessageBoxButtons::OK,
         MessageBoxIcon::Warning);
     e->Cancel = true;

     return ;
    }
    pMutexOff->ReleaseMutex();
    pMutexOff->Close();
   
   }

   }
private: System::Void menuItemClose_Click(System::Object *  sender, System::EventArgs *  e)
   {
    this->Close();
   }

 

發表評論
所有評論
還沒有人評論,想成為第一個評論的人麼? 請在上方評論欄輸入並且點擊發布.
相關文章