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

📄 testramdlg.cpp

📁 WinCE平台下RAM的读写驱动程序
💻 CPP
字号:
// testRAMDlg.cpp : implementation file
//

#include "stdafx.h"
#include "testRAM.h"
#include "testRAMDlg.h"
#include "DllHead.h"

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

HANDLE  hndMem;                               /*  define the handle of the RAM  */

/////////////////////////////////////////////////////////////////////////////
// CTestRAMDlg dialog

CTestRAMDlg::CTestRAMDlg(CWnd* pParent /*=NULL*/)
	: CDialog(CTestRAMDlg::IDD, pParent)
{
	//{{AFX_DATA_INIT(CTestRAMDlg)
	m_address = 0;
	m_WriteChar = 0;
	m_ReadChar = 0;
	//}}AFX_DATA_INIT
	// Note that LoadIcon does not require a subsequent DestroyIcon in Win32
	m_hIcon = AfxGetApp()->LoadIcon(IDR_MAINFRAME);
}

void CTestRAMDlg::DoDataExchange(CDataExchange* pDX)
{
	CDialog::DoDataExchange(pDX);
	//{{AFX_DATA_MAP(CTestRAMDlg)
	DDX_Text(pDX, IDC_ADDR_EDIT1, m_address);
	DDV_MinMaxInt(pDX, m_address, 0, 8191);
	DDX_Text(pDX, IDC_WriteChar_EDIT2, m_WriteChar);
	DDV_MinMaxByte(pDX, m_WriteChar, 0, 255);
	DDX_Text(pDX, IDC_ReadChar_EDIT3, m_ReadChar);
	DDV_MinMaxByte(pDX, m_ReadChar, 0, 255);
	//}}AFX_DATA_MAP
}

BEGIN_MESSAGE_MAP(CTestRAMDlg, CDialog)
	//{{AFX_MSG_MAP(CTestRAMDlg)
	ON_BN_CLICKED(IDC_WriteChar_BUTTON1, OnWriteCharBUTTON1)
	ON_BN_CLICKED(IDC_ReadChar_BUTTON2, OnReadCharBUTTON2)
	//}}AFX_MSG_MAP
END_MESSAGE_MAP()

/////////////////////////////////////////////////////////////////////////////
// CTestRAMDlg message handlers

BOOL CTestRAMDlg::OnInitDialog()
{
	CDialog::OnInitDialog();


    hndMem=GetHandle(2);                   /*   get the handle of RAM   */

	// Set the icon for this dialog.  The framework does this automatically
	//  when the application's main window is not a dialog
	SetIcon(m_hIcon, TRUE);			// Set big icon
	SetIcon(m_hIcon, FALSE);		// Set small icon
	
	CenterWindow(GetDesktopWindow());	// center to the hpc screen

	// TODO: Add extra initialization here
	
	return TRUE;  // return TRUE  unless you set the focus to a control
}



void CTestRAMDlg::OnWriteCharBUTTON1()                        /*  Write char to memory  */
{
	// TODO: Add your control notification handler code here
	UCHAR tempbuf;
    UpdateData(true);
	tempbuf=m_WriteChar;
    WriteChar(hndMem,m_address,tempbuf);



}


void CTestRAMDlg::OnReadCharBUTTON2() 
{
	// TODO: Add your control notification handler code here
	
	
    UpdateData(true);

    m_ReadChar=ReadChar(hndMem,m_address);

	UpdateData(false);
}

⌨️ 快捷键说明

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