예제 #1
0
bool 
CToolWindow::TryToIntegrate(HWND hWnd)
{
	if (m_hWnd) return true; // this is singleton, integrate only first time

	CFindWnd finder(hWnd, TOOLBARCLASSNAME); // TODO: do it safer
	if (!finder.m_hWnd) return false;
	SubclassWindow(finder.m_hWnd);

	if (!::IsWindow(this->m_hWnd)) return true; // HACK
	CImageList il = GetImageList();
	m_IconBase = il.GetImageCount();
	il.AddIcon(LoadIcon(GetBaseModule().GetModuleInstance(), MAKEINTRESOURCE(IDI_XREFRESHA))); 
	il.AddIcon(LoadIcon(GetBaseModule().GetModuleInstance(), MAKEINTRESOURCE(IDI_XREFRESHZ))); 
	return true;
}
예제 #2
0
int CTaskDialog::CalculateButtonsExtent(void) const
{
	int cx = 0;

	// calculate custom buttons width

	for (DWORD cButton = 0; cButton < config_.cButtons; cButton++)
		cx += cx_spacing + CalculateButtonExtent(config_.pButtons[cButton].pszButtonText);

	// calculate common buttons width

	if (config_.dwCommonButtons & TDCBF_OK_BUTTON)
		cx += cx_spacing + CalculateButtonExtent(HeapResString(GetBaseModule().GetResourceInstance(), MAKEINTRESOURCEW(IDOK)));

	if (config_.dwCommonButtons & TDCBF_YES_BUTTON)
		cx += cx_spacing + CalculateButtonExtent(HeapResString(GetBaseModule().GetResourceInstance(), MAKEINTRESOURCEW(IDYES)));

	if (config_.dwCommonButtons & TDCBF_NO_BUTTON)
		cx += cx_spacing + CalculateButtonExtent(HeapResString(GetBaseModule().GetResourceInstance(), MAKEINTRESOURCEW(IDNO)));

	if (config_.dwCommonButtons & TDCBF_RETRY_BUTTON)
		cx += cx_spacing + CalculateButtonExtent(HeapResString(GetBaseModule().GetResourceInstance(), MAKEINTRESOURCEW(IDRETRY)));

	if (config_.dwCommonButtons & TDCBF_CANCEL_BUTTON)
		cx += cx_spacing + CalculateButtonExtent(HeapResString(GetBaseModule().GetResourceInstance(), MAKEINTRESOURCEW(IDCANCEL)));

	if (config_.dwCommonButtons & TDCBF_CLOSE_BUTTON)
		cx += cx_spacing + CalculateButtonExtent(HeapResString(GetBaseModule().GetResourceInstance(), MAKEINTRESOURCEW(IDCLOSE)));

	// return updated x-extent
	
	return cx - cx_spacing;
}
예제 #3
0
LRESULT 
CAboutBox::OnInitDialog( UINT uMsg, WPARAM wParam, LPARAM lParam, BOOL& bHandled )
{
	CAxDialogImpl<CAboutBox>::OnInitDialog(uMsg, wParam, lParam, bHandled);

	DLLVERSIONINFO dllVerInfo;
	ZeroMemory(&dllVerInfo, sizeof(DLLVERSIONINFO));
	dllVerInfo.cbSize  = sizeof(DLLVERSIONINFO);
	DllGetVersion(GetBaseModule().GetModuleInstance(), &dllVerInfo);
	TCHAR version[100];
	_stprintf_s(version, _T("%d.%d.%d"), dllVerInfo.dwMajorVersion, dllVerInfo.dwMinorVersion, dllVerInfo.dwBuildNumber);
	::SetWindowText(GetDlgItem(IDC_VERSION), version);

	::SetWindowText(GetDlgItem(IDC_PRODUCTID), PRODUCT_ID_TEXT);

	::SetWindowText(GetDlgItem(IDC_CREDITS), 
		_T("CodeProject.com team\n")
		_T("Armen Hakobyan\n")
		_T("..."));
	// set icons
	CIcon icon;
	icon.LoadIcon(IDI_ABOUTBOX);
	SetIcon(icon);

	m_Homepage.SetHyperLink(_T("http://www.upgradr.com"));
	m_Homepage.SetLabel(_T("www.upgradr.com"));
	//m_Homepage.SetToolTipText(_T("go to Upgradr homepage"));
	m_Homepage.SubclassWindow(GetDlgItem(IDC_HOMEPAGE));
	m_Homepage.SetExtendedStyle(HLINK_UNDERLINEHOVER);

	m_Support.SetHyperLink(_T("mailto:[email protected]"));
	m_Support.SetLabel(_T("*****@*****.**"));
	//m_Support.SetToolTipText(_T("send email to Upgradr support"));
	m_Support.SubclassWindow(GetDlgItem(IDC_SUPPORT));
	m_Support.SetExtendedStyle(HLINK_UNDERLINEHOVER);

	//HBITMAP hBmp = m_Homepage.AddBitmap(IDB_TOOLBAR);
	//ATLASSERT(hBmp);

	bHandled = TRUE;
	return 1;  // Let the system set the focus
}
예제 #4
0
int CTaskDialog::AddButtons(int x, int y, int /* cx */)
{
	// add custom buttons

	for (DWORD cButton = 0; cButton < config_.cButtons; cButton++) {
		AppendButton(config_.pButtons[cButton].pszButtonText, config_.pButtons[cButton].nButtonID, x, y);
		x += cx_spacing;
	}

	// add common buttons

	if (config_.dwCommonButtons & TDCBF_OK_BUTTON) {
		AppendButton(HeapResString(GetBaseModule().GetResourceInstance(), MAKEINTRESOURCEW(IDOK)), IDOK, x, y);
		x += cx_spacing;
	}

	if (config_.dwCommonButtons & TDCBF_YES_BUTTON) {
		AppendButton(HeapResString(GetBaseModule().GetResourceInstance(), MAKEINTRESOURCEW(IDYES)), IDYES, x, y);
		x += cx_spacing;
	}

	if (config_.dwCommonButtons & TDCBF_NO_BUTTON) {
		AppendButton(HeapResString(GetBaseModule().GetResourceInstance(), MAKEINTRESOURCEW(IDNO)), IDNO, x, y);
		x += cx_spacing;
	}

	if (config_.dwCommonButtons & TDCBF_RETRY_BUTTON) {
		AppendButton(HeapResString(GetBaseModule().GetResourceInstance(), MAKEINTRESOURCEW(IDRETRY)), IDRETRY, x, y);
		x += cx_spacing;
	}

	if (config_.dwCommonButtons & TDCBF_CANCEL_BUTTON) {
		AppendButton(HeapResString(GetBaseModule().GetResourceInstance(), MAKEINTRESOURCEW(IDCANCEL)), IDCANCEL, x, y);
		x += cx_spacing;
	}

	if (config_.dwCommonButtons & TDCBF_CLOSE_BUTTON) {
		AppendButton(HeapResString(GetBaseModule().GetResourceInstance(), MAKEINTRESOURCEW(IDCLOSE)), IDCLOSE, x, y);
		x += cx_spacing;
	}

	return cy_button;
}