?? 驅動加載及evc程序設計.txt
字號:
///////////////////////////////////////////////////////////////////////////////
sources文件修改如下
!if 0
Copyright (c) Microsoft Corporation. All rights reserved.
!endif
!if 0
Use of this source code is subject to the terms of the Microsoft end-user
license agreement (EULA) under which you licensed this SOFTWARE PRODUCT.
If you did not accept the terms of the EULA, you are not authorized to use
this source code. For a copy of the EULA, please see the LICENSE.RTF on your
install media.
!endif
SYNCHRONIZE_DRAIN=1
TARGETNAME=nleddrv
RELEASETYPE=PLATFORM
TARGETTYPE=LIBRARY
SOURCES=nleddrv.cpp
INCLUDES=..\..\inc
二、打開EVC,編寫控制軟件。
1、首先添加兩個外部變量
extern "C" {
BOOL WINAPI NLedGetDeviceInfo( UINT nInfoId, void *pOutput );
BOOL WINAPI NLedSetDevice( UINT nDeviceId, void *pInput );
//BOOL NLedDriverInitialize();
};
2、在程序中添加下面兩個函數。
//下面的函數可以取得設備上LED總數
int CCtLEDDlg::GetLedCount()
{
NLED_COUNT_INFO nci;
int wCount = 0;
if(NLedGetDeviceInfo(NLED_COUNT_INFO_ID, (PVOID) &nci))
wCount = (int) nci.cLeds;
return wCount;
}
//下面的函數設置LED狀態
void CCtLEDDlg::SetLedStatus(int wLed, int wStatus)
{
NLED_SETTINGS_INFO nsi;
nsi.LedNum = (INT) wLed;
nsi.OffOnBlink = (INT) wStatus;
NLedSetDevice(NLED_SETTINGS_INFO_ID, &nsi);
}
3. 獲得LED的數量
void CCtLEDDlg::OnButton1()
{
// TODO: Add your control notification handler code here
CString str;
int cLED=GetLedCount();
str.Format(L"%d",cLED);
MessageBox(str);
}
4、打開和關閉LED
SetLedStatus(1, 1);//打開LED
SetLedStatus(1, 0);//關閉LED
?? 快捷鍵說明
復制代碼
Ctrl + C
搜索代碼
Ctrl + F
全屏模式
F11
切換主題
Ctrl + Shift + D
顯示快捷鍵
?
增大字號
Ctrl + =
減小字號
Ctrl + -