MFC: CFile

2017-05-10  本文已影响0人  dyg540

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);

}

上一篇 下一篇

猜你喜欢

热点阅读