本文整理汇总了C++中CHexEditApp::WriteProfileString方法的典型用法代码示例。如果您正苦于以下问题:C++ CHexEditApp::WriteProfileString方法的具体用法?C++ CHexEditApp::WriteProfileString怎么用?C++ CHexEditApp::WriteProfileString使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类CHexEditApp
的用法示例。
在下文中一共展示了CHexEditApp::WriteProfileString方法的2个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: CDialog
CTipDlg::CTipDlg(CWnd* pParent /*=NULL*/)
: CDialog(IDD_TIP, pParent)
{
//{{AFX_DATA_INIT(CTipDlg)
m_bStartup = TRUE;
//}}AFX_DATA_INIT
// We need to find out what the startup and file position parameters are
// If startup does not exist, we assume that the Tips on startup is checked TRUE.
CHexEditApp *aa = dynamic_cast<CHexEditApp *>(AfxGetApp());
m_bStartup = aa->tipofday_;
UINT iFilePos = aa->GetProfileInt(szSection, szIntFilePos, 0);
const char *tip_name = "HexEdit.tip";
// Now try to open the tips file in the current directory
m_pStream = fopen(tip_name, "r");
if (m_pStream == NULL)
{
// AP: This bit added by me -----------------------------------------------------------
// Not found so try to open from the .exe dir
if ((m_pStream = fopen(GetExePath() + tip_name, "r")) == NULL)
// ------------------------------------------------------------------------------------
{
VERIFY(m_strTip.LoadString(CG_IDS_FILE_ABSENT));
return;
}
}
// If the timestamp in the INI file is different from the timestamp of
// the tips file, then we know that the tips file has been modified
// Reset the file position to 0 and write the latest timestamp to the
// ini file
struct _stat buf;
_fstat(_fileno(m_pStream), &buf);
CString strCurrentTime = ctime(&buf.st_ctime);
strCurrentTime.TrimRight();
CString strStoredTime =
aa->GetProfileString(szSection, szTimeStamp, NULL);
if (strCurrentTime != strStoredTime)
{
iFilePos = 0;
aa->WriteProfileString(szSection, szTimeStamp, strCurrentTime);
}
if (fseek(m_pStream, iFilePos, SEEK_SET) != 0)
{
AfxMessageBox(CG_IDP_FILE_CORRUPT);
}
else
{
GetNextTipString(m_strTip);
}
}
示例2: ReadList
void CHexFileList::ReadList()
{
ClearAll();
if (ReadFile())
{
// Update m_arrNames to match
for (int ii = 0; ii < name_.size() && ii < m_nSize; ++ii)
m_arrNames[ii] = name_[name_.size()-ii-1];
}
else
{
// Call base class to get file names from the registry
CRecentFileList::ReadList();
// Get other parameters using old registry entries (for backward compatibility)
int ii;
CString fnum;
struct
{
union
{
DWORD disp_state_;
struct display_bits display_;
};
} tt;
// Read options for each file of the MRU list
for (ii = m_nSize - 1; ii >= 0; ii--)
{
if (m_arrNames[ii].IsEmpty())
continue;
CString ss;
ss = m_arrNames[ii];
name_.push_back(ss);
ss.MakeUpper();
hash_.push_back(str_hash(ss));
opened_.push_back(time(NULL));
data_.push_back("");
fnum.Format("File%d", ii+1);
SetData(name_.size()-1, CMD, theApp.GetProfileInt(fnum, "WindowState", SW_SHOWNORMAL));
SetData(name_.size()-1, TOP, (int)theApp.GetProfileInt(fnum, "WindowTop", -30000));
SetData(name_.size()-1, LEFT, (int)theApp.GetProfileInt(fnum, "WindowLeft", -30000));
SetData(name_.size()-1, BOTTOM, (int)theApp.GetProfileInt(fnum, "WindowBottom", -30000));
SetData(name_.size()-1, RIGHT, (int)theApp.GetProfileInt(fnum, "WindowRight", -30000));
SetData(name_.size()-1, COLUMNS, __min(CHexEditView::max_buf, __max(4, theApp.GetProfileInt(fnum, "Columns", theApp.open_rowsize_))));
SetData(name_.size()-1, GROUPING,__max(2, theApp.GetProfileInt(fnum, "Grouping", theApp.open_group_by_)));
SetData(name_.size()-1, OFFSET, __min(atoi(GetData(name_.size()-1, COLUMNS))-1, theApp.GetProfileInt(fnum, "Offset", theApp.open_offset_)));
ss = theApp.GetProfileString(fnum, "Scheme");
ss.Replace("|", "_"); // A scheme name may no longer contain a vertical bar (|)
SetData(name_.size()-1, SCHEME, ss);
ss = theApp.GetProfileString(fnum, "Font");
CString strTemp;
AfxExtractSubString(strTemp, ss, 0, ',');
SetData(name_.size()-1, FONT, strTemp);
AfxExtractSubString(strTemp, ss, 1, ',');
SetData(name_.size()-1, HEIGHT, strTemp);
ss = theApp.GetProfileString(fnum, "OemFont");
AfxExtractSubString(strTemp, ss, 0, ',');
SetData(name_.size()-1, OEMFONT, strTemp);
AfxExtractSubString(strTemp, ss, 1, ',');
SetData(name_.size()-1, OEMHEIGHT, strTemp);
// Read the option values, defaulting to the global (theApp.open_*) values
if ((tt.disp_state_ = (int)theApp.GetProfileInt(fnum, "DisplayState", -1)) == -1)
if (!tt.display_.hex_area && !tt.display_.char_area)
tt.display_.hex_area = TRUE;
if (!tt.display_.hex_area)
tt.display_.edit_char = TRUE;
else if (!tt.display_.char_area)
tt.display_.edit_char = FALSE;
if (tt.display_.control > 2)
tt.display_.control = 0;
SetData(name_.size()-1, DISPLAY, tt.disp_state_);
SetData(name_.size()-1, DOC_FLAGS, theApp.GetProfileInt(fnum, "KeepTimes", 0));
SetData(name_.size()-1, FORMAT, theApp.GetProfileString(fnum, "FormatFile"));
SetData(name_.size()-1, SELSTART, theApp.GetProfileString(fnum, "SelStart64"));
SetData(name_.size()-1, SELEND, theApp.GetProfileString(fnum, "SelEnd64"));
SetData(name_.size()-1, POS, theApp.GetProfileString(fnum, "Pos64"));
SetData(name_.size()-1, MARK, theApp.GetProfileString(fnum, "Mark64"));
SetData(name_.size()-1, HIGHLIGHTS, theApp.GetProfileString(fnum, "Highlights"));
}
// Now delete the recent file list key (and old one) and all files
theApp.WriteProfileString(_T("RecentFiles"), NULL, NULL);
theApp.WriteProfileString(_T("Recent File List"), NULL, NULL);
for (ii = 0; ii < 16; ++ii) // There may be up to 16 entries (some old unused ones)
{
fnum.Format("File%d", ii+1);
//.........这里部分代码省略.........