CFile file;
CFileException pError;
if (file.Open(L"D:\\aa.txt", CFile::modeCreate || CFile::modeReadWrite, &pError))
{
TCHAR str_aa[] = L"AAAwwwww";
file.Write(str_aa, sizeof(str_aa));
file.Flush();
file.Close();
}
else
{
TCHAR szError[1024];
pError.GetErrorMessage(szError, 1024);
AfxMessageBox(szError);
}
/*CColorDialog dlg(RGB(255, 0, 0), CC_FULLOPEN);
dlg.DoModal();*/
CColorDialog dlg;
if (IDOK == dlg.DoModal())
{
COLORREF color = dlg.GetColor();
/*TRACE("RGB value of the selected color - red = %u, green = %u, blue = %u\n",
GetRValue(color), GetGValue(color), GetBValue(color));*/
//BYTE r = GetRValue(color);
//char *str = (char *)r;
//AfxMessageBox((LPCTSTR)str);
this->SetBackgroundColor(color);
}
网友评论