|
I'll look forward to that article. We are not doing anything special with that ptr. just check for that pointer and then if its valid then call one more member from that ptr.
i gave a full explanation in reply to cedric moonen's message above yours. Thanks for your reply.
|
|
|
|
|
sw@thi wrote: i need to check whether a pointer is valid or not...
Why?
"A good athlete is the result of a good and worthy opponent." - David Crow
"To have a respect for ourselves guides our morals; to have deference for others governs our manners." - Laurence Sterne
|
|
|
|
|
New day, same old story
|
|
|
|
|
sw@thi wrote: they also say that its not good practice to use these functions.
any particular reason!
"Opinions are neither right nor wrong. I cannot change your opinion. I can, however, change what influences your opinion." - David Crow Never mind - my own stupidity is the source of every "problem" - Mixture
cheers,
Alok Gupta
VC Forum Q&A :- I/ IV
Support CRY- Child Relief and You
|
|
|
|
|
You should avoid IsBadReadPtr and IsBadWrite pointer like the plague. See here[^] and here[^]. If you get a bad pointer the best thing that you can do is ***NOT*** attempt to validate it and let the application crash so it can be debugged.
Steve
|
|
|
|
|
hello friends,
i trying to access properties of activeX control throught atl dialog, but unable to access, also unable to create a control variable of activeX control, which can be create in mfc.
thnx...
Rajesh
|
|
|
|
|
Have a look at the ActiveX Control Test Container tool which Microsoft ship with VC6. If you hunt around on the Web the source for it is available. It's ATL and does just about everything with ActiveX controls that you can imagine and some stuff that I still can't even after I read it.
Nothing is exactly what it seems but everything with seems can be unpicked.
|
|
|
|
|
I need to send some raw data from a packet sniffed by Ethereal. Someone knows how?
|
|
|
|
|
alofang wrote: I need to send some raw data from a packet sniffed by Ethereal. Someone knows how?
just convert that to char and send it TCP via socket!
"Opinions are neither right nor wrong. I cannot change your opinion. I can, however, change what influences your opinion." - David Crow Never mind - my own stupidity is the source of every "problem" - Mixture
cheers,
Alok Gupta
VC Forum Q&A :- I/ IV
Support CRY- Child Relief and You
|
|
|
|
|
|
Does exist a simple way to change the background color of edit and button ctrls when has the focus? thanks VC6++
|
|
|
|
|
Take a look in SetBkColor ()
Greetings.
--------
M.D.V.
If something has a solution... Why do we have to worry about?. If it has no solution... For what reason do we have to worry about?
Help me to understand what I'm saying, and I'll explain it better to you
|
|
|
|
|
Nelek wrote: Take a look in SetBkColor ()
it will not work.. you have to subclass
"Opinions are neither right nor wrong. I cannot change your opinion. I can, however, change what influences your opinion." - David Crow Never mind - my own stupidity is the source of every "problem" - Mixture
cheers,
Alok Gupta
VC Forum Q&A :- I/ IV
Support CRY- Child Relief and You
|
|
|
|
|
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
|
|
|
|
|
but according to OPPs principal.. i am just abstracting that thing from outer world i.e. Dialog!
"Opinions are neither right nor wrong. I cannot change your opinion. I can, however, change what influences your opinion." - David Crow Never mind - my own stupidity is the source of every "problem" - Mixture
cheers,
Alok Gupta
VC Forum Q&A :- I/ IV
Support CRY- Child Relief and You
|
|
|
|
|
This approach doesn't necessarily break OOP principles; there's nothing wrong with an edit control asking its parent what colour it should use.
Steve
|
|
|
|
|
ArielR wrote: Does exist a simple way to change the background color of edit and button ctrls when has the focus? thanks VC6++
you need to SUBCLASS that control to achieve same.. search SUBCLASS by mr Chris!
"Opinions are neither right nor wrong. I cannot change your opinion. I can, however, change what influences your opinion." - David Crow Never mind - my own stupidity is the source of every "problem" - Mixture
cheers,
Alok Gupta
VC Forum Q&A :- I/ IV
Support CRY- Child Relief and You
|
|
|
|
|
Thank for your reply. The SUBCLASS change the background color by the mouse movement. I need to change the color when it was focused by mouse or tab order. Could you help me? Thanks
|
|
|
|
|
Not so. See here[^]
Steve
|
|
|
|
|
he he he.. good one.. i already got your answer
"Opinions are neither right nor wrong. I cannot change your opinion. I can, however, change what influences your opinion." - David Crow Never mind - my own stupidity is the source of every "problem" - Mixture
cheers,
Alok Gupta
VC Forum Q&A :- I/ IV
Support CRY- Child Relief and You
|
|
|
|
|
You could subclass it or use this[^] approach.
Steve
|
|
|
|
|
Hello,
I want only digits in CRichEditCtrl then what type of edit styles should I use or there is no such edit style and I will have to write code for it .
Regards,
Prithaa
|
|
|
|
|
ES_NUMBER style.
You can set it from resource editor also if you are placing it in the dialog resource.
- NS -
|
|
|
|
|
Hello,
No I am not using resource editor.I am placing it on a window derived from CMDIChildWnd.
Is there anything else?
Thanks,
Prithaa
|
|
|
|
|
The style still applies whether you add it at design time or run time.
You can also derive a class from CRichEditCtrl , and override the OnChar() method.
"A good athlete is the result of a good and worthy opponent." - David Crow
"To have a respect for ourselves guides our morals; to have deference for others governs our manners." - Laurence Sterne
|
|
|
|