RestaurantBook,订餐

来源:互联网 发布:淘宝店铺1920大图代码 编辑:程序博客网 时间:2024/05/16 18:15

 

无聊时写了一个订餐的MFC。其中,发送邮件的功能是别人写的,我只是照搬过来的。

 

程序实现的功能是从一个TXT中读取出名字和邮件地址,然后从另一个TXT文件中读取出餐厅的名字。

界面很简单,可是没有将资源文件也发出来。大家就只能看代码了!

 

实现发送的代码在OK_Send的Button的点击函数中。

 

不多说了,看代码吧!

  1. // stdafx.cpp : 標準インクルードファイルを含むソース ファイル
  2. //              RestaurantBook.pch : 生成されるプリコンパイル済ヘッダー
  3. //              stdafx.obj : 生成されるプリコンパイル済タイプ情報
  4. #include "stdafx.h"
  5. /////////////////////////////////////////////////////////////////////////////
  6. // 名前とメールのグローバル変数
  7. char strNameList[ PCC_MAX ][LINE_MAX];
  8. char strMailList[ PCC_MAX ][LINE_MAX];
  9. char strRestList[ RES_MAX ][LINE_MAX];
  10. int  iLengthName = 0;
  11. int  iLengthRest = 0;
  12. // stdafx.h : 標準のシステム インクルード ファイル、
  13. //            または参照回数が多く、かつあまり変更されない
  14. //            プロジェクト専用のインクルード ファイルを記述します。
  15. //
  16. #if !defined(AFX_STDAFX_H__A2CB24D8_D723_4A1B_BED7_75C4610E6CC0__INCLUDED_)
  17. #define AFX_STDAFX_H__A2CB24D8_D723_4A1B_BED7_75C4610E6CC0__INCLUDED_
  18. #if _MSC_VER > 1000
  19. #pragma once
  20. #endif // _MSC_VER > 1000
  21. #define VC_EXTRALEAN  // Windows ヘッダーから殆ど使用されないスタッフを除外します。
  22. #include <afxwin.h>         // MFC のコアおよび標準コンポーネント
  23. #include <afxext.h>         // MFC の拡張部分
  24. #include <afxdisp.h>        // MFC のオートメーション クラス
  25. #include <afxdtctl.h>  // MFC の Internet Explorer 4 コモン コントロール サポート
  26. #ifndef _AFX_NO_AFXCMN_SUPPORT
  27. #include <afxcmn.h>   // MFC の Windows コモン コントロール サポート
  28. #endif // _AFX_NO_AFXCMN_SUPPORT
  29. /////////////////////////////////////////////////////////////////////////////
  30. // 名前とメールのグローバル変数
  31. #include <string>
  32. #include <mapi.h>
  33. #include <stdlib.h>
  34. #define PCC_MAX  30
  35. #define RES_MAX  20
  36. #define LINE_MAX 60
  37. #define SENDEMAIL_SUCCESS               0
  38. #define SENDEMAIL_MAPI_NOT_INSTALLED    1
  39. #define SENDEMAIL_MAPILOAD_FAILED       2
  40. #define SENDEMAIL_LOGON_FAILED          3
  41. #define SENDEMAIL_SEND_FAILED           4
  42. //{{AFX_INSERT_LOCATION}}
  43. // Microsoft Visual C++ は前行の直前に追加の宣言を挿入します。
  44. #endif // !defined(AFX_STDAFX_H__A2CB24D8_D723_4A1B_BED7_75C4610E6CC0__INCLUDED_)
  45. // RestaurantBook.cpp : アプリケーション用クラスの定義を行います。
  46. //
  47. #include "stdafx.h"
  48. #include "RestaurantBook.h"
  49. #include "RestaurantBookDlg.h"
  50. #ifdef _DEBUG
  51. #define new DEBUG_NEW
  52. #undef THIS_FILE
  53. static char THIS_FILE[] = __FILE__;
  54. #endif
  55. /////////////////////////////////////////////////////////////////////////////
  56. // CRestaurantBookApp
  57. BEGIN_MESSAGE_MAP(CRestaurantBookApp, CWinApp)
  58.  //{{AFX_MSG_MAP(CRestaurantBookApp)
  59.   // メモ - ClassWizard はこの位置にマッピング用のマクロを追加または削除します。
  60.   //        この位置に生成されるコードを編集しないでください。
  61.  //}}AFX_MSG
  62.  ON_COMMAND(ID_HELP, CWinApp::OnHelp)
  63. END_MESSAGE_MAP()
  64. /////////////////////////////////////////////////////////////////////////////
  65. // CRestaurantBookApp クラスの構築
  66. CRestaurantBookApp::CRestaurantBookApp()
  67. {
  68.  // TODO: この位置に構築用のコードを追加してください。
  69.  // ここに InitInstance 中の重要な初期化処理をすべて記述してください。
  70. }
  71. /////////////////////////////////////////////////////////////////////////////
  72. // 唯一の CRestaurantBookApp オブジェクト
  73. CRestaurantBookApp theApp;
  74. /////////////////////////////////////////////////////////////////////////////
  75. // 名前とメールは取得
  76. bool InitNameMail ( void )
  77. {
  78.  char strReadLine[ LINE_MAX ];
  79.  char *pcTemp;
  80.  FILE *pfPCC;
  81.  int  iCout = 0;
  82.  pfPCC = fopen( "PCC全員連絡アドレス.txt""rb" );
  83.  if ( NULL == pfPCC )
  84.  {
  85.   MessageBox( NULL, "Error during open!""Error", MB_ABORTRETRYIGNORE);
  86.   return FALSE;
  87.  }
  88.  iCout = 0;
  89.  while ( ! feof(pfPCC) )
  90.  {
  91.   if ( fgets (strReadLine, LINE_MAX, pfPCC) )
  92.   {
  93.    pcTemp = strpbrk ( strReadLine, "," );
  94.    pcTemp += 2;
  95.    strncpy ( strMailList[iCout], pcTemp, LINE_MAX );
  96.    pcTemp = strtok ( strReadLine, "," );
  97.    strncpy ( strNameList[iCout], pcTemp, LINE_MAX );
  98.    iCout ++;
  99.   }
  100.  }
  101.  fclose ( pfPCC );
  102.  iLengthName = iCout;
  103.  return TRUE;
  104. }
  105. /////////////////////////////////////////////////////////////////////////////
  106. // メール送信
  107. int SendEmail(const char* Address,
  108.      const char* Subject, 
  109.      const char* Text)
  110. {
  111.     int             iResult;
  112.     UINT            iMapiInstalled;
  113.     HINSTANCE       hMAPIInst;
  114.     LPMAPILOGON     pMAPILogon;
  115.     LPMAPILOGOFF    pMAPILogoff;
  116.     LPMAPISENDMAIL  pMAPISendMail;
  117.     LHANDLE         lhSession;
  118.     iResult         = SENDEMAIL_SUCCESS;
  119.     iMapiInstalled  = GetProfileInt("Mail""MAPI", 0);
  120.     if(! iMapiInstalled)
  121.         return SENDEMAIL_MAPI_NOT_INSTALLED;
  122.     hMAPIInst       = LoadLibrary("MAPI32.DLL");
  123.     if(!hMAPIInst)
  124.         return SENDEMAIL_MAPILOAD_FAILED;
  125.     pMAPILogon      = (LPMAPILOGON)
  126.                       GetProcAddress(hMAPIInst, "MAPILogon");
  127.     pMAPILogoff     = (LPMAPILOGOFF)
  128.                       GetProcAddress(hMAPIInst, "MAPILogoff");
  129.     pMAPISendMail   = (LPMAPISENDMAIL)
  130.                       GetProcAddress(hMAPIInst, "MAPISendMail");
  131.     if(pMAPILogon(0, NULL, NULL, MAPI_LOGON_UI, 0, &lhSession)
  132.         != SUCCESS_SUCCESS)
  133.     {
  134.         iResult = SENDEMAIL_LOGON_FAILED;
  135.     }
  136.     else        /* Send the Message         */
  137.     {
  138.         ULONG       Result;
  139.         MapiMessage Msg;
  140.         MapiRecipDesc Recipients[1];
  141.         Recipients[0].ulReserved = 0;
  142.         Recipients[0].ulRecipClass = MAPI_TO;
  143.         Recipients[0].lpszName = (char*)Address;
  144.         Recipients[0].lpszAddress = (char*)Address;
  145.         Recipients[0].ulEIDSize = 0;
  146.         Recipients[0].lpEntryID = 0;
  147.         memset(&Msg, 0, sizeof(Msg));
  148.         Msg.lpszSubject         = (char*)Subject;
  149.         Msg.lpszNoteText        = (char*)Text;
  150.         Msg.nRecipCount         = 1;
  151.         Msg.lpRecips            = Recipients;
  152.         Result      = pMAPISendMail(lhSession, 0, &Msg, 0, 0);
  153.         if(Result != SUCCESS_SUCCESS)
  154.             iResult = SENDEMAIL_SEND_FAILED;
  155.         pMAPILogoff(lhSession, 0, 0, 0);
  156.     }
  157.     FreeLibrary(hMAPIInst);
  158.     return iResult;
  159. }
  160. /////////////////////////////////////////////////////////////////////////////
  161. // レストランは取得
  162. bool InitRestaurant ( void )
  163. {
  164.  char strReadLine[ LINE_MAX ];
  165.  char *pcTemp;
  166.  FILE *pfRES;
  167.  int  iCout = 0;
  168.  pfRES = fopen( "レストラン.txt""rb" );
  169.  if ( NULL == pfRES )
  170.  {
  171.   MessageBox( NULL, "Error during open!""Error", MB_ABORTRETRYIGNORE);
  172.   return FALSE;
  173.  }
  174.  iCout = 0;
  175.  while ( ! feof(pfRES) )
  176.  {
  177.   if ( fgets (strReadLine, LINE_MAX, pfRES) )
  178.   {
  179.    pcTemp = strtok ( strReadLine, "," );
  180.    strncpy ( strRestList[iCout], pcTemp, LINE_MAX );
  181.    iCout ++;
  182.   }
  183.  }
  184.  fclose ( pfRES );
  185.  iLengthRest = iCout;
  186.  return TRUE;
  187. }
  188. /////////////////////////////////////////////////////////////////////////////
  189. // CRestaurantBookApp クラスの初期化
  190. BOOL CRestaurantBookApp::InitInstance()
  191. {
  192.  if ( FALSE == InitNameMail () )
  193.  {
  194.   return 0;
  195.  }
  196.  if ( FALSE == InitRestaurant () )
  197.  {
  198.   return 0;
  199.  }
  200.  AfxEnableControlContainer();
  201.  // 標準的な初期化処理
  202.  // もしこれらの機能を使用せず、実行ファイルのサイズを小さくしたけ
  203.  //  れば以下の特定の初期化ルーチンの中から不必要なものを削除して
  204.  //  ください。
  205. #ifdef _AFXDLL
  206.  Enable3dControls();   // 共有 DLL 内で MFC を使う場合はここをコールしてください。
  207. #else
  208.  Enable3dControlsStatic(); // MFC と静的にリンクする場合はここをコールしてください。
  209. #endif
  210.  CRestaurantBookDlg dlg;
  211.  m_pMainWnd = &dlg;
  212.  int nResponse = dlg.DoModal();
  213.  if (nResponse == IDOK)
  214.  {
  215.   // TODO: ダイアログが <OK> で消された時のコードを
  216.   //       記述してください。
  217.  }
  218.  else if (nResponse == IDCANCEL)
  219.  {
  220.   // TODO: ダイアログが <キャンセル> で消された時のコードを
  221.   //       記述してください。
  222.  }
  223.  // ダイアログが閉じられてからアプリケーションのメッセージ ポンプを開始するよりは、
  224.  // アプリケーションを終了するために FALSE を返してください。
  225.  return FALSE;
  226. }
  227. // RestaurantBook.h : RESTAURANTBOOK アプリケーションのメイン ヘッダー ファイルです。
  228. //
  229. #if !defined(AFX_RESTAURANTBOOK_H__ADE76C47_967F_4609_A147_4511FED06929__INCLUDED_)
  230. #define AFX_RESTAURANTBOOK_H__ADE76C47_967F_4609_A147_4511FED06929__INCLUDED_
  231. #if _MSC_VER > 1000
  232. #pragma once
  233. #endif // _MSC_VER > 1000
  234. #ifndef __AFXWIN_H__
  235.  #error include 'stdafx.h' before including this file for PCH
  236. #endif
  237. #include "resource.h"  // メイン シンボル
  238. /////////////////////////////////////////////////////////////////////////////
  239. // CRestaurantBookApp:
  240. // このクラスの動作の定義に関しては RestaurantBook.cpp ファイルを参照してください。
  241. //
  242. class CRestaurantBookApp : public CWinApp
  243. {
  244. public:
  245.  CRestaurantBookApp();
  246. // オーバーライド
  247.  // ClassWizard は仮想関数のオーバーライドを生成します。
  248.  //{{AFX_VIRTUAL(CRestaurantBookApp)
  249.  public:
  250.  virtual BOOL InitInstance();
  251.  //}}AFX_VIRTUAL
  252. // インプリメンテーション
  253.  //{{AFX_MSG(CRestaurantBookApp)
  254.   // メモ - ClassWizard はこの位置にメンバ関数を追加または削除します。
  255.   //        この位置に生成されるコードを編集しないでください。
  256.  //}}AFX_MSG
  257.  DECLARE_MESSAGE_MAP()
  258. };
  259. /////////////////////////////////////////////////////////////////////////////
  260. // 名前とメールのグローバル変数
  261. extern char strNameList[ PCC_MAX ][LINE_MAX];
  262. extern char strMailList[ PCC_MAX ][LINE_MAX];
  263. extern char strRestList[ RES_MAX ][LINE_MAX];
  264. extern int  iLengthName;
  265. extern int  iLengthRest;
  266. /////////////////////////////////////////////////////////////////////////////
  267. // メール送信
  268. extern int SendEmail(const char* Address,
  269.      const char* Subject, 
  270.      const char* Text);
  271. /////////////////////////////////////////////////////////////////////////////
  272. //{{AFX_INSERT_LOCATION}}
  273. // Microsoft Visual C++ は前行の直前に追加の宣言を挿入します。
  274. #endif // !defined(AFX_RESTAURANTBOOK_H__ADE76C47_967F_4609_A147_4511FED06929__INCLUDED_)
  275. // RestaurantBookDlg.cpp : インプリメンテーション ファイル
  276. //
  277. #include "stdafx.h"
  278. #include "RestaurantBook.h"
  279. #include "RestaurantBookDlg.h"
  280. #ifdef _DEBUG
  281. #define new DEBUG_NEW
  282. #undef THIS_FILE
  283. static char THIS_FILE[] = __FILE__;
  284. #endif
  285. /////////////////////////////////////////////////////////////////////////////
  286. // CRestaurantBookDlg ダイアログ
  287. CRestaurantBookDlg::CRestaurantBookDlg(CWnd* pParent /*=NULL*/)
  288.  : CDialog(CRestaurantBookDlg::IDD, pParent)
  289. {
  290.  //{{AFX_DATA_INIT(CRestaurantBookDlg)
  291.  m_ComboName = _T( "名前" );
  292.  m_ComboMail = _T( "レストラン" );
  293.  m_SendText = _T( "メール" );
  294.  //}}AFX_DATA_INIT
  295.  // メモ: LoadIcon は Win32 の DestroyIcon のサブシーケンスを要求しません。
  296.  m_hIcon = AfxGetApp()->LoadIcon(IDR_MAINFRAME);
  297. }
  298. void CRestaurantBookDlg::DoDataExchange(CDataExchange* pDX)
  299. {
  300.  CDialog::DoDataExchange(pDX);
  301.  //{{AFX_DATA_MAP(CRestaurantBookDlg)
  302.  DDX_Control(pDX, IDC_COMBO3, m_SendTo);
  303.  DDX_Control(pDX, IDC_EDIT1, m_Context);
  304.  DDX_Control(pDX, IDC_EDIT2, m_TextMail);
  305.  DDX_Control(pDX, IDC_COMBO2, m_Mail);
  306.  DDX_Control(pDX, IDC_COMBO1, m_Name);
  307.  DDX_CBString(pDX, IDC_COMBO1, m_ComboName);
  308.  DDX_CBString(pDX, IDC_COMBO2, m_ComboMail);
  309.  DDX_CBString(pDX, IDC_COMBO3, m_SendText);
  310.  //}}AFX_DATA_MAP
  311. }
  312. BEGIN_MESSAGE_MAP(CRestaurantBookDlg, CDialog)
  313.  //{{AFX_MSG_MAP(CRestaurantBookDlg)
  314.  ON_WM_PAINT()
  315.  ON_WM_QUERYDRAGICON()
  316.  ON_CBN_EDITCHANGE(IDC_COMBO1, OnEditchangeComboName)
  317.  ON_CBN_DROPDOWN(IDC_COMBO1, OnDropdownComboName)
  318.  ON_CBN_EDITUPDATE(IDC_COMBO1, OnEditupdateComboName)
  319.  ON_CBN_SELCHANGE(IDC_COMBO1, OnSelchangeComboName)
  320.  ON_EN_UPDATE(IDC_EDIT2, OnUpdateEdit2)
  321.  ON_EN_KILLFOCUS(IDC_EDIT2, OnKillfocusEdit2)
  322.  ON_BN_CLICKED(IDC_BUTTON1, OnButton1)
  323.  ON_BN_CLICKED(IDOK, OnOK_Send)
  324.  //}}AFX_MSG_MAP
  325. END_MESSAGE_MAP()
  326. /////////////////////////////////////////////////////////////////////////////
  327. // CRestaurantBookDlg メッセージ ハンドラ
  328. BOOL CRestaurantBookDlg::OnInitDialog()
  329. {
  330.  CDialog::OnInitDialog();
  331.  // このダイアログ用のアイコンを設定します。フレームワークはアプリケーションのメイン
  332.  // ウィンドウがダイアログでない時は自動的に設定しません。
  333.  SetIcon(m_hIcon, TRUE);   // 大きいアイコンを設定
  334.  SetIcon(m_hIcon, FALSE);  // 小さいアイコンを設定
  335.  // TODO: 特別な初期化を行う時はこの場所に追加してください。
  336.  int iCout = 0;
  337.  for ( iCout = 0; iCout < iLengthName; iCout ++ )
  338.  {
  339.   m_Name.AddString ( strNameList[iCout] );
  340.  }
  341.  for ( iCout = 0; iCout < iLengthRest; iCout ++ )
  342.  {
  343.   m_Mail.AddString ( strRestList[iCout] );
  344.  }
  345.  for ( iCout = 0; iCout < iLengthName; iCout ++ )
  346.  {
  347.   m_SendTo.AddString ( strNameList[iCout] );
  348.  }
  349.  return TRUE;  // TRUE を返すとコントロールに設定したフォーカスは失われません。
  350. }
  351. // もしダイアログボックスに最小化ボタンを追加するならば、アイコンを描画する
  352. // コードを以下に記述する必要があります。MFC アプリケーションは document/view
  353. // モデルを使っているので、この処理はフレームワークにより自動的に処理されます。
  354. void CRestaurantBookDlg::OnPaint() 
  355. {
  356.  if (IsIconic())
  357.  {
  358.   CPaintDC dc(this); // 描画用のデバイス コンテキスト
  359.   SendMessage(WM_ICONERASEBKGND, (WPARAM) dc.GetSafeHdc(), 0);
  360.   // クライアントの矩形領域内の中央
  361.   int cxIcon = GetSystemMetrics(SM_CXICON);
  362.   int cyIcon = GetSystemMetrics(SM_CYICON);
  363.   CRect rect;
  364.   GetClientRect(&rect);
  365.   int x = (rect.Width() - cxIcon + 1) / 2;
  366.   int y = (rect.Height() - cyIcon + 1) / 2;
  367.   // アイコンを描画します。
  368.   dc.DrawIcon(x, y, m_hIcon);
  369.  }
  370.  else
  371.  {
  372.   CDialog::OnPaint();
  373.  }
  374. }
  375. // システムは、ユーザーが最小化ウィンドウをドラッグしている間、
  376. // カーソルを表示するためにここを呼び出します。
  377. HCURSOR CRestaurantBookDlg::OnQueryDragIcon()
  378. {
  379.  return (HCURSOR) m_hIcon;
  380. }
  381. void CRestaurantBookDlg::OnEditchangeComboName() 
  382. {
  383.  // TODO: この位置にコントロール通知ハンドラ用のコードを追加してください
  384. }
  385. void CRestaurantBookDlg::OnDropdownComboName() 
  386. {
  387.  // TODO: この位置にコントロール通知ハンドラ用のコードを追加してください
  388.  int iCout = 0;
  389. }
  390. void CRestaurantBookDlg::OnEditupdateComboName() 
  391. {
  392.  // TODO: この位置にコントロール通知ハンドラ用のコードを追加してください
  393. }
  394. void CRestaurantBookDlg::OnSelchangeComboName() 
  395. {
  396.  // TODO: この位置にコントロール通知ハンドラ用のコードを追加してください
  397. /*
  398.  CString strTemp;
  399.  char pcTemp [LINE_MAX];
  400.  int iCout = 0;
  401.  m_Name.GetWindowText( strTemp );
  402.  sprintf ( pcTemp, "%s", strTemp);
  403.  for ( iCout = 0; iCout < iLengthName; iCout ++ )
  404.  {
  405.   if ( !strcmp (pcTemp, strNameList[iCout]) )
  406.    break ;
  407.  }
  408.  UpdateData ( FALSE );
  409.  if ( iCout < iLengthName )
  410.  {
  411.   m_TextMail.SetWindowText ( strMailList[ iCout ] );
  412.  }
  413.  else
  414.  {
  415.   m_TextMail.SetWindowText ( "?" );
  416.  }
  417.  UpdateData ( TRUE );
  418. */
  419. }
  420. void CRestaurantBookDlg::OnUpdateEdit2() 
  421. {
  422.  // TODO: これが RICHEDIT コントロールの場合、コントロールは、 lParam マスク
  423.  // 内での論理和の ENM_UPDATE フラグ付きで EM_SETEVENTMASK
  424.  // メッセージをコントロールへ送るために CDialog::OnInitDialog() 関数をオーバー
  425.  // ライドしない限りこの通知を送りません。
  426.  // TODO: この位置にコントロール通知ハンドラ用のコードを追加してください
  427. }
  428. void CRestaurantBookDlg::OnKillfocusEdit2() 
  429. {
  430.  // TODO: この位置にコントロール通知ハンドラ用のコードを追加してください
  431.  UpdateWindow(); 
  432. }
  433. void CRestaurantBookDlg::OnButton1() 
  434. {
  435.  // TODO: この位置にコントロール通知ハンドラ用のコードを追加してください
  436.  CString strTemp;
  437.  char pcTemp1 [LINE_MAX*PCC_MAX];
  438.  char pcTemp2 [LINE_MAX*PCC_MAX];
  439.  int  iCout = 0;
  440.  m_Name.GetWindowText( strTemp );
  441.  sprintf ( pcTemp1, "%s", strTemp );
  442.  for ( iCout = 0; iCout < iLengthName; iCout ++ )
  443.  {
  444.   if ( !strcmp (pcTemp1, strNameList[iCout]) )
  445.    break ;
  446.  }
  447.  m_Mail.GetWindowText( strTemp );
  448.  sprintf ( pcTemp2, " ⇒ %s/r/n", strTemp );
  449.  strcat ( pcTemp1, pcTemp2 );
  450.  m_Context.GetWindowText ( strTemp );
  451.  sprintf ( pcTemp2, "%s", strTemp );
  452.  strcat ( pcTemp2, pcTemp1 );
  453.  m_Context.SetWindowText ( pcTemp2 );
  454.  if ( iCout < iLengthName )
  455.  {
  456.   strcpy ( pcTemp2, strMailList[ iCout ] );
  457.   //strcat ( pcTemp2, "/r/n" );
  458.  }
  459.  else
  460.  {
  461.   strcpy ( pcTemp2, "???/r/n" );
  462.  }
  463.  m_TextMail.GetWindowText ( strTemp );
  464.  sprintf ( pcTemp1, "%s", strTemp );
  465.  strcat ( pcTemp1, pcTemp2 );
  466.  m_TextMail.SetWindowText ( pcTemp1 );
  467. }
  468. void CRestaurantBookDlg::OnOK_Send() 
  469. {
  470.  // TODO: この位置にコントロール通知ハンドラ用のコードを追加してください
  471.  CString strTemp;
  472.  char pcTemp [LINE_MAX*PCC_MAX];
  473.  char pcTemp1 [LINE_MAX*PCC_MAX];
  474.  int  iCout = 0;
  475.  m_Context.GetWindowText ( strTemp );
  476.  sprintf ( pcTemp, "%s", strTemp );
  477.  m_SendTo.GetWindowText( strTemp );
  478.  sprintf ( pcTemp1, "%s", strTemp );
  479.  for ( iCout = 0; iCout < iLengthName; iCout ++ )
  480.  {
  481.   if ( !strcmp (pcTemp1, strNameList[iCout]) )
  482.    break ;
  483.  }
  484.  if ( iCout < iLengthName )
  485.  {
  486.   sprintf ( pcTemp1, "SMTP:%s", strMailList[ iCout ] );
  487.  }
  488.  else
  489.  {
  490.   strcpy ( pcTemp1, "SMTP:yashiro319@gmail.com" );
  491.  }
  492.  SendEmail( pcTemp1, "RestaurantBookServer", pcTemp );
  493. }
  494. // RestaurantBookDlg.h : ヘッダー ファイル
  495. //
  496. #if !defined(AFX_RESTAURANTBOOKDLG_H__3DA81B7B_8867_44EE_BF9D_49D0D1630D3C__INCLUDED_)
  497. #define AFX_RESTAURANTBOOKDLG_H__3DA81B7B_8867_44EE_BF9D_49D0D1630D3C__INCLUDED_
  498. #if _MSC_VER > 1000
  499. #pragma once
  500. #endif // _MSC_VER > 1000
  501. /////////////////////////////////////////////////////////////////////////////
  502. // CRestaurantBookDlg ダイアログ
  503. class CRestaurantBookDlg : public CDialog
  504. {
  505. // 構築
  506. public:
  507.  CRestaurantBookDlg(CWnd* pParent = NULL); // 標準のコンストラクタ
  508. // ダイアログ データ
  509.  //{{AFX_DATA(CRestaurantBookDlg)
  510.  enum { IDD = IDD_RESTAURANTBOOK_DIALOG };
  511.  CComboBox m_SendTo;
  512.  CEdit m_Context;
  513.  CEdit m_TextMail;
  514.  CComboBox m_Mail;
  515.  CComboBox m_Name;
  516.  CString m_ComboName;
  517.  CString m_ComboMail;
  518.  CString m_SendText;
  519.  //}}AFX_DATA
  520.  // ClassWizard は仮想関数のオーバーライドを生成します。
  521.  //{{AFX_VIRTUAL(CRestaurantBookDlg)
  522.  protected:
  523.  virtual void DoDataExchange(CDataExchange* pDX);
  524.  //}}AFX_VIRTUAL
  525. // インプリメンテーション
  526. protected:
  527.  HICON m_hIcon;
  528.  // 生成されたメッセージ マップ関数
  529.  //{{AFX_MSG(CRestaurantBookDlg)
  530.  virtual BOOL OnInitDialog();
  531.  afx_msg void OnPaint();
  532.  afx_msg HCURSOR OnQueryDragIcon();
  533.  afx_msg void OnEditchangeComboName();
  534.  afx_msg void OnDropdownComboName();
  535.  afx_msg void OnEditupdateComboName();
  536.  afx_msg void OnSelchangeComboName();
  537.  afx_msg void OnUpdateEdit2();
  538.  afx_msg void OnKillfocusEdit2();
  539.  afx_msg void OnButton1();
  540.  afx_msg void OnOK_Send();
  541.  //}}AFX_MSG
  542.  DECLARE_MESSAGE_MAP()
  543. };
  544. //{{AFX_INSERT_LOCATION}}
  545. // Microsoft Visual C++ は前行の直前に追加の宣言を挿入します。
  546. #endif // !defined(AFX_RESTAURANTBOOKDLG_H__3DA81B7B_8867_44EE_BF9D_49D0D1630D3C__INCLUDED_)
原创粉丝点击