|
I'm not sure, how you have done it, but modify your code to,
CFileopenDlg::OnCtlColor(CDC* pDC, CWnd* pWnd, UINT nCtlColor)
{
return m_brush;
}</blockquote>
To skip edit control painting do this,
HBRUSH CFileopenDlg::OnCtlColor(CDC* pDC, CWnd* pWnd, UINT nCtlColor)
{
m_brush= CDialog::OnCtlColor(pDC, pWnd, nCtlColor);
if (nCtlColor == CTLCOLOR_EDIT)
{
return brush
}
else
{
}
return m_brush;
}
|
|
|
|
|
harsh_2961 wrote: When i change the background color of my dialog, along with that the color of the edit box in my dialog is changing..
can u show the code...
Do your Duty and Don't expect the Result
|
|
|
|
|
I used following function
HBRUSH CFileopenDlg::OnCtlColor(CDC* pDC, CWnd* pWnd, UINT nCtlColor)
{
return m_brush;
}
along with the line m_List.SetBkColor(RGB(255, 255, 255));
in oninitdialog().
harsha
|
|
|
|
|
harsh_2961 wrote: along with the line m_List.SetBkColor(RGB(255, 255, 255));
in oninitdialog().
Hope the m_List is your CEdit control.
harsh_2961 wrote: HBRUSH CFileopenDlg::OnCtlColor(CDC* pDC, CWnd* pWnd, UINT nCtlColor)
{
return m_brush;
}
Instead of simply returning m_brush(hope this the brush to paint the dialog background). Try this,
CFileopenDlg::OnCtlColor(CDC* pDC, CWnd* pWnd, UINT nCtlColor)
{
HBRUSH hbr = CDialog::OnCtlColor(pDC, pWnd, nCtlColor);
if (CTLCOLOR_EDIT != nCtlColor)
return m_brush;
return hbr;
}
The above change the background color for all the controls in the dialog except for the CEdit controls.
If you want to change the color only to the dialog then change the 'if' condition as below
if (CTLCOLOR_DLG == nCtlColor)
Do your Duty and Don't expect the Result
|
|
|
|
|
Thanks a lot ... its perfectly working
Harsha
|
|
|
|
|
Default color of editbox is white but if you want to change color of editbox use of WM_CTLCOLOREDIT
|
|
|
|
|
Over ride WM_ERASEBKGND and put this code over there.
CPen myPen;
int i =100;
CRect rect ;
myPen.CreatePen(PS_SOLID, 1, RGB ((i * 4),0,0));
CPen *oldPen = pDC->SelectObject(&myPen) ;
GetClientRect(&rect);
for(i = 0 ; i <= rect.bottom;)
{
pDC->MoveTo(0, i);
pDC->LineTo(rect.right, i);
pDC->SelectObject (&myPen);
}
pDC->SelectObject(oldPen) ;
return TRUE ;
The edit box would not be painted to match the dialog back color and would show as white. See if this helps
_AnShUmAn_
-- modified at 4:55 Wednesday 14th March, 2007
|
|
|
|
|
harsh_2961 wrote: When i change the background color of my dialog, along with that the color of the edit box in my dialog is changing.. but i want the editbox color to be white only..
HBRUSH CFileopenDlg::OnCtlColor(CDC* pDC, CWnd* pWnd, UINT nCtlColor)
{
HBRUSH OrgBrush=CreateSolidBrush(RGB(255,255,255)); // make it white
if(pWnd->GetSafeHwnd() == GetDlgItem(IDC_EDIT1)->GetSafeHwnd())
{
return OrgBrush;
}
return m_brush;
}
|
|
|
|
|
ThatsAlok wrote: if(pWnd->GetSafeHwnd() == GetDlgItem(IDC_EDIT1)->GetSafeHwnd())
if (pWnd->GetDlgCtrlID() == IDC_EDIT1) would be better.
|
|
|
|
|
I am working on email program in VC++. Thru my application I can send mails now. But i want to give user login and password fecility to that.
Here the condition is
<BR>->I want to check the given Mail-id(UserID) & password are correct or not.<br />
->For example User id = "abc@gmail.com"<br />
->respective gmail password = "hello"<BR>
If user entered these two details to my application i need to check the mail id is valid or not and whether password is correct or not. How i can do this.
Could any one please help me in this.
Nice talking to you. If you judge people, you have no time to love them. -- Mother Teresa
|
|
|
|
|
Could any one help me.
Atleast i need idea. Please.
Nice talking to you. If you judge people, you have no time to love them. -- Mother Teresa
|
|
|
|
|
Hi Every one.
I need authentication details. Could any one please kindly helpme in this.
What is authentication, and how to check this authentication. How to use SSL concept in the Email sending program. please help me. this is urgent for me.
Nice talking to you. If you judge people, you have no time to love them. -- Mother Teresa
|
|
|
|
|
Does CString allocate memory on the heap or on the stack?
<br />
#include "stdafx.h"<br />
<br />
#include <afxwin.h>
#include <afxext.h>
#include <afxtempl.h><br />
<br />
#include "TestCString.h"<br />
<br />
#ifdef _DEBUG<br />
#define new DEBUG_NEW<br />
#undef THIS_FILE<br />
static char THIS_FILE[] = __FILE__;<br />
#endif<br />
<br />
<br />
CWinApp theApp;<br />
<br />
using namespace std;<br />
<br />
<br />
void SomeFunc(CList<CString, CString> &oList) {<br />
CString strOriginal = L"ABCDEF";<br />
CString strNewString; << Local variable declared on Stack but seems like it allocates on heap since it can be called from "Main".<br />
<br />
strNewString = strOriginal.Mid(2);<br />
oList.AddTail(strNewString);<br />
<br />
return;<br />
}<br />
<br />
<br />
<br />
int _tmain(int argc, TCHAR* argv[], TCHAR* envp[])<br />
{<br />
int nRetCode = 0;<br />
<br />
if (!AfxWinInit(::GetModuleHandle(NULL), NULL, ::GetCommandLine(), 0))<br />
{<br />
cerr << _T("Fatal Error: MFC initialization failed") << endl;<br />
nRetCode = 1;<br />
}<br />
else<br />
{<br />
CList<CString, CString> oList;<br />
CString strString;<br />
<br />
SomeFunc(oList);<br />
strString = (CString) oList.GetHead();<br />
<br />
printf("%s", strString);<br />
}<br />
<br />
return nRetCode;<br />
}<br />
|
|
|
|
|
The memory for the character array is on the heap.
|
|
|
|
|
devvvy wrote: Does CString allocate memory on the heap or on the stack
CString uses heap to create char array.
devvvy wrote: CString strNewString; << Local variable declared on Stack but seems like it allocates on heap since it can be called from "Main".
strNewString = strOriginal.Mid(2);
oList.AddTail(strNewString);
Actually, CString class uses class CStringData , which keeps tack of this buffer using reference counting.
In this case AddTail cause to increase refernce count by 1, thats why buffer contained in strNewString will not be destroyed even though object goes out of scope.
|
|
|
|
|
i am having a tab with two items. when i click cancel from one item the dialog with tab has to be closed. how to do this
Arise Awake Stop Not Till ur Goal is Reached.
|
|
|
|
|
deeps_cute wrote: when i click cancel from one item the dialog with tab has to be closed
Send custom message to dialog, which has the tab. Handle the message in the dialog and close it as you like (say OnOK or OnCancel or EndDialog ...)
or
If the dialog is the parent winodw for the tab then simply call
GetParent()->EndDialog(..);
Hope i understood your question..
Do your Duty and Don't expect the Result
|
|
|
|
|
how to control the tab dialog from parent dialog? i want to call a function declared in tabdialog from the parent parent dialog
Arise Awake Stop Not Till ur Goal is Reached.
|
|
|
|
|
deeps_cute wrote: want to call a function declared in tabdialog from the parent parent dialog
Just use the tabdialog instance to call its method (make sure the access specifier for the methos is public)
Hope i understood your question...
Do your Duty and Don't expect the Result
|
|
|
|
|
ya i created an instance and called the function. but it get crashed since m_hwnd = NULL.
Arise Awake Stop Not Till ur Goal is Reached.
|
|
|
|
|
deeps_cute wrote: but it get crashed since m_hwnd = NULL
Did u Create the tabdialog before calling the method..
Simply
CMyTabDialog m_wndMyTabDlg;
m_wndMyTabDlg.MyMethod(...)
will lead to crash, because u didn't create the tabdialog...
You have to proceed like this
CMyTabDialog m_wndMyTabDlg;
m_wndMyTabDlg.Create(...);
m_wndMyTabDlg.MyMethod(...);
Refer MSDN for Create
Do your Duty and Don't expect the Result
|
|
|
|
|
create dialog? i have created initially a dialog named landialog. this is the tab dialog.
Arise Awake Stop Not Till ur Goal is Reached.
|
|
|
|
|
deeps_cute wrote: i have created initially a dialog named landialog. this is the tab dialog
No matter how many dialog u have created already...
For every dialog you have to create it before using its methods or CDialog's APIs.
Its better u can post your code and explain wht u need?...
Do your Duty and Don't expect the Result
|
|
|
|
|
From main dialog
void NetConfig::OnClearbutton()
{
LANSettings lanPrc;
lanPrc.Create(IDD_LANSETTINGS,GetParent());
lanPrc.ClearAll((LPARAM)this);
UpdateData(TRUE);
}
this is what i need to call
void LANSettings::ClearAll(LPARAM lParam)
{
(GetDlgItem(IDC_EDIT_LSUBNET))->SetWindowText("");
(GetDlgItem(IDC_EDIT_LIPADD))->SetWindowText("");
(GetDlgItem(IDC_EDIT_LGATE))->SetWindowText("");
(GetDlgItem(IDC_EDIT_LDNS1))->SetWindowText("");
(GetDlgItem(IDC_EDIT_LDNS2))->SetWindowText("");
}
when we create the dialog its just entering in to its initdialog.
Arise Awake Stop Not Till ur Goal is Reached.
|
|
|
|
|
deeps_cute wrote: lanPrc.Create(IDD_LANSETTINGS,GetParent());
Instead of using GetParent(), use 'this'. Because the parent to the LANSettings dialog is NetConfig, not the Parent of NetConfig.
Otherwise the code seems perfect.Try the above...
Do your Duty and Don't expect the Result
|
|
|
|