// This source code is provided as MFC sample to use the XCD Library.
// Copyright � 2011 MSB LLC. All rights reserved.
#include "stdafx.h"
#include "XCD_Client_MFC.h"
#include "XCD_Client_MFCDlg.h"
#ifdef _DEBUG
#define new DEBUG_NEW
#endif
class CAboutDlg : public CDialog
{
public:
CAboutDlg();
// Dialog Data
enum { IDD = IDD_ABOUTBOX };
protected:
virtual void DoDataExchange(CDataExchange* pDX); // DDX/DDV support
// Implementation
protected:
DECLARE_MESSAGE_MAP()
};
CAboutDlg::CAboutDlg() : CDialog(CAboutDlg::IDD)
{
}
void CAboutDlg::DoDataExchange(CDataExchange* pDX)
{
CDialog::DoDataExchange(pDX);
}
BEGIN_MESSAGE_MAP(CAboutDlg, CDialog)
END_MESSAGE_MAP()
// CXCD_Client_MFCDlg dialog
CXCD_Client_MFCDlg::CXCD_Client_MFCDlg(CWnd* pParent /*=NULL*/)
: CDialog(CXCD_Client_MFCDlg::IDD, pParent)
, m_strCARFileFFN(_T(""))
, m_strCollection_Title(_T(""))
, m_strCollection_ItemCount(_T(""))
, m_strCollection_Version(_T(""))
, m_strCollection_XCDVersion(_T(""))
, m_strEditItem(_T(""))
{
m_hIcon = AfxGetApp()->LoadIcon(IDR_MAINFRAME);
}
void CXCD_Client_MFCDlg::DoDataExchange(CDataExchange* pDX)
{
CDialog::DoDataExchange(pDX);
DDX_Text(pDX, IDC_EDIT_FFN, m_strCARFileFFN);
DDX_Text(pDX, IDC_STATIC_COLLECTION_TITLE, m_strCollection_Title);
DDX_Text(pDX, IDC_STATIC_COLLECTION_COUNT, m_strCollection_ItemCount);
DDX_Text(pDX, IDC_STATIC_COLLECTION_VERSION, m_strCollection_Version);
DDX_Text(pDX, IDC_STATIC_COLLECTION_XCDVERSION, m_strCollection_XCDVersion);
DDX_Text(pDX, IDC_EDIT_ITEM, m_strEditItem);
// Controls.
DDX_Control(pDX, IDC_SPIN, m_ctlSpin);
DDX_Control(pDX, IDC_COMBO, m_ctlComboBox);
}
BEGIN_MESSAGE_MAP(CXCD_Client_MFCDlg, CDialog)
ON_WM_SYSCOMMAND()
ON_WM_PAINT()
ON_WM_QUERYDRAGICON()
//}}AFX_MSG_MAP
ON_BN_CLICKED(IDC_BUTTON_SELECTFILE,
&CXCD_Client_MFCDlg::OnBnClickedButtonSelectfile)
ON_BN_CLICKED(IDC_BUTTON_SHOWLEGEND,
&CXCD_Client_MFCDlg::OnBnClickedButtonShowlegend)
ON_BN_CLICKED(IDC_BUTTON_GETPICTURETITLE,
&CXCD_Client_MFCDlg::OnBnClickedButtonGetpicturetitle)
ON_BN_CLICKED(IDC_BUTTON_SHOWPICTURE,
&CXCD_Client_MFCDlg::OnBnClickedButtonShowpicture)
ON_BN_CLICKED(IDC_BUTTON_GETVALUE,
&CXCD_Client_MFCDlg::OnBnClickedButtonGetvalue)
ON_BN_CLICKED(IDC_BUTTON_GETDATA,
&CXCD_Client_MFCDlg::OnBnClickedButtonGetdata)
ON_BN_CLICKED(IDC_BUTTON_RESIZE,
&CXCD_Client_MFCDlg::OnBnClickedButtonResize)
ON_EN_KILLFOCUS(IDC_EDIT_ITEM, &CXCD_Client_MFCDlg::OnEnKillfocusEditItem)
ON_NOTIFY(NM_CLICK, IDC_SYSLINK, &CXCD_Client_MFCDlg::OnNMClickSyslink)
END_MESSAGE_MAP()
// CXCD_Client_MFCDlg message handlers
BOOL CXCD_Client_MFCDlg::OnInitDialog()
{
CDialog::OnInitDialog();
// Add "About..." menu item to system menu.
// IDM_ABOUTBOX must be in the system command range.
ASSERT((IDM_ABOUTBOX & 0xFFF0) == IDM_ABOUTBOX);
ASSERT(IDM_ABOUTBOX < 0xF000);
CMenu* pSysMenu = GetSystemMenu(FALSE);
if (pSysMenu != NULL)
{
CString strAboutMenu;
strAboutMenu.LoadString(IDS_ABOUTBOX);
if (!strAboutMenu.IsEmpty())
{
pSysMenu->AppendMenu(MF_SEPARATOR);
pSysMenu->AppendMenu(MF_STRING, IDM_ABOUTBOX, strAboutMenu);
}
}
// Set the icon for this dialog. The framework does this automatically
// when the application's main window is not a dialog
SetIcon(m_hIcon, TRUE); // Set big icon
SetIcon(m_hIcon, FALSE); // Set small icon
// Initialize the sample to use the XCD library.
Initialize();
return TRUE; // return TRUE unless you set the focus to a control
}
void CXCD_Client_MFCDlg::OnSysCommand(UINT nID, LPARAM lParam)
{
if ((nID & 0xFFF0) == IDM_ABOUTBOX)
{
CAboutDlg dlgAbout;
dlgAbout.DoModal();
}
else
{
CDialog::OnSysCommand(nID, lParam);
}
}
void CXCD_Client_MFCDlg::Initialize()
{
RECT rc;
// Create the XCD objects and get pointers to the objects.
CoInitialize(NULL);
m_pCollection = NULL;
CoCreateInstance(__uuidof(Collection), NULL, CLSCTX_INPROC_SERVER,
__uuidof(ICollection), reinterpret_cast<void**>(&m_pCollection));
m_pCar = NULL;
CoCreateInstance(__uuidof(Car), NULL, CLSCTX_INPROC_SERVER,
__uuidof(ICar), reinterpret_cast<void**>(&m_pCar));
// Creare preview window to show pictures.
CreatePreviewWindow();
m_ctlComboBox.SetCurSel(0);
// Position window.
GetWindowRect(&rc);
SetWindowPos(NULL, 0, 0, rc.right - rc.left - 350,
DIALOG_HEIGHT_COLLAPSED, SWP_NOZORDER | SWP_NOMOVE);
// Diable some buttons before CAR file is selected.
GetDlgItem(IDC_BUTTON_GETPICTURETITLE)->EnableWindow(FALSE);
GetDlgItem(IDC_BUTTON_SHOWPICTURE)->EnableWindow(FALSE);
GetDlgItem(IDC_BUTTON_GETVALUE)->EnableWindow(FALSE);
GetDlgItem(IDC_BUTTON_GETDATA)->EnableWindow(FALSE);
// Position car groupbox.
::GetWindowRect(GetDlgItem(IDC_STATIC_CARGROUPBOX)->m_hWnd, &rc);
rc.bottom = rc.bottom - 265;
::SetWindowPos(GetDlgItem(IDC_STATIC_CARGROUPBOX)->m_hWnd,
NULL, 0, 0, rc.right - rc.left, rc.bottom - rc.top,
SWP_NOZORDER | SWP_NOMOVE);
}
// If you add a minimize button to your dialog, you will need the code below
// to draw the icon. For MFC applications using the document/view model,
// this is automatically done for you by the framework.
void CXCD_Client_MFCDlg::OnPaint()
{
if (IsIconic())
{
CPaintDC dc(this); // device context for painting
SendMessage(WM_ICONERASEBKGND, reinterpret_cast<WPARAM>(dc.GetSafeHdc()), 0);
// Center icon in client rectangle
int cxIcon = GetSystemMetrics(SM_CXICON);
int cyIcon = GetSystemMetrics(SM_CYICON);
CRect rect;
GetClientRect(&rect);
int x = (rect.Width() - cxIcon + 1) / 2;
int y = (rect.Height() - cyIcon + 1) / 2;
// Draw the icon
dc.DrawIcon(x, y, m_hIcon);
}
else
{
CDialog::OnPaint();
// Draw function prototypes as help in the expanded area.
DrawLegend();
}
}
// The system calls this function to obtain the cursor to display while the user drags
// the minimized window.
HCURSOR CXCD_Client_MFCDlg::OnQueryDragIcon()
{
return static_cast<HCURSOR>(m_hIcon);
}
void CXCD_Client_MFCDlg::OnBnClickedButtonSelectfile()
{
USES_CONVERSION;
CComBSTR bstrFFN;
VARIANT_BOOL bCarFile;
OPENFILENAME ofn;
TCHAR szFFN[MAX_PATH];
USHORT nCount;
BSTR bstrCollectionTitle;
BSTR bstrXCDVersion;
BSTR bstrCollectionVersion;
// Avoid arbitrary symbols in File Name on dialog activation.
ZeroMemory(szFFN, sizeof(szFFN));
ZeroMemory(&ofn, sizeof(ofn));
ofn.lStructSize = sizeof(OPENFILENAME);
ofn.hwndOwner = this->m_hWnd;
ofn.hInstance = NULL;
ofn.lpstrFilter = _T("CAR Files (*.car)\0\0");
ofn.lpstrCustomFilter = NULL;
ofn.nMaxCustFilter = 0;
ofn.nFilterIndex = 0;
ofn.lpstrFile = szFFN; // gets selected full file name
ofn.nMaxFile = MAX_PATH;
ofn.lpstrFileTitle = NULL;
ofn.nMaxFileTitle = 0;
ofn.lpstrTitle = _T("Select Car Collection File");
ofn.Flags = OFN_EXPLORER | OFN_FILEMUSTEXIST |
OFN_PATHMUSTEXIST;
ofn.nFileOffset = 0;
ofn.nFileExtension = 0;
ofn.lpstrDefExt = NULL;
ofn.lCustData = 0;
ofn.lpfnHook = NULL;
ofn.lpTemplateName = NULL;
if (GetOpenFileName(&ofn))
{
m_strCARFileFFN = szFFN; // dialog update
bstrFFN = szFFN;
m_pCollection->put_FFN(bstrFFN.m_str);
m_pCollection->IsCarFile(&bCarFile);
if (bCarFile)
{
m_pCollection->GetCount(&nCount);
m_strCollection_ItemCount.Format(_T("%d"), nCount);
m_pCollection->GetTitle(&bstrCollectionTitle);
m_strCollection_Title = OLE2A(bstrCollectionTitle);
m_pCollection->GetXCDVersion(&bstrXCDVersion);
m_strCollection_XCDVersion = OLE2A(bstrXCDVersion);
m_pCollection->GetVersion(&bstrCollectionVersion);
m_strCollection_Version = OLE2A(bstrCollectionVersion);
m_strEditItem = "0";
m_ctlSpin.SetRange(0, _tstoi(m_strCollection_ItemCount) - 1);
UpdateData(FALSE);
// Enable buttons if a CAR file.
GetDlgItem(IDC_BUTTON_GETPICTURETITLE)->EnableWindow(TRUE);
GetDlgItem(IDC_BUTTON_SHOWPICTURE)->EnableWindow(TRUE);
GetDlgItem(IDC_BUTTON_GETVALUE)->EnableWindow(TRUE);
GetDlgItem(IDC_BUTTON_GETDATA)->EnableWindow(TRUE);
}
else
AfxMessageBox(_T("The file is not a CAR file!"));
}
}
void CXCD_Client_MFCDlg::OnBnClickedButtonShowlegend()
{
RECT rc;
TCHAR szText[20];
BOOL bExpanded = FALSE;
GetDlgItemText(IDC_BUTTON_RESIZE, szText, 20);
if (lstrcmp(szText, _T("Less")) == 0 /* when equal */) bExpanded = TRUE;
GetWindowRect(&rc);
GetDlgItemText(IDC_BUTTON_SHOWLEGEND, szText, 20);
if (lstrcmp(szText, _T("Show Legend")) == 0 /* when equal */)
{
SetWindowPos(NULL, 0, 0, rc.right - rc.left + 550,
bExpanded ? DIALOG_HEIGHT_EXPANDED : DIALOG_HEIGHT_COLLAPSED,
SWP_NOZORDER | SWP_NOMOVE);
SetDlgItemText(IDC_BUTTON_SHOWLEGEND, _T("Hide Legend"));
}
else
{
SetWindowPos(NULL, 0, 0, rc.right - rc.left - 550,
bExpanded ? DIALOG_HEIGHT_EXPANDED : DIALOG_HEIGHT_COLLAPSED,
SWP_NOZORDER | SWP_NOMOVE);
SetDlgItemText(IDC_BUTTON_SHOWLEGEND, _T("Show Legend"));
}
}
void CXCD_Client_MFCDlg::OnEnKillfocusEditItem()
{
UpdateData(TRUE);
}
void CXCD_Client_MFCDlg::OnBnClickedButtonGetpicturetitle()
{
USES_CONVERSION;
BSTR bstrBuffer;
UpdateData(TRUE);
m_pCar->GetPictureTitle(_tstoi(m_strEditItem), &bstrBuffer);
(GetDlgItem(IDC_STATIC_PICTURETITLE))->SetWindowText(OLE2W(bstrBuffer));
}
void CXCD_Client_MFCDlg::OnBnClickedButtonShowpicture()
{
int nItem = _tstoi(m_strEditItem);
IPicture* pPicture = NULL;
m_pCar->GetPicture(nItem, &pPicture);
m_pPreviewWnd->m_pPicture = pPicture;
m_pPreviewWnd->Invalidate();
m_pPreviewWnd->UpdateWindow();
}
void CXCD_Client_MFCDlg::CreatePreviewWindow()
{
CWnd* pParent = (CWnd*)this;
CRect rect;
CString strWndClass;
DWORD dwExStyle = NULL;
DWORD dwStyle = WS_VISIBLE | WS_CHILD | WS_DLGFRAME;
m_pPreviewWnd = new CPreviewWnd();
pParent->GetClientRect(&rect);
rect.left = 288;
rect.top = 260;
rect.bottom = 395;
rect.right = rect.right - 370;
strWndClass = AfxRegisterWndClass(CS_HREDRAW | CS_VREDRAW);
m_pPreviewWnd->Create(strWndClass, NULL,
WS_VISIBLE | WS_CHILD | WS_DLGFRAME, rect, pParent, ID_PREVIEW_WINDOW);
}
void CXCD_Client_MFCDlg::OnBnClickedButtonGetvalue()
{
USES_CONVERSION;
CString strCBValue;
BSTR bstrBuffer;
UpdateData(TRUE);
m_ctlComboBox.GetLBText(m_ctlComboBox.GetCurSel(), strCBValue);
CComBSTR bstrCBValue(strCBValue);
m_pCar->GetValue(_tstoi(m_strEditItem), bstrCBValue, &bstrBuffer);
(GetDlgItem(IDC_STATIC_TAGVALUE))->SetWindowText(OLE2W(bstrBuffer));
}
void CXCD_Client_MFCDlg::DrawLegend()
{
CDC* pDC = NULL;
RECT rcDlg;
RECT rc;
int nOffset;
CString strMsg;
WINDOWINFO wi;
RECT rcText = {555, 0, 1095, 0};
CBrush brush(RGB(0, 0, 0));
pDC = GetDC();
// Calculate verticall offset for the text areas.
GetWindowInfo(&wi);
nOffset = wi.rcClient.top - wi.rcWindow.top - 2 /* manual */;
pDC->SetTextColor(RGB(255,255,255));
pDC->SetBkMode(TRANSPARENT);
this->GetWindowRect(&rcDlg);
(GetDlgItem(IDC_BUTTON_SELECTFILE))->GetWindowRect(&rc);
rcText.top = rc.top - rcDlg.top - nOffset;
rcText.bottom = rcText.top + 20;
pDC->FillRect(&rcText, &brush);
strMsg = " HRESULT put_FFN(BSTR bstrFFN /* in */)";
pDC->DrawText(strMsg, &rcText, DT_SINGLELINE | DT_VCENTER | DT_NOCLIP);
(GetDlgItem(IDC_STATIC_COLLECTION_TITLE))->GetWindowRect(&rc);
rcText.top = rc.top - rcDlg.top - nOffset;
rcText.bottom = rcText.top + 20;
pDC->FillRect(&rcText, &brush);
strMsg = " HRESULT GetTitle(BSTR* pbstrTitle /* out */)";
pDC->DrawText(strMsg, &rcText, DT_SINGLELINE | DT_VCENTER | DT_NOCLIP);
(GetDlgItem(IDC_STATIC_COLLECTION_COUNT))->GetWindowRect(&rc);
rcText.top = rc.top - rcDlg.top - nOffset;
rcText.bottom = rcText.top + 20;
pDC->FillRect(&rcText, &brush);
strMsg = " HRESULT GetCount(USHORT* pnCount /* out */)";
pDC->DrawText(strMsg, &rcText, DT_SINGLELINE | DT_VCENTER | DT_NOCLIP);
(GetDlgItem(IDC_STATIC_COLLECTION_XCDVERSION))->GetWindowRect(&rc);
rcText.top = rc.top - rcDlg.top - nOffset;
rcText.bottom = rcText.top + 20;
pDC->FillRect(&rcText, &brush);
strMsg = " HRESULT GetXCDVersion(BSTR* bstrXCDVersion) /* out */)";
pDC->DrawText(strMsg, &rcText, DT_SINGLELINE | DT_VCENTER | DT_NOCLIP);
(GetDlgItem(IDC_STATIC_COLLECTION_VERSION))->GetWindowRect(&rc);
rcText.top = rc.top - rcDlg.top - nOffset;
rcText.bottom = rcText.top + 20;
pDC->FillRect(&rcText, &brush);
strMsg = " HRESULT GetVersion(BSTR* pbstrCollectionVersion /* out */)";
pDC->DrawText(strMsg, &rcText, DT_SINGLELINE | DT_VCENTER | DT_NOCLIP);
(GetDlgItem(IDC_BUTTON_GETPICTURETITLE))->GetWindowRect(&rc);
rcText.top = rc.top - rcDlg.top - nOffset;
rcText.bottom = rcText.top + 20;
pDC->FillRect(&rcText, &brush);
strMsg = " HRESULT GetPictureTitle(USHORT nItem /* in */, BSTR* pbstrTitle /* out */)";
pDC->DrawText(strMsg, &rcText, DT_SINGLELINE | DT_VCENTER | DT_NOCLIP);
(GetDlgItem(IDC_BUTTON_SHOWPICTURE))->GetWindowRect(&rc);
rcText.top = rc.top - rcDlg.top - nOffset;
rcText.bottom = rcText.top + 20;
pDC->FillRect(&rcText, &brush);
strMsg = " HRESULT GetPicture(USHORT nItem /* in */, IPicture** ppPicture /* out */)";
pDC->DrawText(strMsg, &rcText, DT_SINGLELINE | DT_VCENTER | DT_NOCLIP);
(GetDlgItem(IDC_BUTTON_GETVALUE))->GetWindowRect(&rc);
rcText.top = rc.top - rcDlg.top - nOffset;
rcText.bottom = rcText.top + 20;
pDC->FillRect(&rcText, &brush);
strMsg = " HRESULT";
pDC->DrawText(strMsg, &rcText, DT_SINGLELINE | DT_VCENTER | DT_NOCLIP);
rcText.top = rcText.bottom;
rcText.bottom = rcText.top + 20;
pDC->FillRect(&rcText, &brush);
strMsg = " GetValue(USHORT nItem /* in */, BSTR bstrTag /* in */, BSTR* pbstrValue /* out */)";
pDC->DrawText(strMsg, &rcText, DT_SINGLELINE | DT_VCENTER | DT_NOCLIP);
(GetDlgItem(IDC_BUTTON_GETDATA))->GetWindowRect(&rc);
rcText.top = rc.top - rcDlg.top - nOffset;
rcText.bottom = rcText.top + 20;
pDC->FillRect(&rcText, &brush);
strMsg = " HRESULT GetData(USHORT nItem /* in */, VARIANT* pData /* out */)";
pDC->DrawText(strMsg, &rcText, DT_SINGLELINE | DT_VCENTER | DT_NOCLIP);
}
void CXCD_Client_MFCDlg::OnBnClickedButtonGetdata()
{
USES_CONVERSION;
HRESULT hr;
_variant_t var;
SAFEARRAY* psa;
BSTR bstrBuffer;
long lIndex;
long lLb, lUb;
hr = m_pCar->GetData(_tstoi(m_strEditItem), &var);
psa = var.parray;
if (SUCCEEDED(hr))
{
SafeArrayGetLBound(psa, 1, &lLb);
SafeArrayGetUBound(psa, 1, &lUb);
lIndex = 0;
SafeArrayGetElement(psa, &lIndex, &bstrBuffer);
(GetDlgItem(IDC_STATIC_YEAR))->SetWindowText(OLE2W(bstrBuffer));
lIndex = 1;
SafeArrayGetElement( psa, &lIndex, &bstrBuffer);
(GetDlgItem(IDC_STATIC_MAKE))->SetWindowText(OLE2W(bstrBuffer));
lIndex = 2;
SafeArrayGetElement( psa, &lIndex, &bstrBuffer);
(GetDlgItem(IDC_STATIC_MODEL))->SetWindowText(OLE2W(bstrBuffer));
lIndex = 3;
SafeArrayGetElement( psa, &lIndex, &bstrBuffer);
(GetDlgItem(IDC_STATIC_SUBMODEL))->SetWindowText(OLE2W(bstrBuffer));
lIndex = 4;
SafeArrayGetElement( psa, &lIndex, &bstrBuffer);
(GetDlgItem(IDC_STATIC_TYPE))->SetWindowText(OLE2W(bstrBuffer));
lIndex = 5;
SafeArrayGetElement( psa, &lIndex, &bstrBuffer);
(GetDlgItem(IDC_STATIC_PRICE))->SetWindowText(OLE2W(bstrBuffer));
lIndex = 6;
SafeArrayGetElement( psa, &lIndex, &bstrBuffer);
(GetDlgItem(IDC_STATIC_POWER))->SetWindowText(OLE2W(bstrBuffer));
lIndex = 7;
SafeArrayGetElement( psa, &lIndex, &bstrBuffer);
(GetDlgItem(IDC_STATIC_FUEL))->SetWindowText(OLE2W(bstrBuffer));
lIndex = 8;
SafeArrayGetElement( psa, &lIndex, &bstrBuffer);
(GetDlgItem(IDC_STATIC_LENGTH))->SetWindowText(OLE2W(bstrBuffer));
lIndex = 9;
SafeArrayGetElement( psa, &lIndex, &bstrBuffer);
(GetDlgItem(IDC_STATIC_WIDTH))->SetWindowText(OLE2W(bstrBuffer));
lIndex = 10;
SafeArrayGetElement( psa, &lIndex, &bstrBuffer);
(GetDlgItem(IDC_STATIC_HEIGHT))->SetWindowText(OLE2W(bstrBuffer));
lIndex = 11;
SafeArrayGetElement( psa, &lIndex, &bstrBuffer);
(GetDlgItem(IDC_STATIC_WEIGHT))->SetWindowText(OLE2W(bstrBuffer));
lIndex = 12;
SafeArrayGetElement( psa, &lIndex, &bstrBuffer);
(GetDlgItem(IDC_STATIC_TANKVOLUME))->SetWindowText(OLE2W(bstrBuffer));
lIndex = 14;
SafeArrayGetElement( psa, &lIndex, &bstrBuffer);
(GetDlgItem(IDC_STATIC_CLEARANCE))->SetWindowText(OLE2W(bstrBuffer));
lIndex = 13;
SafeArrayGetElement( psa, &lIndex, &bstrBuffer);
(GetDlgItem(IDC_STATIC_COUNTRY))->SetWindowText(OLE2W(bstrBuffer));
}
}
void CXCD_Client_MFCDlg::OnBnClickedButtonResize()
{
RECT rc;
TCHAR szText[20];
GetWindowRect(&rc);
GetDlgItemText(IDC_BUTTON_RESIZE, szText, 20);
if (lstrcmp(szText, _T("More")) == 0 /* when equal */)
{
SetWindowPos(NULL, 0, 0, rc.right - rc.left,
DIALOG_HEIGHT_EXPANDED, SWP_NOZORDER | SWP_NOMOVE);
SetDlgItemText(IDC_BUTTON_RESIZE, _T("Less"));
::GetWindowRect(GetDlgItem(IDC_STATIC_CARGROUPBOX)->m_hWnd, &rc);
rc.bottom = rc.bottom +
(DIALOG_HEIGHT_EXPANDED - DIALOG_HEIGHT_COLLAPSED);
::SetWindowPos(GetDlgItem(IDC_STATIC_CARGROUPBOX)->m_hWnd,
NULL, 0, 0, rc.right - rc.left, rc.bottom - rc.top,
SWP_NOZORDER | SWP_NOMOVE);
}
else
{
SetWindowPos(NULL, 0, 0, rc.right - rc.left,
DIALOG_HEIGHT_COLLAPSED, SWP_NOZORDER | SWP_NOMOVE);
SetDlgItemText(IDC_BUTTON_RESIZE, _T("More"));
::GetWindowRect(GetDlgItem(IDC_STATIC_CARGROUPBOX)->m_hWnd, &rc);
rc.bottom = rc.bottom -
(DIALOG_HEIGHT_EXPANDED - DIALOG_HEIGHT_COLLAPSED);
::SetWindowPos(GetDlgItem(IDC_STATIC_CARGROUPBOX)->m_hWnd,
NULL, 0, 0, rc.right - rc.left, rc.bottom - rc.top,
SWP_NOZORDER | SWP_NOMOVE);
}
}
void CXCD_Client_MFCDlg::OnNMClickSyslink(NMHDR *pNMHDR, LRESULT *pResult)
{
ShellExecute(NULL, _T("open"),
_T("http://www.myscreensaverbuilder.com/CE.htm"), 0, 0, SW_SHOWNORMAL);
*pResult = 0;
}