⭐ 欢迎来到虫虫下载站! | 📦 资源下载 📁 资源专辑 ℹ️ 关于我们
⭐ 虫虫下载站

📄 codemem.cpp

📁 计算机体系结构中,关于DLXS的模拟程序.在vc6.0下编译通过.
💻 CPP
字号:
// codemembar.cpp : implementation file
//


#include "stdafx.h"
#include "Architecture.h"
#include "Globals.h"
#include "Splitter.h"
#include "MainFrm.h"
#include "DlxDoc.h"
#include "codemem.h"

#ifdef _DEBUG
#define new DEBUG_NEW
#undef THIS_FILE
static char THIS_FILE[] = __FILE__;
#endif

/////////////////////////////////////////////////////////////////////////////
// CCodeMemBar

extern CDlxDoc * MyDoc;
CCodeMemBar::CCodeMemBar()
{
}

CCodeMemBar::~CCodeMemBar()
{
}


BEGIN_MESSAGE_MAP(CCodeMemBar, baseCMyBar)
	//{{AFX_MSG_MAP(CCodeMemBar)
	ON_WM_CREATE()
	ON_WM_LBUTTONDBLCLK()
	//}}AFX_MSG_MAP
END_MESSAGE_MAP()


/////////////////////////////////////////////////////////////////////////////
// CCodeMemBar message handlers

int CCodeMemBar::OnCreate(LPCREATESTRUCT lpCreateStruct) 
{
	

	if (baseCMyBar::OnCreate(lpCreateStruct) == -1)
		return -1;

	SetSCBStyle(GetSCBStyle() | SCBS_SHOWEDGES | SCBS_SIZECHILD);
	const DWORD dwViewStyle = WS_VISIBLE | WS_TABSTOP | WS_CHILD | WS_BORDER|LVS_ALIGNTOP|LVS_REPORT;

	if(!m_wndChild.Create(dwViewStyle,CRect(0,0,100,500),this,1985))
		return -1;
	
/*
	LVCOLUMN p;
	m_wndChild.GetColumn(0,&p);
	p.cx = 500;
	p.mask = LVCF_TEXT;
	m_wndChild.SetColumn(0,&p);
*/
	m_wndChild.SetExtendedStyle(LVS_EX_GRIDLINES);
	m_wndChild.InsertColumn(0,_T("Code Memory"),LVCFMT_LEFT,30);
	CodeMemInsert(false);


	return 0;
}

void CCodeMemBar::CodeMemInsert(bool first)
{
	m_wndChild.DeleteAllItems();
	char msg[100];

	if(first)
	for(int i=0;i<100;i++)
	{
		sprintf(msg,"Mem [%d]: %s",i,MyDoc->m_CodeMemory[i]);
		m_wndChild.InsertItem(i,msg);
	}

	else
	for(int i=0;i<100;i++)
	{
		sprintf(msg,"Mem [%d]: %s",i,"00000000000000000000000000000000");
		m_wndChild.InsertItem(i,msg);
		
		m_wndChild.SetColumnWidth(0,300);
	}
}

void CCodeMemBar :: CodeMemUpdate(int intem)
{
	char msg[100];
	sprintf(msg,"Mem [%d]: %s",intem,MyDoc->m_CodeMemory[intem]);
	m_wndChild.InsertItem(intem,msg);
	m_wndChild.DeleteItem(intem);
	m_wndChild.InsertItem(intem,msg);
}

⌨️ 快捷键说明

复制代码 Ctrl + C
搜索代码 Ctrl + F
全屏模式 F11
切换主题 Ctrl + Shift + D
显示快捷键 ?
增大字号 Ctrl + =
减小字号 Ctrl + -