📄 aadlg.cpp.bak
字号:
// aaDlg.cpp : implementation file
//
#include "stdafx.h"
#include "aa.h"
#include "aaDlg.h"
#ifdef _DEBUG
#define new DEBUG_NEW
#undef THIS_FILE
static char THIS_FILE[] = __FILE__;
#endif
/////////////////////////////////////////////////////////////////////////////
// CAaDlg dialog
CAaDlg::CAaDlg(CWnd* pParent /*=NULL*/)
: CDialog(CAaDlg::IDD, pParent)
{
//{{AFX_DATA_INIT(CAaDlg)
// NOTE: the ClassWizard will add member initialization here
//}}AFX_DATA_INIT
// Note that LoadIcon does not require a subsequent DestroyIcon in Win32
m_hIcon = AfxGetApp()->LoadIcon(IDR_MAINFRAME);
}
void CAaDlg::DoDataExchange(CDataExchange* pDX)
{
CDialog::DoDataExchange(pDX);
//{{AFX_DATA_MAP(CAaDlg)
// NOTE: the ClassWizard will add DDX and DDV calls here
//}}AFX_DATA_MAP
}
BEGIN_MESSAGE_MAP(CAaDlg, CDialog)
//{{AFX_MSG_MAP(CAaDlg)
ON_BN_CLICKED(IDC_READ, OnRead)
ON_BN_CLICKED(IDC_CLOSE, OnClose)
//}}AFX_MSG_MAP
END_MESSAGE_MAP()
/////////////////////////////////////////////////////////////////////////////
// CAaDlg message handlers
BOOL CAaDlg::OnInitDialog()
{
CDialog::OnInitDialog();
// 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 CAaDlg::OnRead()
{
// Read value from driver
ULONG wch[4096];
DWORD dwBytesRead =32;
/////////////open str1
h=CreateFile(TEXT("STR1:"),GENERIC_READ|GENERIC_WRITE,0,NULL,OPEN_EXISTING,0,NULL);
if (h==INVALID_HANDLE_VALUE)
{
::MessageBox(NULL,_T("Cannot open STR1:"),_T("STRApp"),MB_OK);
}
else
{
::MessageBox(NULL,_T(" open STR1:Succde"),_T("STRApp"),MB_OK);
}
///////////////////////////read boardid
memset(&wch, '\0', 32 * sizeof(WCHAR));
::ReadFile(h, wch, 0x20, &dwBytesRead, NULL);
printf("the value of wch = 0x%08x\n", wch[0]);
printf("the value of dwBytesRead = %d\n", dwBytesRead);
}
void CAaDlg::OnClose()
{
if(h!=NULL)
CloseHandle(h);
h=NULL;
::MessageBox(NULL,_T("close STR:Succde"),_T("STRApp"),MB_OK);
}
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -