Saturday, November 26, 2011
First of all, the concept here is not originally mine but I have made a lot of changes to the original code. The original code can be seen here: http://www.codeguru.com/cpp/controls/editctrl/backgroundcolor/article.php/c6857
The code was written under MFC framework but what it does is pretty obvious. I mean, if you want to apply it in a non-MFC project, you already knew what to do.
Before I posted my modified code here, I made sure first that it works. I am using this code in a project I'm working on as of this posting.
My IDE is MS Visual Studio 2010. OS: Windows 7.
So, here we go.
// The MFC header class --> transedit.h
#pragma pack(push, 1)
class TransEdit : public CEdit
void SetTextColor(COLORREF clr);
afx_msg HBRUSH CtlColor(CDC* pDC, UINT nCtlColor);
afx_msg void OnEnUpdate();
afx_msg void OnSize(UINT nType, int cx, int cy);
// The TransEdit implementation --> transedit.cpp
m_clrText = GetSysColor(COLOR_WINDOWTEXT);
void TransEdit::SetTextColor(COLORREF clr)
m_clrText = clr;
HBRUSH TransEdit::CtlColor(CDC *pDC, UINT nCtlColor)
if( m_Brush.m_hObject!=0 )
CWnd * pParent = GetParent();
CRect pos, rc;
rc = pos;
thisMem.CreateCompatibleDC( &dc );
CSize sz = pos.Size();
bkgnd.CreateCompatibleBitmap(&dc, sz.cx, sz.cy );
pOldThisBmp = thisMem.SelectObject(&bkgnd);
thisMem.BitBlt(0, 0, sz.cx, sz.cy, &dc, pos.left, pos.top, SRCCOPY);
CWnd * pParent = GetParent();
void TransEdit::OnSize(UINT nType, int cx, int cy)
BOOL b = IsWindowVisible();
CEdit::OnSize(nType, cx, cy);
if( b )
if( b )
That’s all it!
If you find this useful, feel free to use/modify it. You want to claim it as your own? Go on, f@ck yourself!
Wednesday, October 5, 2011
Most of the online email servers, at least the ones I know (yahoo mail, gmail and mail.com) has this feature of getting your inbox organized into something that suits you. It is called mail filtering. Using filtering enables you to control to what folder received emails should go. It helps keep your inbox uncluttered and reading mails a hobby than a vexing task of wading through the ocean of important and unwanted mails, not just the spams.
And what the hell made me post this when I know that most web users uses online email servers and most probably had known and been using this feature before I even know it exists? Well, for those who knows and uses this already, this is not for you. For those who doesn't and want to give themselves a favor, get inspired by this, read the documentation in your email servers on how to use filtering and enjoy reading your mails.
By the way, for yahoo users, here is a starter:
- On your yahoo mail, click options.
- Once you are on the options tab, look at the left pane for the label filters and click on it.
- When the filters pane is visible which located on the right side, click on the add filter button.
- Supply a name you think appropriate and on the sender contains field, type in some words that is exists in the email address of the sender. e. g. yahoo for email@example.com. All fields are simply self-explanatory. Whatever word you typed will then be compared to sender's email address if that word exists on it.
- In the move to folder, select a folder where these kind of mails will be moved to or select new folder so you can supply a new folder's name appropriate for these said emails later when you click save changes.
- Finally, click on save changes and that's all that, you have a new filter. You can use to a maximum of 100 filters.
If you have already those sort of emails before you created its filter, you can drag them one by one and drop to the folder you have just created for it. Or you can search your mail filtered so that only those emails of that particular sender will be included in the result, click on the topmost check box located at the left of your mails panel so that everything are selected and move them to that folder. For additional information in doing all these, yahoo has a detailed explanation on how to do it.