GenCodeDlg.cpp 2.7 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113
  1. // GenCodeDlg.cpp : implementation file
  2. //
  3. #include "stdafx.h"
  4. #include "GenCode.h"
  5. #include "GenCodeDlg.h"
  6. #ifdef _DEBUG
  7. #define new DEBUG_NEW
  8. #undef THIS_FILE
  9. static char THIS_FILE[] = __FILE__;
  10. #endif
  11. /////////////////////////////////////////////////////////////////////////////
  12. // CGenCodeDlg dialog
  13. CGenCodeDlg::CGenCodeDlg(CWnd* pParent /*=NULL*/)
  14. : CDialog(CGenCodeDlg::IDD, pParent)
  15. {
  16. //{{AFX_DATA_INIT(CGenCodeDlg)
  17. // NOTE: the ClassWizard will add member initialization here
  18. //}}AFX_DATA_INIT
  19. // Note that LoadIcon does not require a subsequent DestroyIcon in Win32
  20. m_hIcon = AfxGetApp()->LoadIcon(IDR_MAINFRAME);
  21. }
  22. void CGenCodeDlg::DoDataExchange(CDataExchange* pDX)
  23. {
  24. CDialog::DoDataExchange(pDX);
  25. //{{AFX_DATA_MAP(CGenCodeDlg)
  26. // NOTE: the ClassWizard will add DDX and DDV calls here
  27. //}}AFX_DATA_MAP
  28. }
  29. BEGIN_MESSAGE_MAP(CGenCodeDlg, CDialog)
  30. //{{AFX_MSG_MAP(CGenCodeDlg)
  31. ON_WM_PAINT()
  32. ON_WM_QUERYDRAGICON()
  33. //}}AFX_MSG_MAP
  34. END_MESSAGE_MAP()
  35. /////////////////////////////////////////////////////////////////////////////
  36. // CGenCodeDlg message handlers
  37. BOOL CGenCodeDlg::OnInitDialog()
  38. {
  39. CDialog::OnInitDialog();
  40. // Set the icon for this dialog. The framework does this automatically
  41. // when the application's main window is not a dialog
  42. SetIcon(m_hIcon, TRUE); // Set big icon
  43. SetIcon(m_hIcon, FALSE); // Set small icon
  44. // TODO: Add extra initialization here
  45. return TRUE; // return TRUE unless you set the focus to a control
  46. }
  47. // If you add a minimize button to your dialog, you will need the code below
  48. // to draw the icon. For MFC applications using the document/view model,
  49. // this is automatically done for you by the framework.
  50. void CGenCodeDlg::OnPaint()
  51. {
  52. if (IsIconic())
  53. {
  54. CPaintDC dc(this); // device context for painting
  55. SendMessage(WM_ICONERASEBKGND, (WPARAM) dc.GetSafeHdc(), 0);
  56. // Center icon in client rectangle
  57. int cxIcon = GetSystemMetrics(SM_CXICON);
  58. int cyIcon = GetSystemMetrics(SM_CYICON);
  59. CRect rect;
  60. GetClientRect(&rect);
  61. int x = (rect.Width() - cxIcon + 1) / 2;
  62. int y = (rect.Height() - cyIcon + 1) / 2;
  63. // Draw the icon
  64. dc.DrawIcon(x, y, m_hIcon);
  65. }
  66. else
  67. {
  68. CDialog::OnPaint();
  69. }
  70. }
  71. // The system calls this to obtain the cursor to display while the user drags
  72. // the minimized window.
  73. HCURSOR CGenCodeDlg::OnQueryDragIcon()
  74. {
  75. return (HCURSOR) m_hIcon;
  76. }
  77. void CGenCodeDlg::OnOK()
  78. {
  79. // TODO: Add extra validation here
  80. CStdioFile fp1,fp2;
  81. fp1.Open ("e:\\×îйؼü´Ê.txt", CFile::modeRead);
  82. fp2.Open ("e:\\×îйؼü´Ê2.txt", CFile::modeCreate|CFile::modeWrite);
  83. CString str;
  84. int count=2916;
  85. for(int i=0; i<count; i++)
  86. {
  87. fp1.ReadString(str);
  88. str="\""+str+"\",\\\n";
  89. fp2.WriteString (str);
  90. }
  91. fp1.Close();
  92. fp2.Close();
  93. }