AsifMughal
asked on
Problem with COLORREF type
Hello
I am trying to give the user the option to change the background colour of a List Box and store the selected colour in the ini file, so that it will re-appear when they logon on again. The code I am using is as follows:
void CPatientView::OnTextCol()
{
// TODO: Add your control notification handler code here
CPatientDoc* pDoc = GetDocument();
CColorDialog dlg;
//dlg.SetCurrentColor(pDoc ->GetColor ());
if (dlg.DoModal() == IDOK)
{
COLORREF color = dlg.GetColor();
//CString Temp;
//Temp.Format("%s", (LPCTSTR)color);
OUR_APP->WriteProfileStrin g( "Colours", "Background", LPCTSTR(color));
}
The main problem is that the entry written in the ini file is always null, whichever colour the user selects.
As far as I am aware the COLORREF type is a RGB value, can I store this in anyway in the INI file.
I very much look forward to a reply
Thanks in advance.
}
I am trying to give the user the option to change the background colour of a List Box and store the selected colour in the ini file, so that it will re-appear when they logon on again. The code I am using is as follows:
void CPatientView::OnTextCol()
{
// TODO: Add your control notification handler code here
CPatientDoc* pDoc = GetDocument();
CColorDialog dlg;
//dlg.SetCurrentColor(pDoc
if (dlg.DoModal() == IDOK)
{
COLORREF color = dlg.GetColor();
//CString Temp;
//Temp.Format("%s", (LPCTSTR)color);
OUR_APP->WriteProfileStrin
}
The main problem is that the entry written in the ini file is always null, whichever colour the user selects.
As far as I am aware the COLORREF type is a RGB value, can I store this in anyway in the INI file.
I very much look forward to a reply
Thanks in advance.
}
ASKER CERTIFIED SOLUTION
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
Sorry you are right. I don't have to do much with these WriteProfile... things, so i didn't see that
there is a function for writing an integer.
I think you should get the points :(
there is a function for writing an integer.
I think you should get the points :(
Well, I feel guilty for answering an answered question!
Phillilp
Phillilp
How about just...
WriteProfileInt( "Colours", "Background", color );
and
color = GetProfileInt( "Colours", "Background", RGB( default ));
Phillip