?? deviceexdlg.cpp
字號:
// DeviceEXDlg.cpp : implementation file
//
#include "stdafx.h"
#include "DeviceEX.h"
#include "DeviceEXDlg.h"
#ifdef _DEBUG
#define new DEBUG_NEW
#undef THIS_FILE
static char THIS_FILE[] = __FILE__;
#endif
/////////////////////////////////////////////////////////////////////////////
// CDeviceEXDlg dialog
CDeviceEXDlg::CDeviceEXDlg(CWnd* pParent /*=NULL*/)
: CDialog(CDeviceEXDlg::IDD, pParent)
{
//{{AFX_DATA_INIT(CDeviceEXDlg)
// 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 CDeviceEXDlg::DoDataExchange(CDataExchange* pDX)
{
CDialog::DoDataExchange(pDX);
//{{AFX_DATA_MAP(CDeviceEXDlg)
// NOTE: the ClassWizard will add DDX and DDV calls here
//}}AFX_DATA_MAP
}
BEGIN_MESSAGE_MAP(CDeviceEXDlg, CDialog)
//{{AFX_MSG_MAP(CDeviceEXDlg)
ON_BN_CLICKED(IDC_INITDEVICE, OnInitdevice)
ON_BN_CLICKED(IDC_UNINDEVICE, OnUnindevice)
//}}AFX_MSG_MAP
END_MESSAGE_MAP()
/////////////////////////////////////////////////////////////////////////////
// CDeviceEXDlg message handlers
BOOL CDeviceEXDlg::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
//CString str=_T("動態驅動加載");
::SetWindowText(CWnd::m_hWnd,_T("動態驅動加載"));
return TRUE; // return TRUE unless you set the focus to a control
}
BOOL CDeviceEXDlg::OnInitdevice()
{
// TODO: Add your control notification handler code here
//加HKEY_LOCAL_MACHINE會出錯,我試過N*N次才搞定,不要走我的彎路.
//hDevice = ActivateDeviceEx(TEXT("HKEY_LOCAL_MACHINE\\Drivers\\USB"),NULL,0,NULL);
//把USB改成你的驅動所在的注冊表位置就可以了.
//記得調試時不要放在WinCE自動加載的位置喲!!!!!!!!!!(不要放在這個鍵下面:Drivers\BuiltIn)
//調試完了把在驅動里把注冊表改為Drivers\BuiltIn\你的驅動,這樣WinCE啟動時會自動加載.
hDevice = ActivateDeviceEx(TEXT("Drivers\\USB"),NULL,0,NULL);
if (hDevice)
//GetDlgItem(IDC_STATIC)->SetWindowText(_T("驅動加載成功!"));
::SetWindowText(CWnd::m_hWnd,_T("驅動加載成功!"));
else
::SetWindowText(CWnd::m_hWnd,_T("驅動加載失敗!"));
return FALSE;
}
void CDeviceEXDlg::OnUnindevice()
{
// TODO: Add your control notification handler code here
::SetWindowText(CWnd::m_hWnd,_T("卸載驅動并退出!"));
DeactivateDevice(hDevice);
EndDialog(IDOK);
}
?? 快捷鍵說明
復制代碼
Ctrl + C
搜索代碼
Ctrl + F
全屏模式
F11
切換主題
Ctrl + Shift + D
顯示快捷鍵
?
增大字號
Ctrl + =
減小字號
Ctrl + -