Old fashion design for PC-104
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.

61 lines
1.4 KiB

4 years ago
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
  1. //----------------------------------------------------------------------------
  2. // Laser Guard Ltd.
  3. // Copyright � 2000-2002. All Rights Reserved.
  4. // Version 1.0 01/01/2000
  5. // Last modification: 08/10/2003
  6. // PROJECT:
  7. // SUBSYSTEM:
  8. // FILE: LgPortComboBox.cpp
  9. // AUTHOR: Sergey Chizhevskiy
  10. // OVERVIEW
  11. // ~~~~~~~~
  12. // Source file of LgPortComboBox.cpp
  13. //----------------------------------------------------------------------------
  14. #include "stdafx.h"
  15. #include "SetupCLD.h"
  16. #include "LgPortComboBox.h"
  17. #include "Winspool.h"
  18. #ifdef _DEBUG
  19. #define new DEBUG_NEW
  20. #undef THIS_FILE
  21. static char THIS_FILE[] = __FILE__;
  22. #endif
  23. CLgPortComboBox::CLgPortComboBox()
  24. {
  25. }
  26. CLgPortComboBox::~CLgPortComboBox()
  27. {
  28. }
  29. BEGIN_MESSAGE_MAP(CLgPortComboBox, CComboBox)
  30. //{{AFX_MSG_MAP(CLgPortComboBox)
  31. //}}AFX_MSG_MAP
  32. END_MESSAGE_MAP()
  33. BOOL CLgPortComboBox::AutoLoad()
  34. {
  35. // clear all content
  36. CComboBox::ResetContent();
  37. // init new content
  38. DWORD cbNeeded, cReturned;
  39. ::EnumPorts(NULL, 1, NULL, 0UL, &cbNeeded, &cReturned);
  40. LPPORT_INFO_1 pPI = (LPPORT_INFO_1)new BYTE[cbNeeded];
  41. if( !pPI )
  42. return FALSE;
  43. BOOL bResult = ::EnumPorts(NULL, 1, (LPBYTE)pPI, cbNeeded, &cbNeeded, &cReturned);
  44. // add port names
  45. for(DWORD i = 0UL; i < cReturned; i++)
  46. AddString( pPI[i].pName );
  47. delete [] (PBYTE)pPI;
  48. return bResult;
  49. }