|
#pragma once
class PGWizardPageBase : public CPropertyPageImpl<T, TBase>
{
typedef CPropertyPageImpl<T, TBase> baseClass;
protected:
virtual bool usesMessageList() { return false; }
public:
PGWizardPageBase(void)
{
}
BEGIN_MSG_MAP(PGWizardPageBase)
MESSAGE_HANDLER(WM_INITDIALOG, OnInitDialog)
MESSAGE_HANDLER(WMU_SETSTATUSMSG, OnSetStatusMsg)
CHAIN_MSG_MAP(baseClass)
END_MSG_MAP()
// Message Handlers
LRESULT OnInitDialog(UINT /*uMsg*/, WPARAM /*wParam*/, LPARAM /*lParam*/, BOOL& /*bHandled*/)
{
_bkgnd.SubclassWindow(GetDlgItem(IDC_BANNER));
_bkgnd.SetImageRsrc(IDJ_EMAILBANNER, ENUM_cimage_format_jpeg);
CImage* img = _bkgnd.getImage();
_bkgnd.SetWindowPos(0, 0, 0, img->GetWidth(), img->GetHeight(), SWP_NOMOVE | SWP_NOZORDER);
return TRUE;
}
LRESULT OnSetStatusMsg(UINT /*uMsg*/, WPARAM wParam, LPARAM lParam, BOOL& /*bHandled*/)
{
const char* szMsg = (const char*)lParam;
bool bShouldClear = (wParam == 0);
CEdit eStatus = GetDlgItem(IDC_STATUSTEXT);
if (bShouldClear)
{
eStatus.SetWindowText(szMsg);
}
else
{
int textLen = eStatus.GetWindowTextLength();
eStatus.SetSel(textLen, textLen);
eStatus.ReplaceSel(szMsg);
}
return 0;
}
LRESULT OnWizardNext()
{
if (usesMessageList())
{
GlobalData& gd = GlobalDataS::instance();
CListViewCtrl lvc = GetDlgItem(IDC_MESSAGES);
EmailWizardManager& ewm = EmailWizardManagerS::instance();
pqxx::work TRX(gd.dbConn(), "EmailNext");
Database::CEmailLogRS elrs;
char buf[24];
int ctr = 0;
ewm.clear();
for (ctr = 0; ctr < lvc.GetItemCount(); ctr++)
{
if (lvc.GetCheckState(ctr))
{
sprintf(buf, "id=%d", (int)lvc.GetItemData(ctr));
elrs.where(buf);
pqxx::result dbr = TRX.exec(elrs.query());
pqxx::result::const_iterator rsit = dbr.begin();
if (rsit != dbr.end())
{
elrs = rsit;
ewm.push_back(elrs.uidl);
++rsit;
}
}
}
TRX.commit();
// Save the column header sizes.
CHeaderCtrl hdr = lvc.GetHeader();
COLDEFVECTOR cdv = gd.emailCols();
ctr = 0;
while (ctr < hdr.GetItemCount())
{
HDITEM hdi;
memset(&hdi, 0, sizeof(hdi));
hdi.mask = HDI_FORMAT | HDI_ORDER | HDI_WIDTH;
hdr.GetItem(ctr, &hdi);
cdv[ctr].align = hdi.fmt & 0x0003;
cdv[ctr].position = hdi.iOrder;
cdv[ctr].width = hdi.cxy;
++ctr;
}
gd.emailCols(cdv);
}
return 0;
}
};
|
By viewing downloads associated with this article you agree to the Terms of Service and the article's licence.
If a file you wish to view isn't highlighted, and is a text file (not binary), please
let us know and we'll add colourisation support for it.
This article has no explicit license attached to it but may contain usage terms in the article text or the download files themselves. If in doubt please contact the author via the discussion board below.
A list of licenses authors might use can be found here
This member has not yet provided a Biography. Assume it's interesting and varied, and probably something to do with programming.