Source code of Windows XP (NT5)
You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

611 lines
18 KiB

  1. // devctrlDlg.cpp : implementation file
  2. //
  3. #include "stdafx.h"
  4. #include "devctrl.h"
  5. #include "devctrlDlg.h"
  6. #ifdef _DEBUG
  7. #define new DEBUG_NEW
  8. #undef THIS_FILE
  9. static char THIS_FILE[] = __FILE__;
  10. #endif
  11. /////////////////////////////////////////////////////////////////////////////
  12. // CAboutDlg dialog used for App About
  13. class CAboutDlg : public CDialog
  14. {
  15. public:
  16. CAboutDlg();
  17. // Dialog Data
  18. //{{AFX_DATA(CAboutDlg)
  19. enum { IDD = IDD_ABOUTBOX };
  20. //}}AFX_DATA
  21. // ClassWizard generated virtual function overrides
  22. //{{AFX_VIRTUAL(CAboutDlg)
  23. protected:
  24. virtual void DoDataExchange(CDataExchange* pDX); // DDX/DDV support
  25. //}}AFX_VIRTUAL
  26. // Implementation
  27. protected:
  28. //{{AFX_MSG(CAboutDlg)
  29. //}}AFX_MSG
  30. DECLARE_MESSAGE_MAP()
  31. };
  32. CAboutDlg::CAboutDlg() : CDialog(CAboutDlg::IDD)
  33. {
  34. //{{AFX_DATA_INIT(CAboutDlg)
  35. //}}AFX_DATA_INIT
  36. }
  37. void CAboutDlg::DoDataExchange(CDataExchange* pDX)
  38. {
  39. CDialog::DoDataExchange(pDX);
  40. //{{AFX_DATA_MAP(CAboutDlg)
  41. //}}AFX_DATA_MAP
  42. }
  43. BEGIN_MESSAGE_MAP(CAboutDlg, CDialog)
  44. //{{AFX_MSG_MAP(CAboutDlg)
  45. // No message handlers
  46. //}}AFX_MSG_MAP
  47. END_MESSAGE_MAP()
  48. /////////////////////////////////////////////////////////////////////////////
  49. // CDevctrlDlg dialog
  50. CDevctrlDlg::CDevctrlDlg(CWnd* pParent /*=NULL*/)
  51. : CDialog(CDevctrlDlg::IDD, pParent)
  52. {
  53. //{{AFX_DATA_INIT(CDevctrlDlg)
  54. m_xres = 0;
  55. m_yres = 0;
  56. m_xpos = 0;
  57. m_ypos = 0;
  58. m_xext = 0;
  59. m_yext = 0;
  60. m_CreateFileName = _T("");
  61. //}}AFX_DATA_INIT
  62. // Note that LoadIcon does not require a subsequent DestroyIcon in Win32
  63. m_hIcon = AfxGetApp()->LoadIcon(IDR_MAINFRAME);
  64. }
  65. void CDevctrlDlg::DoDataExchange(CDataExchange* pDX)
  66. {
  67. CDialog::DoDataExchange(pDX);
  68. //{{AFX_DATA_MAP(CDevctrlDlg)
  69. DDX_Control(pDX, IDC_CREATE_BUTTON, m_CreateButton);
  70. DDX_Control(pDX, IDC_DATATYPE_COMBOBOX, m_DataTypeCombobox);
  71. DDX_Control(pDX, IDC_DEVICE_COMBO_BOX, m_DeviceCombobox);
  72. DDX_Text(pDX, IDC_XRES_EDITBOX, m_xres);
  73. DDX_Text(pDX, IDC_YRES_EDITBOX, m_yres);
  74. DDX_Text(pDX, IDC_XPOS_EDITBOX, m_xpos);
  75. DDX_Text(pDX, IDC_YPOS_EDITBOX, m_ypos);
  76. DDX_Text(pDX, IDC_XEXT_EDITBOX, m_xext);
  77. DDX_Text(pDX, IDC_YEXT_EDITBOX, m_yext);
  78. DDX_Text(pDX, IDC_CREATE_FILENAME_EDITBOX, m_CreateFileName);
  79. //}}AFX_DATA_MAP
  80. }
  81. BEGIN_MESSAGE_MAP(CDevctrlDlg, CDialog)
  82. //{{AFX_MSG_MAP(CDevctrlDlg)
  83. ON_WM_SYSCOMMAND()
  84. ON_WM_PAINT()
  85. ON_WM_QUERYDRAGICON()
  86. ON_BN_CLICKED(IDC_WRITE_SETTINGS_BUTTON, OnWriteSettingsButton)
  87. ON_BN_CLICKED(IDC_SCAN_BUTTON, OnScanButton)
  88. ON_BN_CLICKED(IDC_ABORT_SCAN_BUTTON, OnAbortScanButton)
  89. ON_BN_CLICKED(IDC_CONFIGURE_BUTTON, OnConfigureButton)
  90. ON_BN_CLICKED(IDC_CREATE_BUTTON, OnCreateButton)
  91. //}}AFX_MSG_MAP
  92. END_MESSAGE_MAP()
  93. /////////////////////////////////////////////////////////////////////////////
  94. // CDevctrlDlg message handlers
  95. BOOL CDevctrlDlg::OnInitDialog()
  96. {
  97. CDialog::OnInitDialog();
  98. // Add "About..." menu item to system menu.
  99. // IDM_ABOUTBOX must be in the system command range.
  100. ASSERT((IDM_ABOUTBOX & 0xFFF0) == IDM_ABOUTBOX);
  101. ASSERT(IDM_ABOUTBOX < 0xF000);
  102. CMenu* pSysMenu = GetSystemMenu(FALSE);
  103. if (pSysMenu != NULL)
  104. {
  105. CString strAboutMenu;
  106. strAboutMenu.LoadString(IDS_ABOUTBOX);
  107. if (!strAboutMenu.IsEmpty())
  108. {
  109. pSysMenu->AppendMenu(MF_SEPARATOR);
  110. pSysMenu->AppendMenu(MF_STRING, IDM_ABOUTBOX, strAboutMenu);
  111. }
  112. }
  113. // Set the icon for this dialog. The framework does this automatically
  114. // when the application's main window is not a dialog
  115. SetIcon(m_hIcon, TRUE); // Set big icon
  116. SetIcon(m_hIcon, FALSE); // Set small icon
  117. ReadRegistryValues();
  118. memset(m_DeviceControl.DeviceIOHandles,
  119. 0,
  120. sizeof(m_DeviceControl.DeviceIOHandles));
  121. m_CreateButton.SetIcon(LoadIcon(AfxGetInstanceHandle(),MAKEINTRESOURCE(IDR_MAINFRAME)));
  122. //
  123. // TODO: fix the base object. Creating a new
  124. // one for each scanner...is a waste.
  125. // This was done temporarly because of
  126. // time constraints..in tool development.
  127. // -coop
  128. //
  129. m_phpscl = NULL;
  130. m_pprimaxE3 = NULL;
  131. m_phpscl = new CHPSCL(&m_DeviceControl);
  132. m_pprimaxE3 = new CPMXE3(&m_DeviceControl);
  133. return TRUE; // return TRUE unless you set the focus to a control
  134. }
  135. void CDevctrlDlg::OnSysCommand(UINT nID, LPARAM lParam)
  136. {
  137. if ((nID & 0xFFF0) == IDM_ABOUTBOX)
  138. {
  139. CAboutDlg dlgAbout;
  140. dlgAbout.DoModal();
  141. }
  142. else
  143. {
  144. CDialog::OnSysCommand(nID, lParam);
  145. }
  146. }
  147. // If you add a minimize button to your dialog, you will need the code below
  148. // to draw the icon. For MFC applications using the document/view model,
  149. // this is automatically done for you by the framework.
  150. void CDevctrlDlg::OnPaint()
  151. {
  152. if (IsIconic())
  153. {
  154. CPaintDC dc(this); // device context for painting
  155. SendMessage(WM_ICONERASEBKGND, (WPARAM) dc.GetSafeHdc(), 0);
  156. // Center icon in client rectangle
  157. int cxIcon = GetSystemMetrics(SM_CXICON);
  158. int cyIcon = GetSystemMetrics(SM_CYICON);
  159. CRect rect;
  160. GetClientRect(&rect);
  161. int x = (rect.Width() - cxIcon + 1) / 2;
  162. int y = (rect.Height() - cyIcon + 1) / 2;
  163. // Draw the icon
  164. dc.DrawIcon(x, y, m_hIcon);
  165. }
  166. else
  167. {
  168. CDialog::OnPaint();
  169. }
  170. }
  171. // The system calls this to obtain the cursor to display while the user drags
  172. // the minimized window.
  173. HCURSOR CDevctrlDlg::OnQueryDragIcon()
  174. {
  175. return (HCURSOR) m_hIcon;
  176. }
  177. void CDevctrlDlg::OnWriteSettingsButton()
  178. {
  179. // nothing
  180. }
  181. BOOL CDevctrlDlg::WriteScannerSettings()
  182. {
  183. UpdateData(TRUE);
  184. //
  185. // TODO: fix the base object, so we can use that
  186. // object to do these operations... not
  187. // create a new one each time...
  188. // -coop
  189. //
  190. switch(m_DeviceCombobox.GetCurSel()){
  191. case HP_SCL_SCANNER:
  192. if(!m_phpscl->SetXRes(m_xres)){
  193. MessageBox(TEXT("Setting X Resolution Failed"));
  194. return FALSE;
  195. break;
  196. }
  197. if(!m_phpscl->SetYRes(m_yres)){
  198. MessageBox(TEXT("Setting Y Resolution Failed"));
  199. return FALSE;
  200. break;
  201. }
  202. if(!m_phpscl->SetXPos(m_xpos)){
  203. MessageBox(TEXT("Setting X Position Failed"));
  204. return FALSE;
  205. break;
  206. }
  207. if(!m_phpscl->SetYPos(m_ypos)){
  208. MessageBox(TEXT("Setting Y Position Failed"));
  209. return FALSE;
  210. break;
  211. }
  212. if(!m_phpscl->SetXExt(m_xext)){
  213. MessageBox(TEXT("Setting X Extent Failed"));
  214. return FALSE;
  215. break;
  216. }
  217. if(!m_phpscl->SetYExt(m_yext)){
  218. MessageBox(TEXT("Setting Y Extent Failed"));
  219. return FALSE;
  220. break;
  221. }
  222. if(!m_phpscl->SetDataType(m_DataTypeCombobox.GetCurSel())){
  223. MessageBox(TEXT("Setting Data Type Failed"));
  224. return FALSE;
  225. break;
  226. }
  227. break;
  228. case VISIONEER_E3_SCANNER:
  229. if(!m_pprimaxE3->WakeupScanner()){
  230. MessageBox(TEXT("Scanner will not wake up!"));
  231. return FALSE;
  232. break;
  233. }
  234. if(!m_pprimaxE3->SetXRes(m_xres)){
  235. MessageBox(TEXT("Setting X Resolution Failed"));
  236. return FALSE;
  237. break;
  238. }
  239. if(!m_pprimaxE3->SetYRes(m_yres)){
  240. MessageBox(TEXT("Setting Y Resolution Failed"));
  241. return FALSE;
  242. break;
  243. }
  244. if(!m_pprimaxE3->SetXPos(m_xpos)){
  245. MessageBox(TEXT("Setting X Position Failed"));
  246. return FALSE;
  247. break;
  248. }
  249. if(!m_pprimaxE3->SetYPos(m_ypos)){
  250. MessageBox(TEXT("Setting Y Position Failed"));
  251. return FALSE;
  252. break;
  253. }
  254. if(!m_pprimaxE3->SetXExt(m_xext)){
  255. MessageBox(TEXT("Setting X Extent Failed"));
  256. return FALSE;
  257. break;
  258. }
  259. if(!m_pprimaxE3->SetYExt(m_yext)){
  260. MessageBox(TEXT("Setting Y Extent Failed"));
  261. return FALSE;
  262. break;
  263. }
  264. if(!m_pprimaxE3->SetDataType(m_DataTypeCombobox.GetCurSel())){
  265. MessageBox(TEXT("Setting Data Type Failed"));
  266. return FALSE;
  267. break;
  268. }
  269. break;
  270. default:
  271. MessageBox(TEXT("unknown device type selected"),TEXT("Error"),MB_ICONERROR);
  272. return FALSE;
  273. break;
  274. }
  275. return TRUE;
  276. }
  277. void CDevctrlDlg::OnScanButton()
  278. {
  279. if(!WriteScannerSettings())
  280. return;
  281. switch(m_DeviceCombobox.GetCurSel()){
  282. case HP_SCL_SCANNER:
  283. if (!m_phpscl->Scan())
  284. MessageBox(TEXT("Scan Failed"),TEXT("Error"),MB_ICONERROR);
  285. break;
  286. case VISIONEER_E3_SCANNER:
  287. if (!m_pprimaxE3->Scan()) {
  288. MessageBox(TEXT("Scan Failed"),TEXT("Error"),MB_ICONERROR);
  289. break;
  290. }
  291. break;
  292. default:
  293. MessageBox(TEXT("unknown device type selected"),TEXT("Error"),MB_ICONERROR);
  294. break;
  295. }
  296. }
  297. void CDevctrlDlg::OnAbortScanButton()
  298. {
  299. // TODO: Add your control notification handler code here
  300. }
  301. void CDevctrlDlg::InitDefaultSettings()
  302. {
  303. m_DeviceCombobox.SetCurSel(0); // hp scanner
  304. m_DataTypeCombobox.SetCurSel(0); // 1 bit data
  305. // settings
  306. m_xext = 100;
  307. m_yext = 100;
  308. m_xpos = 0;
  309. m_ypos = 0;
  310. m_xres = 150;
  311. m_yres = 150;
  312. m_CreateFileName = "\\\\.\\Usbscan0";
  313. UpdateData(FALSE);
  314. }
  315. void CDevctrlDlg::OnConfigureButton()
  316. {
  317. UpdateData(TRUE);
  318. CConfigDlg ConfigDialog;
  319. ConfigDialog.m_Pipe1 = m_Pipe1;
  320. ConfigDialog.m_Pipe2 = m_Pipe2;
  321. ConfigDialog.m_Pipe3 = m_Pipe3;
  322. ConfigDialog.m_DefaultPipe = m_CreateFileName;
  323. ConfigDialog.m_DeviceControl.StatusPipeIndex = m_DeviceControl.StatusPipeIndex;
  324. ConfigDialog.m_DeviceControl.InterruptPipeIndex = m_DeviceControl.InterruptPipeIndex;
  325. ConfigDialog.m_DeviceControl.BulkOutPipeIndex = m_DeviceControl.BulkOutPipeIndex;
  326. ConfigDialog.m_DeviceControl.BulkInPipeIndex = m_DeviceControl.BulkInPipeIndex;
  327. if(ConfigDialog.DoModal() == IDOK){
  328. //
  329. // only update information, if the user pressed "OK"
  330. //
  331. m_Pipe1 = ConfigDialog.m_Pipe1;
  332. m_Pipe2 = ConfigDialog.m_Pipe2;
  333. m_Pipe3 = ConfigDialog.m_Pipe3;
  334. m_DeviceControl.StatusPipeIndex = ConfigDialog.m_DeviceControl.StatusPipeIndex;
  335. m_DeviceControl.InterruptPipeIndex = ConfigDialog.m_DeviceControl.InterruptPipeIndex;
  336. m_DeviceControl.BulkOutPipeIndex = ConfigDialog.m_DeviceControl.BulkOutPipeIndex;
  337. m_DeviceControl.BulkInPipeIndex = ConfigDialog.m_DeviceControl.BulkInPipeIndex;
  338. }
  339. }
  340. void CDevctrlDlg::OnCreateButton()
  341. {
  342. if(NULL != m_DeviceControl.DeviceIOHandles[0]){
  343. if(MessageBox(TEXT("A default handle is already created.\nWould you like to free the existing one?"),
  344. TEXT("Warning.."),MB_YESNO) == IDYES){
  345. CloseAllHandles();
  346. m_CreateButton.SetIcon(LoadIcon(AfxGetInstanceHandle(),MAKEINTRESOURCE(IDR_MAINFRAME)));
  347. return;
  348. } else {
  349. m_CreateButton.SetCheck(1);
  350. m_CreateButton.SetIcon(LoadIcon(AfxGetInstanceHandle(),MAKEINTRESOURCE(IDR_MAINFRAME2)));
  351. return;
  352. }
  353. }
  354. UpdateData(TRUE);
  355. //
  356. // create Default handle
  357. //
  358. m_DeviceControl.DeviceIOHandles[0] = CreateFile(m_CreateFileName,
  359. GENERIC_READ | GENERIC_WRITE, // Access mask
  360. 0, // Share mode
  361. NULL, // SA
  362. OPEN_EXISTING, // Create disposition
  363. FILE_ATTRIBUTE_SYSTEM, // Attributes
  364. NULL );
  365. if(NULL != m_DeviceControl.DeviceIOHandles[0]){
  366. MessageBox(TEXT("Default handle was created successfully"),TEXT("CreateFile() Success!"));
  367. m_CreateButton.SetIcon(LoadIcon(AfxGetInstanceHandle(),MAKEINTRESOURCE(IDR_MAINFRAME2)));
  368. } else {
  369. MessageBox(TEXT("Default handle creation failed"),TEXT("CreateFile() Failure!"));
  370. m_CreateButton.SetIcon(LoadIcon(AfxGetInstanceHandle(),MAKEINTRESOURCE(IDR_MAINFRAME)));
  371. }
  372. //
  373. // create pipe1 handle
  374. //
  375. if(m_Pipe1.GetLength() > 0){
  376. m_DeviceControl.DeviceIOHandles[1] = CreateFile(m_CreateFileName + m_Pipe1,
  377. GENERIC_READ | GENERIC_WRITE, // Access mask
  378. 0, // Share mode
  379. NULL, // SA
  380. OPEN_EXISTING, // Create disposition
  381. FILE_ATTRIBUTE_SYSTEM, // Attributes
  382. NULL );
  383. if(NULL != m_DeviceControl.DeviceIOHandles[1]){
  384. MessageBox(TEXT("pipe 1 handle was created successfully"),TEXT("CreateFile() Success!"));
  385. m_CreateButton.SetIcon(LoadIcon(AfxGetInstanceHandle(),MAKEINTRESOURCE(IDR_MAINFRAME2)));
  386. } else {
  387. MessageBox(TEXT("Default handle creation failed"),TEXT("CreateFile() Failure!"));
  388. m_CreateButton.SetIcon(LoadIcon(AfxGetInstanceHandle(),MAKEINTRESOURCE(IDR_MAINFRAME)));
  389. }
  390. }
  391. //
  392. // create pipe2 handle
  393. //
  394. if(m_Pipe2.GetLength() > 0){
  395. m_DeviceControl.DeviceIOHandles[2] = CreateFile(m_CreateFileName + m_Pipe2,
  396. GENERIC_READ | GENERIC_WRITE, // Access mask
  397. 0, // Share mode
  398. NULL, // SA
  399. OPEN_EXISTING, // Create disposition
  400. FILE_ATTRIBUTE_SYSTEM, // Attributes
  401. NULL );
  402. if(NULL != m_DeviceControl.DeviceIOHandles[2]){
  403. MessageBox(TEXT("pipe 2 handle was created successfully"),TEXT("CreateFile() Success!"));
  404. m_CreateButton.SetIcon(LoadIcon(AfxGetInstanceHandle(),MAKEINTRESOURCE(IDR_MAINFRAME2)));
  405. } else {
  406. MessageBox(TEXT("Default handle creation failed"),TEXT("CreateFile() Failure!"));
  407. m_CreateButton.SetIcon(LoadIcon(AfxGetInstanceHandle(),MAKEINTRESOURCE(IDR_MAINFRAME)));
  408. }
  409. }
  410. //
  411. // create pipe3 handle
  412. //
  413. if(m_Pipe3.GetLength() > 0){
  414. m_DeviceControl.DeviceIOHandles[3] = CreateFile(m_CreateFileName + m_Pipe3,
  415. GENERIC_READ | GENERIC_WRITE, // Access mask
  416. 0, // Share mode
  417. NULL, // SA
  418. OPEN_EXISTING, // Create disposition
  419. FILE_ATTRIBUTE_SYSTEM, // Attributes
  420. NULL );
  421. if(NULL != m_DeviceControl.DeviceIOHandles[3]){
  422. MessageBox(TEXT("pipe 3 handle was created successfully"),TEXT("CreateFile() Success!"));
  423. m_CreateButton.SetIcon(LoadIcon(AfxGetInstanceHandle(),MAKEINTRESOURCE(IDR_MAINFRAME2)));
  424. } else {
  425. MessageBox(TEXT("Default handle creation failed"),TEXT("CreateFile() Failure!"));
  426. m_CreateButton.SetIcon(LoadIcon(AfxGetInstanceHandle(),MAKEINTRESOURCE(IDR_MAINFRAME)));
  427. }
  428. }
  429. }
  430. void CDevctrlDlg::CloseAllHandles()
  431. {
  432. for(int index = 0; index < MAX_IO_HANDLES ; index++){
  433. if(NULL != m_DeviceControl.DeviceIOHandles[index]){
  434. CloseHandle(m_DeviceControl.DeviceIOHandles[index]);
  435. m_DeviceControl.DeviceIOHandles[index] = NULL;
  436. }
  437. }
  438. }
  439. void CDevctrlDlg::ReadRegistryValues()
  440. {
  441. CRegistry Registry(DEVCTRL_APP_KEY);
  442. TCHAR szTemp[255];
  443. memset(szTemp,0,sizeof(szTemp));
  444. Registry.ReadStringValue(TEXT("CreateFileName"), szTemp,sizeof(szTemp));
  445. if(lstrlen(szTemp) == 0){
  446. m_CreateFileName = "\\\\.\\Usbscan0";
  447. } else {
  448. m_CreateFileName = szTemp;
  449. }
  450. Registry.ReadStringValue(TEXT("Pipe1Name"), szTemp,sizeof(szTemp));
  451. m_Pipe1 = szTemp;
  452. Registry.ReadStringValue(TEXT("Pipe2Name"), szTemp,sizeof(szTemp));
  453. m_Pipe2 = szTemp;
  454. Registry.ReadStringValue(TEXT("Pipe3Name"), szTemp,sizeof(szTemp));
  455. m_Pipe3 = szTemp;
  456. m_xres = Registry.ReadLongValue(TEXT("XResolution"));
  457. m_yres = Registry.ReadLongValue(TEXT("YResolution"));
  458. m_xpos = Registry.ReadLongValue(TEXT("XPosition"));
  459. m_ypos = Registry.ReadLongValue(TEXT("YPosition"));
  460. m_xext = Registry.ReadLongValue(TEXT("XExtent"));
  461. m_yext = Registry.ReadLongValue(TEXT("YExtent"));
  462. m_DeviceControl.StatusPipeIndex = Registry.ReadLongValue(TEXT("StatusPipeIndex"));
  463. m_DeviceControl.InterruptPipeIndex = Registry.ReadLongValue(TEXT("InterruptPipeIndex"));
  464. m_DeviceControl.BulkOutPipeIndex = Registry.ReadLongValue(TEXT("BulkOutPipeIndex"));
  465. m_DeviceControl.BulkInPipeIndex = Registry.ReadLongValue(TEXT("BulkInPipeIndex"));
  466. m_datatype = Registry.ReadLongValue(TEXT("DataType"));
  467. m_device = Registry.ReadLongValue(TEXT("Device"));
  468. m_DeviceCombobox.SetCurSel(m_device);
  469. m_DataTypeCombobox.SetCurSel(m_datatype);
  470. UpdateData(FALSE);
  471. // InitDefaultSettings();
  472. }
  473. void CDevctrlDlg::WriteRegistryValues()
  474. {
  475. UpdateData(TRUE);
  476. CRegistry Registry(DEVCTRL_APP_KEY);
  477. TCHAR szTemp[255];
  478. memset(szTemp,0,sizeof(szTemp));
  479. Registry.WriteStringValue(TEXT("CreateFileName"),m_CreateFileName.GetBuffer(255));
  480. Registry.WriteStringValue(TEXT("Pipe1Name"),m_Pipe1.GetBuffer(255));
  481. Registry.WriteStringValue(TEXT("Pipe2Name"),m_Pipe2.GetBuffer(255));
  482. Registry.WriteStringValue(TEXT("Pipe3Name"),m_Pipe3.GetBuffer(255));
  483. Registry.WriteLongValue(TEXT("XResolution"),m_xres);
  484. Registry.WriteLongValue(TEXT("YResolution"),m_yres);
  485. Registry.WriteLongValue(TEXT("XPosition"),m_xpos);
  486. Registry.WriteLongValue(TEXT("YPosition"),m_ypos);
  487. Registry.WriteLongValue(TEXT("XExtent"),m_xext);
  488. Registry.WriteLongValue(TEXT("YExtent"),m_yext);
  489. Registry.WriteLongValue(TEXT("StatusPipeIndex"),m_DeviceControl.StatusPipeIndex);
  490. Registry.WriteLongValue(TEXT("InterruptPipeIndex"),m_DeviceControl.InterruptPipeIndex);
  491. Registry.WriteLongValue(TEXT("BulkOutPipeIndex"),m_DeviceControl.BulkOutPipeIndex);
  492. Registry.WriteLongValue(TEXT("BulkInPipeIndex"),m_DeviceControl.BulkInPipeIndex);
  493. Registry.WriteLongValue(TEXT("DataType"),(LONG)m_DataTypeCombobox.GetCurSel());
  494. Registry.WriteLongValue(TEXT("Device"),(LONG)m_DeviceCombobox.GetCurSel());
  495. // InitDefaultSettings();
  496. }
  497. void CDevctrlDlg::OnCancel()
  498. {
  499. WriteRegistryValues();
  500. if(m_phpscl)
  501. delete m_phpscl;
  502. if(m_pprimaxE3)
  503. delete m_pprimaxE3;
  504. CDialog::OnCancel();
  505. }