InputCode.cpp 1.6 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970717273747576
  1. // InputCode.cpp : implementation file
  2. //
  3. #include "stdafx.h"
  4. #include "dbserver.h"
  5. #include "InputCode.h"
  6. #include "my32.h"
  7. #ifdef _DEBUG
  8. #define new DEBUG_NEW
  9. #undef THIS_FILE
  10. static char THIS_FILE[] = __FILE__;
  11. #endif
  12. /////////////////////////////////////////////////////////////////////////////
  13. // InputCode dialog
  14. InputCode::InputCode(CWnd* pParent /*=NULL*/)
  15. : CDialog(InputCode::IDD, pParent)
  16. {
  17. //{{AFX_DATA_INIT(InputCode)
  18. m_code = _T("");
  19. //}}AFX_DATA_INIT
  20. }
  21. void InputCode::DoDataExchange(CDataExchange* pDX)
  22. {
  23. CDialog::DoDataExchange(pDX);
  24. //{{AFX_DATA_MAP(InputCode)
  25. DDX_Text(pDX, IDC_EDIT1, m_code);
  26. //}}AFX_DATA_MAP
  27. }
  28. BEGIN_MESSAGE_MAP(InputCode, CDialog)
  29. //{{AFX_MSG_MAP(InputCode)
  30. //}}AFX_MSG_MAP
  31. END_MESSAGE_MAP()
  32. /////////////////////////////////////////////////////////////////////////////
  33. // InputCode message handlers
  34. void InputCode::OnOK() // 医院跟踪系统注册;
  35. {
  36. UpdateData();
  37. DWORD code=atoi(m_code);
  38. code^=0x19900101;
  39. DWORD id;
  40. TCHAR DevicePath[ 260];
  41. if(FindPort(0,DevicePath)!=0)return;
  42. int version;
  43. GetIDVersion(&id, &version, DevicePath);
  44. if(id!=code)
  45. {
  46. MessageBox("验证码错误!");
  47. return;
  48. }
  49. BOOL ret;
  50. ///////限座席数
  51. CString str;
  52. str.Format ("%d", 1);
  53. char name[32];
  54. memset(name, 0, 32);
  55. strcpy(name, str);
  56. // 写密码:h.E4F08542,l.87E5CED0
  57. ret=YtWriteString (name, 330 ,"E4F08542", "87E5CED0", DevicePath);
  58. if(ret<=0)//成功写入ret等于字串长度+1
  59. {
  60. MessageBox("出错!");
  61. }
  62. ////////////
  63. AfxMessageBox("注册成功! 感谢您的注册, 重启服务器程序和客户端软件生效!", MB_ICONINFORMATION);
  64. g_bReg=1;
  65. CDialog::OnOK();
  66. }