예제 #1
0
void ControlEvent::ClosePlayer()
{
	DeleteNotifyIcon(parenthwnd);
	::EndDialog(parenthwnd,NULL);
	::EndDialog(per_parenthwnd,NULL);
	PostQuitMessage(0);
}
/*!
 @brief リサイズイベント\n
 WM_SIZEで呼び出されます。

 @param [in]    nType  リサイズタイプ
 @param [in]    cx     幅
 @param [in]    cy     高さ
 */
void CInspectUsefulToolsDlg::OnSize(UINT nType, int cx, int cy)
{
	CDialog::OnSize(nType, cx, cy);

	// ツリービューの位置調整
	RECT stRect;
	if (m_inMenuTreeCtrl.m_hWnd != NULL) {
		m_inMenuTreeCtrl.GetWindowRect(&stRect);
		this->ScreenToClient(&stRect);
		stRect.bottom = stRect.top + cy;
		m_inMenuTreeCtrl.MoveWindow(&stRect);
	}

	if (m_inContentsTabCtrl.m_hWnd != NULL) {
		m_inContentsTabCtrl.GetWindowRect(&stRect);
		this->ScreenToClient(&stRect);
		stRect.bottom = stRect.top + cy;
		stRect.right = cx - 2;
		m_inContentsTabCtrl.MoveWindow(&stRect);

		CRect    rect;
		m_inContentsTabCtrl.GetClientRect(&rect);
		rect.OffsetRect(1, 3);
		rect.right -= 10;
		rect.bottom -= 9;

		POSITION nMapPosition = m_mapInnerDlg.GetStartPosition();
		while (nMapPosition != NULL) {
			CString strKey;
			void *pDialog;

			m_mapInnerDlg.GetNextAssoc(nMapPosition, strKey, pDialog);
			((CDialog *) pDialog)->MoveWindow(rect);
		}
	}

	if (nType == SIZE_MINIMIZED) {
		this->ShowWindow(SW_HIDE);
		AddNotifyIcon();
	} else {
		DeleteNotifyIcon();
	}
}
/*!
 @brief ウィンドウを閉じる際に呼び出されます。
*/
void CInspectUsefulToolsDlg::OnClose()
{
	if (m_bOpenBook == TRUE) {
		// Excel Bookが開いている場合は、閉じる
		COleVariant varNull;
		varNull.ChangeType(VT_NULL);

		try {
			m_inXLBook.Close(varNull, varNull, varNull);
		} catch (...) {

		}
		m_inXLBook.ReleaseDispatch();
		m_bOpenBook = FALSE;
	}

	if (m_bOpenXL == TRUE) {
		// Excelが開いている場合は、閉じる
		try {
			m_inXLApp.Quit();
		} catch (...) {

		}
		m_inXLApp.ReleaseDispatch();
		m_bOpenXL = FALSE;
	}


	if (strTempFilePath.IsEmpty() == FALSE) {
		// 一時ファイルを作成した場合は削除
		CFile::Remove(strTempFilePath);
	}

	DeleteNotifyIcon();

	CDialog::OnClose();
}
/*!
 @brief タスクトレイメニューの閉じるメニュー選択イベント
 */ 
void CInspectUsefulToolsDlg::OnMenuClose()
{
	DeleteNotifyIcon();

	this->OnOK();
}