예제 #1
0
LRESULT 
CGeneralPage::OnInitDialog(HWND hwndFocus, LPARAM lParam)
{
	ATLASSERT(NULL != m_pDevice);

	m_edtDevName = GetDlgItem(IDC_DEVICE_NAME);
	m_edtDevId = GetDlgItem(IDC_DEVICE_ID);
	m_edtDevStatus = GetDlgItem(IDC_DEVICE_STATUS);
	m_edtDevWriteKey = GetDlgItem(IDC_DEVICE_WRITE_KEY);
	m_butAddRemoveDevWriteKey = GetDlgItem(IDC_ADD_WRITE_KEY);

	m_edtUnitDevStatus = GetDlgItem(IDC_UNITDEVICE_STATUS);
	m_edtUnitDevCapacity = GetDlgItem(IDC_UNITDEVICE_CAPACITY);
	m_edtUnitDevROHosts = GetDlgItem(IDC_UNITDEVICE_RO_HOSTS);
	m_edtUnitDevRWHosts = GetDlgItem(IDC_UNITDEVICE_RW_HOSTS);

	m_edtUnitDevType = GetDlgItem(IDC_UNITDEVICE_TYPE);

	m_wndUnitDevIcon = GetDlgItem(IDC_UNITDEVICE_TYPE_ICON);
	m_tvLogDev.Attach(GetDlgItem(IDC_LOGDEV_TREE));

	{
		// Temporary edit control to get an effective password character
		CEdit wndConceal;
		wndConceal.Create(m_hWnd, NULL, NULL, WS_CHILD | ES_PASSWORD);
		m_chConcealed = wndConceal.GetPasswordChar();
		wndConceal.DestroyWindow();
	}

	UpdateData();

	CancelToClose();

	return 0;
}
예제 #2
0
LRESULT 
CDeviceAddWriteKeyDlg::OnInitDialog(HWND hwndFocus, LPARAM lParam)
{
	CWindow wndDeviceName = GetDlgItem(IDC_DEVICE_NAME);
	CWindow wndDeviceId = GetDlgItem(IDC_DEVICE_ID);
	CEdit wndWriteKey = GetDlgItem(IDC_DEVICE_WRITE_KEY);
	

	TCHAR chPassword = _T('*');

	// Temporary edit control to get an effective password character
	{
		CEdit wndPassword;
		wndPassword.Create(m_hWnd, NULL, NULL, WS_CHILD | ES_PASSWORD);
		chPassword = wndPassword.GetPasswordChar();
		wndPassword.DestroyWindow();
	}

	CString strFmtDeviceId;
	pDelimitedDeviceIdString(strFmtDeviceId, m_strDeviceId, chPassword);

	wndDeviceName.SetWindowText(m_strDeviceName);
	wndDeviceId.SetWindowText(strFmtDeviceId);
	wndWriteKey.SetLimitText(NDAS_DEVICE_WRITE_KEY_LEN);

	m_butOK.Attach(GetDlgItem(IDOK));
	m_butOK.EnableWindow(FALSE);

	return TRUE;
}
예제 #3
0
LRESULT 
CNBTreeListView::OnCreate(LPCREATESTRUCT lpcs)
{
	//
	// Cache the password character
	//
	CEdit wnd;
	HWND hWnd = wnd.Create(m_hWnd, NULL, NULL, ES_PASSWORD);
	ATLASSERT(NULL != hWnd);
	m_chHidden = wnd.GetPasswordChar();
	BOOL fSuccess = wnd.DestroyWindow();
	ATLASSERT(fSuccess);

	// To call WM_CREATE message handler for CTreeListViewImpl
	SetMsgHandled(FALSE);
	return TRUE;
}
LRESULT 
CNdasDevicePropGeneralPage::OnInitDialog(HWND hwndFocus, LPARAM lParam)
{
	ATLASSERT(m_pDevice != 0);

	m_hCursor = AtlLoadSysCursor(IDC_ARROW);

	m_wndDeviceName.Attach(GetDlgItem(IDC_DEVICE_NAME));
	m_wndDeviceId.Attach(GetDlgItem(IDC_DEVICE_ID));
	m_wndDeviceStatus.Attach(GetDlgItem(IDC_DEVICE_STATUS));
	m_wndDeviceWriteKey.Attach(GetDlgItem(IDC_DEVICE_WRITE_KEY));
	m_wndAddRemoveWriteKey.Attach(GetDlgItem(IDC_ADD_WRITE_KEY));

	m_wndUnitDeviceGroup.Attach(GetDlgItem(IDC_UNITDEVICE_GROUP));
	m_wndUnitDeviceIcon.Attach(GetDlgItem(IDC_UNITDEVICE_TYPE_ICON));
	m_wndUnitDeviceType.Attach(GetDlgItem(IDC_UNITDEVICE_TYPE));
	m_wndUnitDeviceStatus.Attach(GetDlgItem(IDC_UNITDEVICE_STATUS));
	m_wndUnitDeviceCapacity.Attach(GetDlgItem(IDC_UNITDEVICE_CAPACITY));
	m_wndUnitDeviceROHosts.Attach(GetDlgItem(IDC_UNITDEVICE_RO_HOSTS));
	m_wndUnitDeviceRWHosts.Attach(GetDlgItem(IDC_UNITDEVICE_RW_HOSTS));
	m_wndLogDeviceTree.Attach(GetDlgItem(IDC_LOGDEV_TREE));

	m_wndUnitDeviceList = GetDlgItem(IDC_UNITDEVICE_LIST);

	// Temporary edit control to get an effective password character
	{
		CEdit wndPassword;
		wndPassword.Create(m_hWnd, NULL, NULL, WS_CHILD | ES_PASSWORD);
		m_chConcealed = wndPassword.GetPasswordChar();
		wndPassword.DestroyWindow();
	}

	BOOL fSuccess = m_imageList.CreateFromImage(
		IDB_UNITDEVICES, 
		32, 
		1, 
		CLR_DEFAULT, 
		IMAGE_BITMAP,
		LR_CREATEDIBSECTION | LR_DEFAULTCOLOR | LR_DEFAULTSIZE);
	ATLASSERT(fSuccess && "Loading IDB_UNITDEVICES failed");

	_GrabUnitDeviceControls();

	// get the bold font
	CFontHandle boldFont;
	{
		CFontHandle dlgFont = GetFont();
		LOGFONT logFont;
		dlgFont.GetLogFont(&logFont);
		logFont.lfWeight = FW_BOLD;
		ATLVERIFY(boldFont.CreateFontIndirect(&logFont));
	}

	m_wndUnitDeviceType.SetFont(boldFont);

	// Cover up control, be sure to create this after FillUnitDeviceControls()
	{
		CRect rect;
		m_wndUnitDeviceGroup.GetClientRect(&rect);
		::MapWindowPoints(m_wndUnitDeviceGroup, HWND_DESKTOP, reinterpret_cast<LPPOINT>(&rect), 2);
		::MapWindowPoints(HWND_DESKTOP, m_hWnd, reinterpret_cast<LPPOINT>(&rect), 2);
		rect.DeflateRect(10,50,10,10);
		m_wndNA.Create(m_hWnd, rect, NULL, WS_CHILD | SS_CENTER);
		CString str = MAKEINTRESOURCE(IDS_UNITDEVICE_NONE);
		ATLTRACE("NA: %ws\n", str);
		m_wndNA.SetWindowText(str);
		m_wndNA.SetFont(GetFont());
		m_wndNA.EnableWindow(FALSE);
	}
	{
		CRect rect;
		m_wndLogDeviceTree.GetWindowRect(&rect);
		::MapWindowPoints(HWND_DESKTOP, m_hWnd, reinterpret_cast<LPPOINT>(&rect), 2);
		// rect.DeflateRect(10,10,10,10);
		CString str = MAKEINTRESOURCE(IDS_LOGDEV_INFO_UNAVAILABLE);
		m_wndLogDeviceNA.Create(m_hWnd, rect, str, 
			WS_CHILD | WS_DISABLED | 
			BS_FLAT | BS_CENTER | BS_VCENTER | BS_TEXT);
		// m_wndLogDeviceNA.Create( Create(m_hWnd, rect, NULL, WS_CHILD | SS_CENTER, WS_EX_TRANSPARENT);
		ATLTRACE(_T("LogDevice N/A: %s"), str);
		// m_wndLogDeviceNA.SetWindowText(str);
		m_wndLogDeviceNA.SetFont(GetFont());
		m_wndLogDeviceNA.EnableWindow(FALSE);
	}

	_InitData();

	// Support F5 to refresh
	ACCEL accel = {0};
	accel.fVirt = FVIRTKEY;
	accel.key = VK_F5;
	accel.cmd = IDC_REFRESH_HOST;

	m_hAccel = ::CreateAcceleratorTable(&accel, 1);
	ATLASSERT(NULL != m_hAccel);

	return 0;
}