当前位置: 首页>>代码示例>>C++>>正文


C++ CHexEditApp类代码示例

本文整理汇总了C++中CHexEditApp的典型用法代码示例。如果您正苦于以下问题:C++ CHexEditApp类的具体用法?C++ CHexEditApp怎么用?C++ CHexEditApp使用的例子?那么, 这里精选的类代码示例或许可以为您提供帮助。


在下文中一共展示了CHexEditApp类的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的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);
	}
}
开发者ID:KB3NZQ,项目名称:hexedit4,代码行数:54,代码来源:Tipdlg.cpp

示例2: OnSysCommand

// Handles control menu commands and system buttons (Minimize etc)
void CChildFrame::OnSysCommand(UINT nID, LONG lParam)
{
	CMDIChildWndEx::OnSysCommand(nID, lParam);

	CHexEditApp *aa = dynamic_cast<CHexEditApp *>(AfxGetApp());
	nID &= 0xFFF0;
	if (nID == SC_MINIMIZE || nID == SC_RESTORE || nID == SC_MAXIMIZE ||
		nID == SC_NEXTWINDOW || nID == SC_PREVWINDOW || nID == SC_CLOSE)
	{
		if ((nID == SC_NEXTWINDOW || nID == SC_PREVWINDOW || nID == SC_CLOSE) &&
			aa->recording_ && aa->mac_.size() > 0 && (aa->mac_.back()).ktype == km_focus)
		{
			// Next win, prev. win, close win cause focus change which causes a km_focus
			// for a particular window to be stored.  On replay, we don't want to
			// change to this window before executing this command.
			aa->mac_.pop_back();
		}
		aa->SaveToMacro(km_childsys, nID);
	}
}
开发者ID:Andrew-Phillips,项目名称:HexEdit,代码行数:21,代码来源:ChildFrm.cpp

示例3: freq_compare


//.........这里部分代码省略.........
		numRecent = name_.size();

	ASSERT(numRecent + numFreq + numFav <= maxSlots);

	// Make sure we are associated with the extensions of all the files we are adding to the jump list
	CaseInsensitiveSet ext;

	// Get extensions of recent files
	for (int ii = name_.size() - 1; ii >= (int)name_.size() - numRecent; ii--)
	{
		ext.insert(CString(::PathFindExtension(name_[ii])));
	}

	// Get extensions of frequently opened files
	freq_type temp = freq;
	while (temp.size() > 0)
	{
		ext.insert(CString(::PathFindExtension(name_[temp.top()])));
		temp.pop();
	}

	// Get extensions of favourite files
	for (int ii = 0; ii < fav.size(); ++ii)
	{
		ext.insert(CString(::PathFindExtension(name_[fav[ii]])));
	}

	// Check if appid or exe name is wrong in "HKCR\HexEdit.file"
	bool need_reg = false;
	HKEY hkey;

	// Check that our "file" registry setting is present in the registry and APPID is correct
    if (RegOpenKeyEx(HKEY_CLASSES_ROOT,
	                 CString(CHexEditApp::ProgID), 
	                 0, KEY_QUERY_VALUE, &hkey) != ERROR_SUCCESS)
	{
		need_reg = true;  // HexEdit file registry setting is not present
	}
	else
	{
		char buf[1024];
		DWORD len = sizeof(buf)-1;
		CString ss = theApp.m_pszAppID;
		if (RegQueryValueEx(hkey, "AppUserModelID", NULL, NULL, (LPBYTE)buf, &len) != ERROR_SUCCESS ||
			ss.CompareNoCase(buf) != 0)
		{
			need_reg = true;   // command line setting is not present or it is using a different .exe
		}
        RegCloseKey(hkey);
	}

	if (!need_reg)
	{
		// Also check that command setting is present and points to our .exe
		if (RegOpenKeyEx(HKEY_CLASSES_ROOT,
						 CString(CHexEditApp::ProgID) + "\\shell\\open\\command", 
						 0, KEY_QUERY_VALUE, &hkey) != ERROR_SUCCESS)
		{
			need_reg = true;  // HexEdit file command setting is not present
		}
		else
		{
			char buf[1024];
			DWORD len = sizeof(buf)-1;
			CString ss;
			AfxGetModuleFileName(0, ss);   // new in MFC 10?
开发者ID:AndrewWPhillips,项目名称:HexEdit,代码行数:67,代码来源:HexFileList.cpp

示例4: OnPostInit

LRESULT CHexFileDialog::OnPostInit(WPARAM wp, LPARAM lp)
{
	// Set text of "OK" button
	if (!strOKName.IsEmpty())
		SetControlText(IDOK, strOKName);

	// Restore the window position and size
	CRect rr(theApp.GetProfileInt("Window-Settings", strName+"X1", -30000),
			 theApp.GetProfileInt("Window-Settings", strName+"Y1", -30000),
			 theApp.GetProfileInt("Window-Settings", strName+"X2", -30000),
			 theApp.GetProfileInt("Window-Settings", strName+"Y2", -30000));
	if (rr.top != -30000)
		GetParent()->MoveWindow(&rr);  // Note: there was a crash here until we set 8th
									   // param of CFileDialog (bVistaStyle) c'tor to FALSE.

	// Restore the list view display mode (details, report, icons, etc)
	ASSERT(GetParent() != NULL);
	CWnd *psdv  = FindWindowEx(GetParent()->m_hWnd, NULL, "SHELLDLL_DefView", NULL);
	if (psdv != NULL)
	{
		int mode = theApp.GetProfileInt("Window-Settings", strName+"Mode", REPORT);
		psdv->SendMessage(WM_COMMAND, mode, 0);
	}

	return 0;
}
开发者ID:KB3NZQ,项目名称:hexedit4,代码行数:26,代码来源:Dialog.cpp

示例5: FixControls

void CMultiplay::FixControls()
{
	name_ctrl_.GetLBText(name_ctrl_.GetCurSel(), macro_name_);

	if (macro_name_ == DEFAULT_MACRO_NAME)
	{
		plays_ = 1;
	}
	else
	{
		std::vector<key_macro> tmp;
		CString comment;
		int halt_lev;
		long plays;
		int version;  // Version of HexEdit in which the macro was recorded

		ASSERT(theApp.mac_dir_.Right(1) == "\\");
		if (theApp.macro_load(theApp.mac_dir_ + macro_name_ + ".hem", &tmp, comment, halt_lev, plays, version))
			plays_ = plays;
		else
		{
			ASSERT(0);
			plays_ = 1;
		}
	}

	UpdateData(FALSE);  // Put number of plays into control
}
开发者ID:KB3NZQ,项目名称:hexedit4,代码行数:28,代码来源:Dialog.cpp

示例6: OnFileNameOK

BOOL CHexFileDialog::OnFileNameOK()
{
	// Remember current window pos for when window is reopened
	CRect rr;
	GetParent()->GetWindowRect(&rr);
	theApp.WriteProfileInt("Window-Settings", strName+"X1", rr.left);
	theApp.WriteProfileInt("Window-Settings", strName+"Y1", rr.top);
	theApp.WriteProfileInt("Window-Settings", strName+"X2", rr.right);
	theApp.WriteProfileInt("Window-Settings", strName+"Y2", rr.bottom);

	// Remember current list view mode
	ASSERT(GetParent() != NULL);
	CWnd *psdv  = FindWindowEx(GetParent()->m_hWnd, NULL, "SHELLDLL_DefView", NULL);
	ASSERT(psdv != NULL);
	CWnd *plv   = FindWindowEx(psdv->m_hWnd, NULL, "SysListView32", NULL);
	ASSERT(plv != NULL);

	int mode = 0;
	switch (plv->SendMessage(LVM_FIRST + 143 /*LVM_GETVIEW*/))
	{
	case LVS_ICON:
	case LVS_SMALLICON:
		mode = ICON;
		break;
	case LVS_REPORT:
		mode = REPORT;
		break;
	case LVS_LIST:
		mode = LIST;
		break;
	default:
		mode = TILE;
		break;
	}
	theApp.WriteProfileInt("Window-Settings", strName+"Mode", mode);

	return CFileDialog::OnFileNameOK();
}
开发者ID:KB3NZQ,项目名称:hexedit4,代码行数:38,代码来源:Dialog.cpp

示例7: OnAttachmentBrowse

void CEmailDlg::OnAttachmentBrowse() 
{
	UpdateData();

	CHexFileDialog dlgFile("AttachmentDlg", HIDD_FILE_ATTACH, TRUE, NULL, attachment_,
						   OFN_HIDEREADONLY | OFN_FILEMUSTEXIST | OFN_DONTADDTORECENT,
						   theApp.GetCurrentFilters(), "Attach", this);

	if (dlgFile.DoModal() == IDOK)
	{
		attachment_ = dlgFile.GetPathName();
		UpdateData(FALSE);
	}
}
开发者ID:KB3NZQ,项目名称:hexedit4,代码行数:14,代码来源:EmailDlg.cpp

示例8: 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);
//.........这里部分代码省略.........
开发者ID:KB3NZQ,项目名称:hexedit4,代码行数:101,代码来源:HexFileList.cpp

示例9: create_header

CString CHexEditView::create_header(const char *fmt, long pagenum)
{
	bool bDiskFile = GetDocument()->pfile1_ != NULL;
	bool bDevice = bDiskFile && GetDocument()->IsDevice();
	CString retval;                     // Return string
	CString sin = fmt;                  // Rest of input string
	int pos;                            // Posn in string of param.
	CString ss;                         // Temporary string
	CHexFileList *pfl = theApp.GetFileList();
	int ii = -1;
	if (GetDocument()->pfile1_ != NULL) // make sure there is a disk file (pfl requires a disk file name)
		ii = pfl->GetIndex(GetDocument()->pfile1_->GetFilePath());

	CFileStatus status;                 // Get status of file (for times)
	if (bDiskFile && !bDevice)
		GetDocument()->pfile1_->GetStatus(status);

	while ((pos = sin.Find("&")) != -1)
	{
		retval += sin.Left(pos);
		if (sin.GetLength() > pos + 1)
		{
			switch (toupper(sin[pos+1]))
			{
			case 'F':
				if (bDiskFile)
					retval += GetDocument()->pfile1_->GetFileName();
				break;
			case 'A':
				if (bDevice)
					retval += GetDocument()->pfile1_->GetFileName();
				else if (bDiskFile)
					retval += GetDocument()->pfile1_->GetFilePath();
				break;
			case 'P':
				ss.Format("%ld", long(pagenum));
				retval += ss;
				break;
			case 'D':
				retval += print_time_.Format("%x");
				break;
			case 'T':
				retval += print_time_.Format("%X");
				break;
			case 'N':
				retval += print_time_.Format("%#c");
				break;
			case 'C':
				if (bDiskFile && !bDevice)
					retval += status.m_ctime.Format("%c");
				break;
			case 'M':
				if (bDiskFile && !bDevice)
					retval += status.m_mtime.Format("%c");
				break;
#if 0 // Since we have the file open the last access time is now so don't bother with this one
			case 'U':
				if (bDiskFile && !bDevice)
					retval += status.m_atime.Format("%c");
				break;
#endif
			case 'G':
				if (ii > -1)
					retval += pfl->GetData(ii, CHexFileList::CATEGORY);
				break;
			case 'K':
				if (ii > -1)
					retval += pfl->GetData(ii, CHexFileList::KEYWORDS);
				break;
			case 'X':
				if (ii > -1)
					retval += pfl->GetData(ii, CHexFileList::COMMENTS);
				break;
			default:
			case '&':
				retval += sin[pos+1];
			}
			sin = sin.Mid(pos+2);
		}
		else
		{
			sin.Empty();
			break;
		}
	}
	retval += sin;

	return retval;
}
开发者ID:Andrew-Phillips,项目名称:HexEdit,代码行数:89,代码来源:HexViewPrint.cpp

示例10: OnContextMenu

void CPassword::OnContextMenu(CWnd* pWnd, CPoint point)
{
	theApp.HtmlHelpContextMenu(pWnd, id_pairs);
}
开发者ID:AndrewWPhillips,项目名称:HexEdit,代码行数:4,代码来源:Password.cpp

示例11: OnHelpInfo

BOOL CPassword::OnHelpInfo(HELPINFO* pHelpInfo)
{
	theApp.HtmlHelpWmHelp((HWND)pHelpInfo->hItemHandle, id_pairs);
	return TRUE;
}
开发者ID:AndrewWPhillips,项目名称:HexEdit,代码行数:5,代码来源:Password.cpp

示例12: OnContextMenu

void CMultiplay::OnContextMenu(CWnd* pWnd, CPoint point) 
{
	theApp.HtmlHelpContextMenu(pWnd, id_pairs_play);
}
开发者ID:KB3NZQ,项目名称:hexedit4,代码行数:4,代码来源:Dialog.cpp

示例13: OnContextMenu

void CEmailDlg::OnContextMenu(CWnd* pWnd, CPoint point) 
{
	theApp.HtmlHelpContextMenu(pWnd, id_pairs);
}
开发者ID:KB3NZQ,项目名称:hexedit4,代码行数:4,代码来源:EmailDlg.cpp

示例14: OnHelpInfo

BOOL CMultiplay::OnHelpInfo(HELPINFO* pHelpInfo) 
{
	theApp.HtmlHelpWmHelp((HWND)pHelpInfo->hItemHandle, id_pairs_play);
	return TRUE;
}
开发者ID:KB3NZQ,项目名称:hexedit4,代码行数:5,代码来源:Dialog.cpp

示例15: OnPlayOptions

void CMultiplay::OnPlayOptions() 
{
	// Invoke the Options dlg with the macro page displayed
	theApp.display_options(MACRO_OPTIONS_PAGE, TRUE);
}
开发者ID:KB3NZQ,项目名称:hexedit4,代码行数:5,代码来源:Dialog.cpp


注:本文中的CHexEditApp类示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。