|
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
|
|
|
|
|
As David said, you can specify the style ES_NUMBER at the time of creation.
- NS -
|
|
|
|
|
hi my dll can't register on one pc ,but can register on another pc,
why? the error is :" *.dll DllRegisterServer failed ,error code is :0x8007007 "
thanks
|
|
|
|
|
If this works on one machine but not another check who is logged on. Does the user have Administrator permissions of both machines. If not then registering will not work.
0x8007007 seems to be related to passing too little memory (buffer too small) to some API call or another but it doesn't appear to be documented. Are you 100% sure this is the error code? It's 1 digit shorter than I would have expected for a COM error.
Nothing is exactly what it seems but everything with seems can be unpicked.
|
|
|
|
|
AFAIK, you are right! we don't need to register MFC dll!
"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
|
|
|
|
|
szcococut wrote: hi my dll can't register on one pc ,but can register on another pc,
why? the error is :" *.dll DllRegisterServer failed ,error code is :0x8007007 "
thanks
you don't need to register dll written in MFC. it is the COM dll you have to register.. try placing the DLL in same folder as of Application
"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 folllowing code is from the article "Three Ways to Inject Your Code into Another Process" By Robert Kuster.
some one please tell me how he calculated the size of InjectFunc in his application( 192 for debug and 128 for release ) ?
#ifdef _DEBUG<br />
#define cbInjectFunc 192<br />
#else<br />
#define cbInjectFunc 128<br />
#endif
//
//
static DWORD WINAPI InjectFunc (INJDATA *pData)
{
// Subclass START button
pData->fnOldProc = (WNDPROC)
pData->fnSetWindowLong ( pData->hwnd, GWL_WNDPROC,(long)pData->fnNewProc );
return (pData->fnOldProc != NULL);
}
int InjCode (HWND hWnd, bool fUnicode)
{
.
.
WriteProcessMemory( hProcess, pCodeRemote, &InjectFunc, cbInjectFunc, &dwNumBytesXferred );
.
.
.
Thanks & Regards
|
|
|
|
|
My guess is he did it by being totally savvy (knowledgeable) about his code. Compiling into an object, examing the object and extracting just the relevant bits etc..
|
|
|
|
|
nirdhar wrote: InternetOpen() problem
hence you need:
InternetOpen() solution
If the Lord God Almighty had consulted me before embarking upon the Creation, I would have recommended something simpler.
-- Alfonso the Wise, 13th Century King of Castile.
|
|
|
|
|
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
|
|
|
|
|
where is the question
"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 need to forward your request to the OP (he deleted the message).
BTW, technically yours
ThatsAlok wrote: where is the question
is not a question.
If the Lord God Almighty had consulted me before embarking upon the Creation, I would have recommended something simpler.
-- Alfonso the Wise, 13th Century King of Castile.
|
|
|
|
|
CPallini wrote: You need to forward your request to the OP (he deleted the message).
"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
|
|
|
|