Click here to Skip to main content
16,011,743 members
Home / Discussions / C / C++ / MFC
   

C / C++ / MFC

 
GeneralRe: How to access properties of ActiveX control in atl Pin
Matthew Faithfull11-Oct-07 2:52
Matthew Faithfull11-Oct-07 2:52 
QuestionHow to send hex data to TCP socket using Winsock Pin
alofang11-Oct-07 2:35
alofang11-Oct-07 2:35 
AnswerRe: How to send hex data to TCP socket using Winsock Pin
ThatsAlok11-Oct-07 2:55
ThatsAlok11-Oct-07 2:55 
GeneralRe: How to send hex data to TCP socket using Winsock Pin
alofang11-Oct-07 4:13
alofang11-Oct-07 4:13 
QuestionBackground color Pin
ArielR11-Oct-07 2:33
ArielR11-Oct-07 2:33 
AnswerRe: Background color Pin
Nelek11-Oct-07 2:41
protectorNelek11-Oct-07 2:41 
GeneralRe: Background color Pin
ThatsAlok11-Oct-07 3:55
ThatsAlok11-Oct-07 3:55 
GeneralRe: Background color Pin
Stephen Hewitt11-Oct-07 18:42
Stephen Hewitt11-Oct-07 18:42 
Not true. Consider this code (dots are code that's been omitted):
=================================================================

In ".h" file.
-------------
class CFocusColourDlg : public CDialog
{
.
.
.
// ClassWizard generated virtual function overrides
//{{AFX_VIRTUAL(CFocusColourDlg)
protected:
virtual void DoDataExchange(CDataExchange* pDX); // DDX/DDV support
virtual BOOL OnCommand(WPARAM wParam, LPARAM lParam);
//}}AFX_VIRTUAL

// Implementation
protected:
HICON m_hIcon;
CBrush m_RedBrush;

// Generated message map functions
//{{AFX_MSG(CFocusColourDlg)
virtual BOOL OnInitDialog();
afx_msg void OnPaint();
afx_msg HCURSOR OnQueryDragIcon();
afx_msg HBRUSH OnCtlColor(CDC* pDC, CWnd* pWnd, UINT nCtlColor);
afx_msg void OnDestroy();
//}}AFX_MSG
DECLARE_MESSAGE_MAP()
};

In ".cpp" file.
---------------
.
.
.
BEGIN_MESSAGE_MAP(CFocusColourDlg, CDialog)
//{{AFX_MSG_MAP(CFocusColourDlg)
ON_WM_PAINT()
ON_WM_QUERYDRAGICON()
ON_WM_CTLCOLOR()
ON_WM_DESTROY()
//}}AFX_MSG_MAP
END_MESSAGE_MAP()

/////////////////////////////////////////////////////////////////////////////
// CFocusColourDlg message handlers

BOOL CFocusColourDlg::OnInitDialog()
{
CDialog::OnInitDialog();

// 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

// TODO: Add extra initialization here
m_RedBrush.CreateSolidBrush(RGB(255, 0, 0));

return TRUE; // return TRUE unless you set the focus to a control
}
.
.
.
BOOL CFocusColourDlg::OnCommand(WPARAM wParam, LPARAM lParam)
{
WORD NotifyCode = HIWORD(wParam);
WORD Id = LOWORD(wParam);
HWND hWnd = reinterpret_cast<HWND>(lParam);

if (NotifyCode==EN_SETFOCUS || NotifyCode==EN_KILLFOCUS)
{
::InvalidateRect(hWnd, NULL, TRUE);
}

return CDialog::OnCommand(wParam, lParam);
}

HBRUSH CFocusColourDlg::OnCtlColor(CDC* pDC, CWnd* pWnd, UINT nCtlColor)
{
HBRUSH hbr = CDialog::OnCtlColor(pDC, pWnd, nCtlColor);

if (pWnd->GetSafeHwnd() == ::GetFocus())
{
pDC->SetBkColor(RGB(255, 0, 0));
return m_RedBrush;
}

return hbr;
}

void CFocusColourDlg::OnDestroy()
{
CDialog::OnDestroy();

m_RedBrush.DeleteObject();
}

Steve
GeneralRe: Background color Pin
ThatsAlok11-Oct-07 19:15
ThatsAlok11-Oct-07 19:15 
GeneralRe: Background color Pin
Stephen Hewitt11-Oct-07 19:18
Stephen Hewitt11-Oct-07 19:18 
AnswerRe: Background color Pin
ThatsAlok11-Oct-07 3:54
ThatsAlok11-Oct-07 3:54 
GeneralRe: Background color Pin
ArielR11-Oct-07 5:52
ArielR11-Oct-07 5:52 
GeneralRe: Background color Pin
Stephen Hewitt11-Oct-07 18:49
Stephen Hewitt11-Oct-07 18:49 
GeneralRe: Background color Pin
ThatsAlok11-Oct-07 19:14
ThatsAlok11-Oct-07 19:14 
AnswerRe: Background color Pin
Stephen Hewitt11-Oct-07 18:50
Stephen Hewitt11-Oct-07 18:50 
QuestionOnly digits in CRichEditCtrl Pin
prithaa11-Oct-07 1:50
prithaa11-Oct-07 1:50 
AnswerRe: Only digits in CRichEditCtrl Pin
Nishad S11-Oct-07 2:04
Nishad S11-Oct-07 2:04 
GeneralRe: Only digits in CRichEditCtrl Pin
prithaa11-Oct-07 2:55
prithaa11-Oct-07 2:55 
GeneralRe: Only digits in CRichEditCtrl Pin
David Crow11-Oct-07 3:56
David Crow11-Oct-07 3:56 
GeneralRe: Only digits in CRichEditCtrl Pin
Nishad S11-Oct-07 17:54
Nishad S11-Oct-07 17:54 
QuestionMy dll wrote in MFC can't register on one pc ,but another can&#65281; Pin
szcococut11-Oct-07 0:15
szcococut11-Oct-07 0:15 
GeneralRe: My dll wrote in MFC can't register on one pc ,but another can&#65281; Pin
Matthew Faithfull11-Oct-07 1:15
Matthew Faithfull11-Oct-07 1:15 
GeneralRe: My dll wrote in MFC can't register on one pc ,but another can&#65281; Pin
ThatsAlok11-Oct-07 3:27
ThatsAlok11-Oct-07 3:27 
AnswerRe: My dll wrote in MFC can't register on one pc ,but another can&#65281; Pin
ThatsAlok11-Oct-07 3:27
ThatsAlok11-Oct-07 3:27 
QuestionFunction Pin
nitin311-Oct-07 0:01
nitin311-Oct-07 0:01 

General General    News News    Suggestion Suggestion    Question Question    Bug Bug    Answer Answer    Joke Joke    Praise Praise    Rant Rant    Admin Admin   

Use Ctrl+Left/Right to switch messages, Ctrl+Up/Down to switch threads, Ctrl+Shift+Left/Right to switch pages.