How to send mail using C++ & CAsyncSocket - SourceCode - 用C++ & CAsyncSocket 如何发送邮件 - 源码 - HackerJLY

来源:互联网 发布:java破解单机游戏下载 编辑:程序博客网 时间:2024/05/10 01:20

How to send mail using C++ & CAsyncSocket - SourceCode - 用C++ & CAsyncSocket 如何发送邮件 - 源码 -  HackerJLY

//============================================================================================1、prjSendMail.dsw

Microsoft Developer Studio Workspace File, Format Version 6.00# WARNING: DO NOT EDIT OR DELETE THIS WORKSPACE FILE!

###############################################################################

Project: "prjSendMail"="./prjSendMail.dsp" - Package Owner=<4>

Package=<5>{{{}}}

Package=<4>{{{}}}

###############################################################################

Global:

Package=<5>{{{}}}

Package=<3>{{{}}}

###############################################################################

 

//============================================================================================2、prjSendMail.dsp

# Microsoft Developer Studio Project File - Name="prjSendMail" - Package Owner=<4># Microsoft Developer Studio Generated Build File, Format Version 6.00# ** DO NOT EDIT **

# TARGTYPE "Win32 (x86) Application" 0x0101

CFG=prjSendMail - Win32 Debug!MESSAGE This is not a valid makefile. To build this project using NMAKE,!MESSAGE use the Export Makefile command and run!MESSAGE !MESSAGE NMAKE /f "prjSendMail.mak".!MESSAGE !MESSAGE You can specify a configuration when running NMAKE!MESSAGE by defining the macro CFG on the command line. For example:!MESSAGE !MESSAGE NMAKE /f "prjSendMail.mak" CFG="prjSendMail - Win32 Debug"!MESSAGE !MESSAGE Possible choices for configuration are:!MESSAGE !MESSAGE "prjSendMail - Win32 Release" (based on "Win32 (x86) Application")!MESSAGE "prjSendMail - Win32 Debug" (based on "Win32 (x86) Application")!MESSAGE

# Begin Project# PROP AllowPerConfigDependencies 0# PROP Scc_ProjName ""# PROP Scc_LocalPath ""CPP=cl.exeMTL=midl.exeRSC=rc.exe

!IF  "$(CFG)" == "prjSendMail - Win32 Release"

# PROP BASE Use_MFC 6# PROP BASE Use_Debug_Libraries 0# PROP BASE Output_Dir "Release"# PROP BASE Intermediate_Dir "Release"# PROP BASE Target_Dir ""# PROP Use_MFC 6# PROP Use_Debug_Libraries 0# PROP Output_Dir "Release"# PROP Intermediate_Dir "Release"# PROP Target_Dir ""# ADD BASE CPP /nologo /MD /W3 /GX /O2 /D "WIN32" /D "NDEBUG" /D "_WINDOWS" /D "_AFXDLL" /Yu"stdafx.h" /FD /c# ADD CPP /nologo /MD /W3 /GX /O2 /D "WIN32" /D "NDEBUG" /D "_WINDOWS" /D "_AFXDLL" /D "_MBCS" /FR /Yu"stdafx.h" /FD /c# ADD BASE MTL /nologo /D "NDEBUG" /mktyplib203 /win32# ADD MTL /nologo /D "NDEBUG" /mktyplib203 /win32# ADD BASE RSC /l 0x804 /d "NDEBUG" /d "_AFXDLL"# ADD RSC /l 0x804 /d "NDEBUG" /d "_AFXDLL"BSC32=bscmake.exe# ADD BASE BSC32 /nologo# ADD BSC32 /nologoLINK32=link.exe# ADD BASE LINK32 /nologo /subsystem:windows /machine:I386# ADD LINK32 /nologo /subsystem:windows /machine:I386

!ELSEIF  "$(CFG)" == "prjSendMail - Win32 Debug"

# PROP BASE Use_MFC 6# PROP BASE Use_Debug_Libraries 1# PROP BASE Output_Dir "Debug"# PROP BASE Intermediate_Dir "Debug"# PROP BASE Target_Dir ""# PROP Use_MFC 6# PROP Use_Debug_Libraries 1# PROP Output_Dir "Debug"# PROP Intermediate_Dir "Debug"# PROP Target_Dir ""# ADD BASE CPP /nologo /MDd /W3 /Gm /GX /ZI /Od /D "WIN32" /D "_DEBUG" /D "_WINDOWS" /D "_AFXDLL" /Yu"stdafx.h" /FD /GZ /c# ADD CPP /nologo /MDd /W3 /Gm /GX /ZI /Od /D "WIN32" /D "_DEBUG" /D "_WINDOWS" /D "_AFXDLL" /D "_MBCS" /FR /Yu"stdafx.h" /FD /GZ /c# ADD BASE MTL /nologo /D "_DEBUG" /mktyplib203 /win32# ADD MTL /nologo /D "_DEBUG" /mktyplib203 /win32# ADD BASE RSC /l 0x804 /d "_DEBUG" /d "_AFXDLL"# ADD RSC /l 0x804 /d "_DEBUG" /d "_AFXDLL"BSC32=bscmake.exe# ADD BASE BSC32 /nologo# ADD BSC32 /nologoLINK32=link.exe# ADD BASE LINK32 /nologo /subsystem:windows /debug /machine:I386 /pdbtype:sept# ADD LINK32 /nologo /subsystem:windows /debug /machine:I386 /pdbtype:sept

!ENDIF

# Begin Target

# Name "prjSendMail - Win32 Release"# Name "prjSendMail - Win32 Debug"# Begin Group "Source Files"

# PROP Default_Filter "cpp;c;cxx;rc;def;r;odl;idl;hpj;bat"# Begin Source File

SOURCE=./AsyncSkt.cpp# End Source File# Begin Source File

SOURCE=./prjSendMail.cpp# End Source File# Begin Source File

SOURCE=./prjSendMail.rc# End Source File# Begin Source File

SOURCE=./prjSendMailDlg.cpp# End Source File# Begin Source File

SOURCE=./StdAfx.cpp# ADD CPP /Yc"stdafx.h"# End Source File# End Group# Begin Group "Header Files"

# PROP Default_Filter "h;hpp;hxx;hm;inl"# Begin Source File

SOURCE=./AsyncSkt.h# End Source File# Begin Source File

SOURCE=./prjSendMail.h# End Source File# Begin Source File

SOURCE=./prjSendMailDlg.h# End Source File# Begin Source File

SOURCE=./Resource.h# End Source File# Begin Source File

SOURCE=./StdAfx.h# End Source File# End Group# Begin Group "Resource Files"

# PROP Default_Filter "ico;cur;bmp;dlg;rc2;rct;bin;rgs;gif;jpg;jpeg;jpe"# Begin Source File

SOURCE=./res/Envelope.bmp# End Source File# Begin Source File

SOURCE=./res/mail.ico# End Source File# Begin Source File

SOURCE=./res/prjSendMail.ico# End Source File# Begin Source File

SOURCE=./res/prjSendMail.rc2# End Source File# End Group# Begin Source File

SOURCE=./ReadMe.txt# End Source File# End Target# End Project

//============================================================================================3、prjSendMail.h

// prjSendMail.h : main header file for the PRJSENDMAIL application//

#if !defined(AFX_PRJSENDMAIL_H__2DA01E39_CBE5_4045_A4C4_6DD4494BEE64__INCLUDED_)#define AFX_PRJSENDMAIL_H__2DA01E39_CBE5_4045_A4C4_6DD4494BEE64__INCLUDED_

#if _MSC_VER > 1000#pragma once#endif // _MSC_VER > 1000

#ifndef __AFXWIN_H__ #error include 'stdafx.h' before including this file for PCH#endif

#include "resource.h"  // main symbols

/////////////////////////////////////////////////////////////////////////////// CPrjSendMailApp:// See prjSendMail.cpp for the implementation of this class//

class CPrjSendMailApp : public CWinApp{public: CPrjSendMailApp();

// Overrides // ClassWizard generated virtual function overrides //{{AFX_VIRTUAL(CPrjSendMailApp) public: virtual BOOL InitInstance(); //}}AFX_VIRTUAL

// Implementation

 //{{AFX_MSG(CPrjSendMailApp)  // NOTE - the ClassWizard will add and remove member functions here.  //    DO NOT EDIT what you see in these blocks of generated code ! //}}AFX_MSG DECLARE_MESSAGE_MAP()};

/////////////////////////////////////////////////////////////////////////////

//{{AFX_INSERT_LOCATION}}// Microsoft Visual C++ will insert additional declarations immediately before the previous line.

#endif // !defined(AFX_PRJSENDMAIL_H__2DA01E39_CBE5_4045_A4C4_6DD4494BEE64__INCLUDED_)

//============================================================================================4、prjSendMail.cpp

// prjSendMail.cpp : Defines the class behaviors for the application.//

#include "stdafx.h"#include "prjSendMail.h"#include "prjSendMailDlg.h"

#ifdef _DEBUG#define new DEBUG_NEW#undef THIS_FILEstatic char THIS_FILE[] = __FILE__;#endif

/////////////////////////////////////////////////////////////////////////////// CPrjSendMailApp

BEGIN_MESSAGE_MAP(CPrjSendMailApp, CWinApp) //{{AFX_MSG_MAP(CPrjSendMailApp)  // NOTE - the ClassWizard will add and remove mapping macros here.  //    DO NOT EDIT what you see in these blocks of generated code! //}}AFX_MSG ON_COMMAND(ID_HELP, CWinApp::OnHelp)END_MESSAGE_MAP()

/////////////////////////////////////////////////////////////////////////////// CPrjSendMailApp construction

CPrjSendMailApp::CPrjSendMailApp(){ // TODO: add construction code here, // Place all significant initialization in InitInstance}

/////////////////////////////////////////////////////////////////////////////// The one and only CPrjSendMailApp object

CPrjSendMailApp theApp;

//BOOL bReceiveComplete;

/////////////////////////////////////////////////////////////////////////////// CPrjSendMailApp initialization

BOOL CPrjSendMailApp::InitInstance(){ if (!AfxSocketInit()) {  AfxMessageBox(IDP_SOCKETS_INIT_FAILED);  return FALSE; }

 // Standard initialization // If you are not using these features and wish to reduce the size //  of your final executable, you should remove from the following //  the specific initialization routines you do not need.

#ifdef _AFXDLL Enable3dControls();   // Call this when using MFC in a shared DLL#else Enable3dControlsStatic(); // Call this when linking to MFC statically#endif

 CPrjSendMailDlg dlg;

 //dlg.

 m_pMainWnd = &dlg; int nResponse = dlg.DoModal(); if (nResponse == IDOK) {  // TODO: Place code here to handle when the dialog is  //  dismissed with OK } else if (nResponse == IDCANCEL) {  // TODO: Place code here to handle when the dialog is  //  dismissed with Cancel }   //TODO:窗体背景色 SetDialogBkColor(RGB(200,0,200),RGB(0,0,0));  // Since the dialog has been closed, return FALSE so that we exit the //  application, rather than start the application's message pump. return FALSE;}

//============================================================================================5、prjSendMailDlg.h

// prjSendMailDlg.h : header file//

#if !defined(AFX_PRJSENDMAILDLG_H__11082D3C_2AAB_4CBB_85BB_1B8BDDC8E003__INCLUDED_)#define AFX_PRJSENDMAILDLG_H__11082D3C_2AAB_4CBB_85BB_1B8BDDC8E003__INCLUDED_

#if _MSC_VER > 1000#pragma once#endif // _MSC_VER > 1000

#include "AsyncSkt.h"

/////////////////////////////////////////////////////////////////////////////// CPrjSendMailDlg dialog

class CPrjSendMailDlg : public CDialog{// Constructionpublic: CPrjSendMailDlg(CWnd* pParent = NULL); // standard constructor CMenu* m_pMenu;

//skt

 CAsyncSkt skt; 

// Dialog Data //{{AFX_DATA(CPrjSendMailDlg) enum { IDD = IDD_PRJSENDMAIL_DIALOG }; CEdit m_txtMailFrom; CButton m_btnSend; CEdit m_txtMailSMTPServer; CEdit m_txtUserName; CEdit m_txtMailTitle; CEdit m_txtMailTo; CEdit m_txtMailContent; CEdit m_txtPassword; CString m_strPassword; CString m_strMailContent; CString m_strMailTo; CString m_strMailTitle; CString m_strUserName; CString m_strMailSMTPServer; CString m_strMailFrom; //}}AFX_DATA

 // ClassWizard generated virtual function overrides //{{AFX_VIRTUAL(CPrjSendMailDlg) protected: virtual void DoDataExchange(CDataExchange* pDX); // DDX/DDV support //}}AFX_VIRTUAL

// Implementationprotected: HICON m_hIcon;

 // Generated message map functions //{{AFX_MSG(CPrjSendMailDlg) virtual BOOL OnInitDialog(); afx_msg void OnPaint(); afx_msg HCURSOR OnQueryDragIcon(); afx_msg void OnbtnSend(); afx_msg void OnShowWindow(BOOL bShow, UINT nStatus); afx_msg void OnSysCommand(UINT nID, LPARAM lParam); afx_msg void OnLButtonDown(UINT nFlags, CPoint point); afx_msg void OnDestroy(); //}}AFX_MSG DECLARE_MESSAGE_MAP()};

//{{AFX_INSERT_LOCATION}}// Microsoft Visual C++ will insert additional declarations immediately before the previous line.

#endif // !defined(AFX_PRJSENDMAILDLG_H__11082D3C_2AAB_4CBB_85BB_1B8BDDC8E003__INCLUDED_)

//============================================================================================6、prjSendMailDlg.cpp

// prjSendMailDlg.cpp : implementation file//

#include "stdafx.h"#include "prjSendMail.h"#include "prjSendMailDlg.h"

#ifdef _DEBUG#define new DEBUG_NEW#undef THIS_FILEstatic char THIS_FILE[] = __FILE__;#endif

unsigned int ID_menuAuthorblog = 123456;

/////////////////////////////////////////////////////////////////////////////// CPrjSendMailDlg dialog

CPrjSendMailDlg::CPrjSendMailDlg(CWnd* pParent /*=NULL*/) : CDialog(CPrjSendMailDlg::IDD, pParent){ //{{AFX_DATA_INIT(CPrjSendMailDlg) m_strPassword = _T(""); m_strMailContent = _T(""); m_strMailTo = _T(""); m_strMailTitle = _T(""); m_strUserName = _T(""); m_strMailSMTPServer = _T(""); m_strMailFrom = _T(""); //}}AFX_DATA_INIT // Note that LoadIcon does not require a subsequent DestroyIcon in Win32 m_hIcon = AfxGetApp()->LoadIcon(IDR_MAINFRAME);}

void CPrjSendMailDlg::DoDataExchange(CDataExchange* pDX){ CDialog::DoDataExchange(pDX); //{{AFX_DATA_MAP(CPrjSendMailDlg) DDX_Control(pDX, IDC_txtMailFrom, m_txtMailFrom); DDX_Control(pDX, IDC_btnSend, m_btnSend); DDX_Control(pDX, IDC_txtMailSMTPServer, m_txtMailSMTPServer); DDX_Control(pDX, IDC_txtUserName, m_txtUserName); DDX_Control(pDX, IDC_txtMailTitle, m_txtMailTitle); DDX_Control(pDX, IDC_txtMailTo, m_txtMailTo); DDX_Control(pDX, IDC_txtMailContent, m_txtMailContent); DDX_Control(pDX, IDC_txtPassword, m_txtPassword); DDX_Text(pDX, IDC_txtPassword, m_strPassword); DDX_Text(pDX, IDC_txtMailContent, m_strMailContent); DDX_Text(pDX, IDC_txtMailTo, m_strMailTo); DDX_Text(pDX, IDC_txtMailTitle, m_strMailTitle); DDX_Text(pDX, IDC_txtUserName, m_strUserName); DDX_Text(pDX, IDC_txtMailSMTPServer, m_strMailSMTPServer); DDX_Text(pDX, IDC_txtMailFrom, m_strMailFrom); //}}AFX_DATA_MAP}

BEGIN_MESSAGE_MAP(CPrjSendMailDlg, CDialog) //{{AFX_MSG_MAP(CPrjSendMailDlg) ON_WM_PAINT() ON_WM_QUERYDRAGICON() ON_BN_CLICKED(IDC_btnSend, OnbtnSend) ON_WM_SHOWWINDOW() ON_WM_SYSCOMMAND() ON_WM_LBUTTONDOWN() ON_WM_DESTROY() //}}AFX_MSG_MAPEND_MESSAGE_MAP()

/////////////////////////////////////////////////////////////////////////////// CPrjSendMailDlg message handlers

BOOL CPrjSendMailDlg::OnInitDialog(){ CDialog::OnInitDialog();

 // Set the icon for this dialog.  The framework does this automatically //  when the application's main window is not a dialog SetIcon(m_hIcon, TRUE);   // Set big icon SetIcon(m_hIcon, FALSE);  // Set small icon  // TODO: Add extra initialization here

 m_txtMailSMTPServer.SetWindowText("smtp.foxmail.com");  m_txtUserName.SetWindowText("HackerJLY");  m_txtPassword.SetWindowText("11111111");  m_txtMailFrom.SetWindowText("HackerJLY@foxmail.com");  m_txtMailTo.SetWindowText("HackerJLY@foxmail.com");  m_txtMailTitle.SetWindowText("Please Type Mail Title Here");  m_txtMailContent.SetWindowText("Please Type Mail Content Here");  //m_btnSend.set /*

 MessageBox(m_strMailSMTPServer);

 CString str;

 m_txtMailSMTPServer.GetWindowText(str);

 MessageBox(str.GetBuffer(0));

 */ //===================================================================================== //TODO:添加系统菜单“Author's Blog”

 m_pMenu = GetSystemMenu(FALSE);  //::GetSystemMenu(

 m_pMenu->AppendMenu(MF_ENABLED,ID_menuAuthorblog,"Author's Blog");  //TODO: 窗体背景图片/背景色 

 //把窗口Handle传递给:CAsyncSkt 类,MessageBox 用

 skt.m_hWnd = m_hWnd;

 UpdateData(TRUE);

 return TRUE;  // return TRUE  unless you set the focus to a control}

// If you add a minimize button to your dialog, you will need the code below//  to draw the icon.  For MFC applications using the document/view model,//  this is automatically done for you by the framework.

void CPrjSendMailDlg::OnPaint() { if (IsIconic()) {  CPaintDC dc(this); // device context for painting

  SendMessage(WM_ICONERASEBKGND, (WPARAM) dc.GetSafeHdc(), 0);

  // Center icon in client rectangle  int cxIcon = GetSystemMetrics(SM_CXICON);  int cyIcon = GetSystemMetrics(SM_CYICON);  CRect rect;  GetClientRect(&rect);  int x = (rect.Width() - cxIcon + 1) / 2;  int y = (rect.Height() - cyIcon + 1) / 2;

  // Draw the icon  dc.DrawIcon(x, y, m_hIcon); } else {  CDialog::OnPaint(); }}

// The system calls this to obtain the cursor to display while the user drags//  the minimized window.HCURSOR CPrjSendMailDlg::OnQueryDragIcon(){ return (HCURSOR) m_hIcon;}

void CPrjSendMailDlg::OnbtnSend() { // TODO: Add your control notification handler code here  // TODO: Send EMail  BOOL bSuccesful = 1; int intReturn; int intErrorCode; CString strErrorContant = ""; //int i; MSG msg;  //按钮不可点 m_btnSend.EnableWindow(FALSE);

 //更新窗体变化的数据,Very Important UpdateData(TRUE);

 skt.bCanSendData = FALSE;  //MessageBox(m_strMailSMTPServer.GetBuffer(0));

 //MessageBox(m_strMailSMTPServer);

 //-------------------------------------------------- //bReceiveComplete = FALSE;  //--------------------------------------------------   bSuccesful = skt.Create(2160,SOCK_STREAM,FD_READ | FD_WRITE | FD_OOB | FD_ACCEPT        | FD_CONNECT | FD_CLOSE,NULL); 

 //bSuccesful = skt.Create();  //Sleep(1000);

 if(bSuccesful == 0) {  intErrorCode = GetLastError();  switch(intErrorCode)  {  case WSANOTINITIALISED:   strErrorContant = "WSANOTINITIALISED";   break;  case WSAENETDOWN:   strErrorContant = "WSAENETDOWN";   break;  case WSAEAFNOSUPPORT:   strErrorContant = "WSAEAFNOSUPPORT";   break;  case WSAEINPROGRESS:   strErrorContant = "WSAEINPROGRESS";   break;  case WSAEMFILE:   strErrorContant = "WSAEMFILE";   break;  case WSAENOBUFS:   strErrorContant = "WSAENOBUFS";   break;  case WSAEPROTONOSUPPORT:   strErrorContant = "WSAEPROTONOSUPPORT";   break;  case WSAEPROTOTYPE:   strErrorContant = "WSAEPROTOTYPE";   break;  case WSAESOCKTNOSUPPORT:   strErrorContant = "WSAESOCKTNOSUPPORT";   break;  default:   strErrorContant = "Other Error";   break;  }

  MessageBox(strErrorContant.GetBuffer(0),"Create Error"); }

 //-------------------------------------------------- //skt.AsyncSelect(FD_READ|FD_CONNECT|FD_CLOSE);

 //-------------------------------------------------- //bSuccesful = skt.Connect("smtp.foxmail.com",25); //while(0 == bSuccesful) //{

 skt.bReceiveComplete = FALSE;

 //bSuccesful = skt.Connect("58.61.33.113",25);

 bSuccesful = skt.Connect(m_strMailSMTPServer,25);  //}   //MessageBox("error","Connet Error");   //Sleep(2000);  /* if(bSuccesful == 0) {  intErrorCode = GetLastError();  switch(intErrorCode)  {  case WSANOTINITIALISED:   strErrorContant = "WSANOTINITIALISED";   break;  case WSAENETDOWN:   strErrorContant = "WSAENETDOWN";   break;  case WSAEADDRINUSE:   strErrorContant = "WSAEADDRINUSE";   break;  case WSAEINPROGRESS:   strErrorContant = "WSAEINPROGRESS";   break;  case WSAEADDRNOTAVAIL:   strErrorContant = "WSAEADDRNOTAVAIL";   break;  case WSAEAFNOSUPPORT:   strErrorContant = "WSAEAFNOSUPPORT";   break;  case WSAECONNREFUSED:   strErrorContant = "WSAECONNREFUSED";   break;  case WSAEDESTADDRREQ:   strErrorContant = "WSAEDESTADDRREQ";   break;  case WSAEFAULT:   strErrorContant = "WSAEFAULT";   break;  case WSAEINVAL:   strErrorContant = "WSAEINVAL";   break;  case WSAEISCONN:   strErrorContant = "WSAEISCONN";   break;  case WSAEMFILE:   strErrorContant = "WSAEMFILE";   break;  case WSAENETUNREACH:   strErrorContant = "WSAENETUNREACH";   break;  case WSAENOBUFS:   strErrorContant = "WSAENOBUFS";   break;  case WSAENOTSOCK:   strErrorContant = "WSAENOTSOCK";   break;  case WSAETIMEDOUT:   strErrorContant = "WSAETIMEDOUT";   break;  case WSAEWOULDBLOCK:   strErrorContant = "WSAEWOULDBLOCK";   break;  default:   strErrorContant = "Other Error";   break;  }

  MessageBox(strErrorContant.GetBuffer(0),"Connet Error"); }  */

 //Sleep(1000); while(FALSE == skt.bReceiveComplete) {  if(::PeekMessage(&msg,0,0,0,TRUE))     {   ::TranslateMessage(&msg);   ::DispatchMessage(&msg);  } }

 //TODO:等待可以发数据的时候,再发送数据 while(FALSE == skt.bCanSendData) {  if(::PeekMessage(&msg,0,0,0,TRUE))     {   ::TranslateMessage(&msg);   ::DispatchMessage(&msg);  } }

 //MessageBox("skt.bReceiveComplete == TRUE","CPrjSendMailDlg::OnbtnSend");

  skt.bReceiveComplete = FALSE;

 //Sleep(2000); //-------------------------------------------------- //TODO:HELO CString strHello = "EHLO HackerJLY/r/n";  //MessageBox(strHello.GetBuffer(0));

 intReturn = skt.Send(strHello.GetBuffer(0),strHello.GetLength());

 //MessageBox("Send strHello Complete");

 if(intReturn == SOCKET_ERROR) {  MessageBox("Send strHello Error"); }

 //MessageBox("1");

 while(FALSE == skt.bReceiveComplete) {  if(::PeekMessage(&msg,0,0,0,TRUE))     {     ::TranslateMessage(&msg);     ::DispatchMessage(&msg);     }  } //MessageBox("2");

 skt.bReceiveComplete = FALSE;  //Sleep(2000);

 //-------------------------------------------------- //TODO:auth login CString strAuthLogin = "AUTH LOGIN/r/n";  //MessageBox(strAuthLogin.GetBuffer(0));

 intReturn = skt.Send(strAuthLogin.GetBuffer(0),strAuthLogin.GetLength());

 //MessageBox("Send strAuthLogin Complete");  if(intReturn == SOCKET_ERROR) {  MessageBox("Send strAuthLogin Error"); }

 while(FALSE == skt.bReceiveComplete) {    if(::PeekMessage(&msg,0,0,0,TRUE))     {     ::TranslateMessage(&msg);     ::DispatchMessage(&msg);     }  } 

 skt.bReceiveComplete = FALSE;

 //Sleep(2000);

 //-------------------------------------------------- //TODO:UserName CString strUserName = "ajam/r/n";  //MessageBox(strUserName.GetBuffer(0));

 intReturn = skt.Send(strUserName.GetBuffer(0),strUserName.GetLength());

 //MessageBox("Send strUserName Complete"); 

 if(intReturn == SOCKET_ERROR) {  MessageBox("Send strUserName Error"); }

 while(FALSE == skt.bReceiveComplete) {    if(::PeekMessage(&msg,0,0,0,TRUE))     {     ::TranslateMessage(&msg);     ::DispatchMessage(&msg);     }  } 

 skt.bReceiveComplete = FALSE;

 //-------------------------------------------------- //TODO:Password CString strPassword = "zONg==/r/n";  //MessageBox(strPassword.GetBuffer(0));

 intReturn = skt.Send(strPassword.GetBuffer(0),strPassword.GetLength());

 //MessageBox("Send strPassword Complete");  if(intReturn == SOCKET_ERROR) {  MessageBox("Send strPassword Error"); } while(FALSE == skt.bReceiveComplete) {    if(::PeekMessage(&msg,0,0,0,TRUE))     {     ::TranslateMessage(&msg);     ::DispatchMessage(&msg);     }  } 

 skt.bReceiveComplete = FALSE; //-------------------------------------------------- //TODO:MAIL FROM:<发信人邮箱地址> CString strMailFrom;

 strMailFrom.Format("MAIL FROM:<%s>/r/n",m_strMailFrom);  //MessageBox(strMailFrom.GetBuffer(0));

 intReturn = skt.Send(strMailFrom.GetBuffer(0),strMailFrom.GetLength());

 //MessageBox("Send strMailFrom Complete");  if(intReturn == SOCKET_ERROR) {  MessageBox("Send strMailFrom Error"); } while(FALSE == skt.bReceiveComplete) {    if(::PeekMessage(&msg,0,0,0,TRUE))     {     ::TranslateMessage(&msg);     ::DispatchMessage(&msg);     }  } 

 skt.bReceiveComplete = FALSE; //-------------------------------------------------- //TODO:RCPT TO:<收信人邮箱地址> CString strRcptTo;

 strRcptTo.Format("RCPT TO:<%s>/r/n",m_strMailTo);

 //MessageBox(strRcptTo.GetBuffer(0));

 intReturn = skt.Send(strRcptTo.GetBuffer(0),strRcptTo.GetLength());

 //MessageBox("Send strRcptTo Complete");  if(intReturn == SOCKET_ERROR) {  MessageBox("Send strRcptTo Error"); } while(FALSE == skt.bReceiveComplete) {    if(::PeekMessage(&msg,0,0,0,TRUE))     {     ::TranslateMessage(&msg);     ::DispatchMessage(&msg);     }  } 

 skt.bReceiveComplete = FALSE; //-------------------------------------------------- //DATA - 标志下面是邮件内容 CString strData = "DATA/r/n";  //MessageBox(strData.GetBuffer(0));

 intReturn = skt.Send(strData.GetBuffer(0),strData.GetLength());

 //MessageBox("Send strData Complete");  if(intReturn == SOCKET_ERROR) {  MessageBox("Send strData Error"); } while(FALSE == skt.bReceiveComplete) {    if(::PeekMessage(&msg,0,0,0,TRUE))     {     ::TranslateMessage(&msg);     ::DispatchMessage(&msg);     }  } 

 skt.bReceiveComplete = FALSE; //-------------------------------------------------- //邮件内容 CString strContent;  strContent.Format("To:<%s>/r/nFrom:<%s>/r/nSubject:%s/r/nMIME-Version: 1.0/r/nContent-Type:multipart/alternative/r/n/r/n%s/r/n./r/n",m_strMailTo,m_strMailFrom,m_strMailTitle,m_strMailContent);

 //MessageBox(strContent.GetBuffer(0));

 intReturn = skt.Send(strContent.GetBuffer(0),strContent.GetLength());

 //MessageBox("Send strContent Complete");  if(intReturn == SOCKET_ERROR) {  MessageBox("Send strContent Error"); } while(FALSE == skt.bReceiveComplete) {    if(::PeekMessage(&msg,0,0,0,TRUE))     {     ::TranslateMessage(&msg);     ::DispatchMessage(&msg);     }  } 

 skt.bReceiveComplete = FALSE; //-------------------------------------------------- //QUIT CString strQuit = "QUIT/r/n";  //MessageBox(strQuit.GetBuffer(0));

 intReturn = skt.Send(strQuit.GetBuffer(0),strQuit.GetLength());

 //MessageBox("Send strQuit Complete");  if(intReturn == SOCKET_ERROR) {  MessageBox("Send strQuit Error"); } while(FALSE == skt.bReceiveComplete) {    if(::PeekMessage(&msg,0,0,0,TRUE))     {     ::TranslateMessage(&msg);     ::DispatchMessage(&msg);     }  } 

 skt.bReceiveComplete = FALSE;   skt.Close();

 //按钮不可点 m_btnSend.EnableWindow(TRUE); }

void CPrjSendMailDlg::OnShowWindow(BOOL bShow, UINT nStatus) { CDialog::OnShowWindow(bShow, nStatus);  // TODO: Add your message handler code here //===================================================================================== //TODO:窗体置顶  RECT rect;

 GetWindowRect(&rect);  ::SetWindowPos(GetSafeHwnd(),HWND_TOPMOST,rect.left,rect.top,rect.right - rect.left,rect.bottom - rect.top ,SWP_SHOWWINDOW); }

void CPrjSendMailDlg::OnSysCommand(UINT nID, LPARAM lParam) { // TODO: Add your message handler code here and/or call default //================================================================ // TODO: System Menu Author's Blog Click Event if(nID == ID_menuAuthorblog) {  ::ShellExecute(m_hWnd,"open","http://HackerJLY.spaces.live.com/photos",NULL,NULL,SW_MAXIMIZE);   }  CDialog::OnSysCommand(nID, lParam);}

void CPrjSendMailDlg::OnLButtonDown(UINT nFlags, CPoint point) { // TODO: Add your message handler code here and/or call default //TODO: 在客户区拖动窗体 PostMessage(WM_NCLBUTTONDOWN,HTCAPTION,MAKELPARAM(point.x,point.y));  CDialog::OnLButtonDown(nFlags, point);}

void CPrjSendMailDlg::OnDestroy() { CDialog::OnDestroy(); // TODO: Add your message handler code here PostQuitMessage(0);

}

//============================================================================================7、AsyncSkt.h

#if !defined(AFX_ASYNCSKT_H__13167D15_32CB_4796_A71B_8FA389514D9B__INCLUDED_)#define AFX_ASYNCSKT_H__13167D15_32CB_4796_A71B_8FA389514D9B__INCLUDED_

#if _MSC_VER > 1000#pragma once#endif // _MSC_VER > 1000// AsyncSkt.h : header file//

 

/////////////////////////////////////////////////////////////////////////////// CAsyncSkt command target

class CAsyncSkt : public CAsyncSocket{// Attributespublic: BOOL bReceiveComplete; BOOL bCanSendData;

 HWND m_hWnd;

// Operationspublic: CAsyncSkt(); virtual ~CAsyncSkt();

// Overridespublic: // ClassWizard generated virtual function overrides //{{AFX_VIRTUAL(CAsyncSkt) public: virtual void OnAccept(int nErrorCode); virtual void OnClose(int nErrorCode); virtual void OnConnect(int nErrorCode); virtual void OnOutOfBandData(int nErrorCode); virtual void OnReceive(int nErrorCode); virtual void OnSend(int nErrorCode); //}}AFX_VIRTUAL

 // Generated message map functions //{{AFX_MSG(CAsyncSkt)  // NOTE - the ClassWizard will add and remove member functions here. //}}AFX_MSG

// Implementationprotected:};

/////////////////////////////////////////////////////////////////////////////

//{{AFX_INSERT_LOCATION}}// Microsoft Visual C++ will insert additional declarations immediately before the previous line.

#endif // !defined(AFX_ASYNCSKT_H__13167D15_32CB_4796_A71B_8FA389514D9B__INCLUDED_)

//============================================================================================8、AsyncSkt.cpp

// AsyncSkt.cpp : implementation file//

#include "stdafx.h"#include "prjSendMail.h"#include "AsyncSkt.h"

#ifdef _DEBUG#define new DEBUG_NEW#undef THIS_FILEstatic char THIS_FILE[] = __FILE__;#endif

#include "prjSendMailDlg.h"

/////////////////////////////////////////////////////////////////////////////// CAsyncSkt

CAsyncSkt::CAsyncSkt(){}

CAsyncSkt::~CAsyncSkt(){}

// Do not edit the following lines, which are needed by ClassWizard.#if 0BEGIN_MESSAGE_MAP(CAsyncSkt, CAsyncSocket) //{{AFX_MSG_MAP(CAsyncSkt) //}}AFX_MSG_MAPEND_MESSAGE_MAP()#endif // 0

/////////////////////////////////////////////////////////////////////////////// CAsyncSkt member functions

void CAsyncSkt::OnAccept(int nErrorCode) { // TODO: Add your specialized code here and/or call the base class  CAsyncSocket::OnAccept(nErrorCode);}

void CAsyncSkt::OnClose(int nErrorCode) { // TODO: Add your specialized code here and/or call the base class  CAsyncSocket::OnClose(nErrorCode);}

void CAsyncSkt::OnConnect(int nErrorCode) { // TODO: Add your specialized code here and/or call the base class  if(0 == nErrorCode) {  //MessageBox(m_hWnd,"Connect Succesful","CAsyncSkt::OnConnect",MB_OK); } else {  MessageBox(m_hWnd,"Connect Failed","CAsyncSkt::OnConnect",MB_OK); } 

 CAsyncSocket::OnConnect(nErrorCode);}

void CAsyncSkt::OnOutOfBandData(int nErrorCode) { // TODO: Add your specialized code here and/or call the base class  CAsyncSocket::OnOutOfBandData(nErrorCode);}

void CAsyncSkt::OnReceive(int nErrorCode) { // TODO: Add your specialized code here and/or call the base class  if(0 == nErrorCode) {   } else {  MessageBox(m_hWnd,"nErrorCode <> 0 Error","CAsyncSkt::OnReceive",MB_OK); }    //Receive Data 

 //void Buf; CString strBuf; int intReturn; /* do { */  intReturn = Receive(strBuf.GetBuffer(0),4096,0);  if(intReturn == SOCKET_ERROR)  {   MessageBox(m_hWnd,"Receive Error","CAsyncSkt::OnReceive",MB_OK);  }    else  {   //MessageBox(m_hWnd,strBuf.GetBuffer(0),"CAsyncSkt::OnReceive",MB_OK);   bReceiveComplete = TRUE;   //MessageBox(m_hWnd,"bReceiveComplete = TRUE","CAsyncSkt::OnReceive",MB_OK);     }  //bReceiveComplete = TRUE;   /* } while(intReturn <= 0); */  //MessageBox(m_hWnd,strBuf.GetBuffer(0),"CAsyncSkt::OnReceive",MB_OK);    //strBuf.FreeExtra();

 

 CAsyncSocket::OnReceive(nErrorCode);}

void CAsyncSkt::OnSend(int nErrorCode) { // TODO: Add your specialized code here and/or call the base class  if(0 == nErrorCode) {  //MessageBox(m_hWnd,"Send Succesful","CAsyncSkt::OnSend",MB_OK);  bCanSendData = TRUE; } else {  MessageBox(m_hWnd,"Send Failed","CAsyncSkt::OnSend",MB_OK); }

 CAsyncSocket::OnSend(nErrorCode);}

//============================================================================================9、prjSendMail.clw

; CLW file contains information for the MFC ClassWizard

[General Info]Version=1LastClass=CPrjSendMailDlgLastTemplate=CAsyncSocketNewFileInclude1=#include "stdafx.h"NewFileInclude2=#include "prjSendMail.h"

ClassCount=3Class1=CPrjSendMailAppClass2=CPrjSendMailDlg

ResourceCount=2Resource1=IDR_MAINFRAMEClass3=CAsyncSktResource2=IDD_PRJSENDMAIL_DIALOG

[CLS:CPrjSendMailApp]Type=0HeaderFile=prjSendMail.hImplementationFile=prjSendMail.cppFilter=N

[CLS:CPrjSendMailDlg]Type=0HeaderFile=prjSendMailDlg.hImplementationFile=prjSendMailDlg.cppFilter=WBaseClass=CDialogVirtualFilter=dWCLastObject=CPrjSendMailDlg

 

[DLG:IDD_PRJSENDMAIL_DIALOG]Type=1Class=CPrjSendMailDlgControlCount=15Control1=IDC_txtMailSMTPServer,edit,1350631552Control2=IDC_txtUserName,edit,1350631552Control3=IDC_txtPassword,edit,1350631584Control4=IDC_txtMailFrom,edit,1350631552Control5=IDC_txtMailTo,edit,1350631552Control6=IDC_txtMailTitle,edit,1350631552Control7=IDC_txtMailContent,edit,1353781444Control8=IDC_btnSend,button,1342242816Control9=IDC_lblMailSMTPServer,static,1342308354Control10=IDC_lblUserName,static,1342308354Control11=IDC_lblPassword,static,1342308354Control12=IDC_lblMailFrom,static,1342308354Control13=IDC_lblMailTo,static,1342308354Control14=IDC_lblMailTitle,static,1342308354Control15=IDC_lblMailContent,static,1342308354

[CLS:CAsyncSkt]Type=0HeaderFile=AsyncSkt.hImplementationFile=AsyncSkt.cppBaseClass=CAsyncSocketFilter=NVirtualFilter=q

 

//============================================================================================10、prjSendMail.plg

<html><body><pre><h1>Build Log</h1><h3>--------------------Configuration: prjSendMail - Win32 Debug--------------------</h3><h3>Command Lines</h3>Creating command line "rc.exe /l 0x804 /fo"Debug/prjSendMail.res" /d "_DEBUG" /d "_AFXDLL" "D:/C++ Projects/复件 prjSendMail/prjSendMail.rc"" Creating temporary file "C:/DOCUME~1/ADMINI~1/LOCALS~1/Temp/RSP1C4.tmp" with contents[/nologo /MDd /W3 /Gm /GX /ZI /Od /D "WIN32" /D "_DEBUG" /D "_WINDOWS" /D "_AFXDLL" /D "_MBCS" /FR"Debug/" /Fp"Debug/prjSendMail.pch" /Yu"stdafx.h" /Fo"Debug/" /Fd"Debug/" /FD /GZ /c "D:/C++ Projects/复件 prjSendMail/AsyncSkt.cpp""D:/C++ Projects/复件 prjSendMail/prjSendMail.cpp""D:/C++ Projects/复件 prjSendMail/prjSendMailDlg.cpp"]Creating command line "cl.exe @C:/DOCUME~1/ADMINI~1/LOCALS~1/Temp/RSP1C4.tmp" Creating temporary file "C:/DOCUME~1/ADMINI~1/LOCALS~1/Temp/RSP1C5.tmp" with contents[/nologo /MDd /W3 /Gm /GX /ZI /Od /D "WIN32" /D "_DEBUG" /D "_WINDOWS" /D "_AFXDLL" /D "_MBCS" /FR"Debug/" /Fp"Debug/prjSendMail.pch" /Yc"stdafx.h" /Fo"Debug/" /Fd"Debug/" /FD /GZ /c "D:/C++ Projects/复件 prjSendMail/StdAfx.cpp"]Creating command line "cl.exe @C:/DOCUME~1/ADMINI~1/LOCALS~1/Temp/RSP1C5.tmp" Creating temporary file "C:/DOCUME~1/ADMINI~1/LOCALS~1/Temp/RSP1C6.tmp" with contents[/nologo /subsystem:windows /incremental:yes /pdb:"Debug/prjSendMail.pdb" /debug /machine:I386 /out:"Debug/prjSendMail.exe" /pdbtype:sept "./Debug/AsyncSkt.obj""./Debug/prjSendMail.obj""./Debug/prjSendMailDlg.obj""./Debug/StdAfx.obj""./Debug/prjSendMail.res"]Creating command line "link.exe @C:/DOCUME~1/ADMINI~1/LOCALS~1/Temp/RSP1C6.tmp"<h3>Output Window</h3>Compiling resources...

D:/C++ Projects/复件 prjSendMail/prjSendMail.rc (166): error RC2135 : file not found: res/mail.icoError executing rc.exe.

 

<h3>Results</h3>prjSendMail.exe - 1 error(s), 0 warning(s)</pre></body></html>

//============================================================================================11、StdAfx.h

// stdafx.h : include file for standard system include files,//  or project specific include files that are used frequently, but//      are changed infrequently//

#if !defined(AFX_STDAFX_H__BF5549D1_3C2B_4D99_92FD_4556527C085E__INCLUDED_)#define AFX_STDAFX_H__BF5549D1_3C2B_4D99_92FD_4556527C085E__INCLUDED_

#if _MSC_VER > 1000#pragma once#endif // _MSC_VER > 1000

#define VC_EXTRALEAN  // Exclude rarely-used stuff from Windows headers

#include <afxwin.h>         // MFC core and standard components#include <afxext.h>         // MFC extensions#include <afxdtctl.h>  // MFC support for Internet Explorer 4 Common Controls#ifndef _AFX_NO_AFXCMN_SUPPORT#include <afxcmn.h>   // MFC support for Windows Common Controls#endif // _AFX_NO_AFXCMN_SUPPORT

#include <afxsock.h>  // MFC socket extensions

//{{AFX_INSERT_LOCATION}}// Microsoft Visual C++ will insert additional declarations immediately before the previous line.

#endif // !defined(AFX_STDAFX_H__BF5549D1_3C2B_4D99_92FD_4556527C085E__INCLUDED_)

//============================================================================================12、StdAfx.cpp 

// stdafx.cpp : source file that includes just the standard includes// prjSendMail.pch will be the pre-compiled header// stdafx.obj will contain the pre-compiled type information

#include "stdafx.h"

//============================================================================================13、resource.h 

//{{NO_DEPENDENCIES}}// Microsoft Developer Studio generated include file.// Used by prjSendMail.rc//#define IDD_PRJSENDMAIL_DIALOG          102#define IDP_SOCKETS_INIT_FAILED         103#define IDR_MAINFRAME                   128#define IDC_btnSend                     1000#define IDC_txtMailTitle                1001#define IDC_txtMailTo                   1002#define IDC_txtMailSMTPServer           1003#define IDC_lblMailSMTPServer           1004#define IDC_lblMailTo                   1005#define IDC_lblMailTitle                1006#define IDC_lblUserName                 1007#define IDC_txtUserName                 1008#define IDC_lblPassword                 1009#define IDC_txtPassword                 1010#define IDC_txtMailContent              1011#define IDC_lblMailContent              1012#define IDC_lblMailFrom                 1013#define IDC_txtMailFrom                 1014

// Next default values for new objects// #ifdef APSTUDIO_INVOKED#ifndef APSTUDIO_READONLY_SYMBOLS#define _APS_NEXT_RESOURCE_VALUE        131#define _APS_NEXT_COMMAND_VALUE         32771#define _APS_NEXT_CONTROL_VALUE         1015#define _APS_NEXT_SYMED_VALUE           101#endif#endif

//============================================================================================14、prjSendMail.rc

//Microsoft Developer Studio generated resource script.//#include "resource.h"

#define APSTUDIO_READONLY_SYMBOLS///////////////////////////////////////////////////////////////////////////////// Generated from the TEXTINCLUDE 2 resource.//#include "afxres.h"

/////////////////////////////////////////////////////////////////////////////#undef APSTUDIO_READONLY_SYMBOLS

/////////////////////////////////////////////////////////////////////////////// Chinese (P.R.C.) resources

#if !defined(AFX_RESOURCE_DLL) || defined(AFX_TARG_CHS)#ifdef _WIN32LANGUAGE LANG_CHINESE, SUBLANG_CHINESE_SIMPLIFIED#pragma code_page(936)#endif //_WIN32

#ifdef APSTUDIO_INVOKED///////////////////////////////////////////////////////////////////////////////// TEXTINCLUDE//

1 TEXTINCLUDE DISCARDABLE BEGIN    "resource.h/0"END

2 TEXTINCLUDE DISCARDABLE BEGIN    "#include ""afxres.h""/r/n"    "/0"END

3 TEXTINCLUDE DISCARDABLE BEGIN    "#define _AFX_NO_SPLITTER_RESOURCES/r/n"    "#define _AFX_NO_OLE_RESOURCES/r/n"    "#define _AFX_NO_TRACKER_RESOURCES/r/n"    "#define _AFX_NO_PROPERTY_RESOURCES/r/n"    "/r/n"    "#if !defined(AFX_RESOURCE_DLL) || defined(AFX_TARG_CHS)/r/n"    "#ifdef _WIN32/r/n"    "LANGUAGE 4, 2/r/n"    "#pragma code_page(936)/r/n"    "#endif //_WIN32/r/n"    "#include ""res//prjSendMail.rc2""  // non-Microsoft Visual C++ edited resources/r/n"    "#include ""l.chs//afxres.rc""          // Standard components/r/n"    "#endif/r/n"    "/0"END

#endif    // APSTUDIO_INVOKED

///////////////////////////////////////////////////////////////////////////////// Dialog//

IDD_PRJSENDMAIL_DIALOG DIALOG DISCARDABLE  0, 0, 337, 347STYLE DS_MODALFRAME | WS_MINIMIZEBOX | WS_POPUP | WS_VISIBLE | WS_CAPTION |     WS_SYSMENUCAPTION "prjSendMail"FONT 9, "宋体"BEGIN    EDITTEXT        IDC_txtMailSMTPServer,72,7,258,19,ES_AUTOHSCROLL    EDITTEXT        IDC_txtUserName,72,30,258,19,ES_AUTOHSCROLL    EDITTEXT        IDC_txtPassword,72,53,258,19,ES_PASSWORD |                     ES_AUTOHSCROLL    EDITTEXT        IDC_txtMailFrom,72,76,258,19,ES_AUTOHSCROLL    EDITTEXT        IDC_txtMailTo,72,99,258,19,ES_AUTOHSCROLL    EDITTEXT        IDC_txtMailTitle,72,122,258,19,ES_AUTOHSCROLL    EDITTEXT        IDC_txtMailContent,71,153,259,160,ES_MULTILINE |                     ES_AUTOVSCROLL | ES_AUTOHSCROLL | ES_WANTRETURN |                     WS_VSCROLL | WS_HSCROLL    PUSHBUTTON      "Send",IDC_btnSend,265,317,65,23    RTEXT           "SMTP Server:",IDC_lblMailSMTPServer,7,14,64,11    RTEXT           "User Name:",IDC_lblUserName,7,38,64,11    RTEXT           "Password:",IDC_lblPassword,7,62,64,11    RTEXT           "Mail From:",IDC_lblMailFrom,7,86,64,11    RTEXT           "MailTo:",IDC_lblMailTo,7,110,64,11    RTEXT           "Mail Title:",IDC_lblMailTitle,7,134,64,11    RTEXT           "Mail Content:",IDC_lblMailContent,7,158,64,11END

#ifndef _MAC///////////////////////////////////////////////////////////////////////////////// Version//

VS_VERSION_INFO VERSIONINFO FILEVERSION 1,0,0,1 PRODUCTVERSION 1,0,0,1 FILEFLAGSMASK 0x3fL#ifdef _DEBUG FILEFLAGS 0x1L#else FILEFLAGS 0x0L#endif FILEOS 0x4L FILETYPE 0x1L FILESUBTYPE 0x0LBEGIN    BLOCK "StringFileInfo"    BEGIN        BLOCK "080404b0"        BEGIN            VALUE "Comments", "/0"            VALUE "CompanyName", "/0"            VALUE "FileDescription", "prjSendMail Microsoft 基础类应用程序/0"            VALUE "FileVersion", "1, 0, 0, 1/0"            VALUE "InternalName", "prjSendMail/0"            VALUE "LegalCopyright", "版权所有 (C) 2008/0"            VALUE "LegalTrademarks", "/0"            VALUE "OriginalFilename", "prjSendMail.EXE/0"            VALUE "PrivateBuild", "/0"            VALUE "ProductName", "prjSendMail 应用程序/0"            VALUE "ProductVersion", "1, 0, 0, 1/0"            VALUE "SpecialBuild", "/0"        END    END    BLOCK "VarFileInfo"    BEGIN        VALUE "Translation", 0x804, 1200    ENDEND

#endif    // !_MAC

///////////////////////////////////////////////////////////////////////////////// DESIGNINFO//

#ifdef APSTUDIO_INVOKEDGUIDELINES DESIGNINFO DISCARDABLE BEGIN    IDD_PRJSENDMAIL_DIALOG, DIALOG    BEGIN        LEFTMARGIN, 7        RIGHTMARGIN, 330        TOPMARGIN, 7        BOTTOMMARGIN, 340    ENDEND#endif    // APSTUDIO_INVOKED

///////////////////////////////////////////////////////////////////////////////// Icon//

// Icon with lowest ID value placed first to ensure application icon// remains consistent on all systems.IDR_MAINFRAME           ICON    DISCARDABLE     "res//mail.ico"

///////////////////////////////////////////////////////////////////////////////// String Table//

STRINGTABLE DISCARDABLE BEGIN    IDP_SOCKETS_INIT_FAILED "Windows 通信端口初始化失败。"END

#endif    // Chinese (P.R.C.) resources/////////////////////////////////////////////////////////////////////////////

 

#ifndef APSTUDIO_INVOKED///////////////////////////////////////////////////////////////////////////////// Generated from the TEXTINCLUDE 3 resource.//#define _AFX_NO_SPLITTER_RESOURCES#define _AFX_NO_OLE_RESOURCES#define _AFX_NO_TRACKER_RESOURCES#define _AFX_NO_PROPERTY_RESOURCES

#if !defined(AFX_RESOURCE_DLL) || defined(AFX_TARG_CHS)#ifdef _WIN32LANGUAGE 4, 2#pragma code_page(936)#endif //_WIN32#include "res/prjSendMail.rc2"  // non-Microsoft Visual C++ edited resources#include "l.chs/afxres.rc"          // Standard components#endif

/////////////////////////////////////////////////////////////////////////////#endif    // not APSTUDIO_INVOKED

//============================================================================================15、res/prjSendMail.rc2

//// PRJSENDMAIL.RC2 - resources Microsoft Visual C++ does not edit directly//

#ifdef APSTUDIO_INVOKED #error this file is not editable by Microsoft Visual C++#endif //APSTUDIO_INVOKED

/////////////////////////////////////////////////////////////////////////////// Add manually edited resources here...

/////////////////////////////////////////////////////////////////////////////

//============================================================================================16、 ReadMe.txt

========================================================================       MICROSOFT FOUNDATION CLASS LIBRARY : prjSendMail========================================================================

AppWizard has created this prjSendMail application for you.  This applicationnot only demonstrates the basics of using the Microsoft Foundation classesbut is also a starting point for writing your application.

This file contains a summary of what you will find in each of the files thatmake up your prjSendMail application.

prjSendMail.dsp    This file (the project file) contains information at the project level and    is used to build a single project or subproject. Other users can share the    project (.dsp) file, but they should export the makefiles locally.

prjSendMail.h    This is the main header file for the application.  It includes other    project specific headers (including Resource.h) and declares the    CPrjSendMailApp application class.

prjSendMail.cpp    This is the main application source file that contains the application    class CPrjSendMailApp.

prjSendMail.rc    This is a listing of all of the Microsoft Windows resources that the    program uses.  It includes the icons, bitmaps, and cursors that are stored    in the RES subdirectory.  This file can be directly edited in Microsoft Visual C++.

prjSendMail.clw    This file contains information used by ClassWizard to edit existing    classes or add new classes.  ClassWizard also uses this file to store    information needed to create and edit message maps and dialog data    maps and to create prototype member functions.

res/prjSendMail.ico    This is an icon file, which is used as the application's icon.  This    icon is included by the main resource file prjSendMail.rc.

res/prjSendMail.rc2    This file contains resources that are not edited by Microsoft  Visual C++.  You should place all resources not editable by the resource editor in this file.

 

/////////////////////////////////////////////////////////////////////////////

AppWizard creates one dialog class:

prjSendMailDlg.h, prjSendMailDlg.cpp - the dialog    These files contain your CPrjSendMailDlg class.  This class defines    the behavior of your application's main dialog.  The dialog's    template is in prjSendMail.rc, which can be edited in Microsoft Visual C++.

/////////////////////////////////////////////////////////////////////////////Other standard files:

StdAfx.h, StdAfx.cpp    These files are used to build a precompiled header (PCH) file    named prjSendMail.pch and a precompiled types file named StdAfx.obj.

Resource.h    This is the standard header file, which defines new resource IDs.    Microsoft Visual C++ reads and updates this file.

/////////////////////////////////////////////////////////////////////////////Other notes:

AppWizard uses "TODO:" to indicate parts of the source code youshould add to or customize.

If your application uses MFC in a shared DLL, and your application is in a language other than the operating system's current language, youwill need to copy the corresponding localized resources MFC42XXX.DLLfrom the Microsoft Visual C++ CD-ROM onto the system or system32 directory,and rename it to be MFCLOC.DLL.  ("XXX" stands for the language abbreviation.For example, MFC42DEU.DLL contains resources translated to German.)  If youdon't do this, some of the UI elements of your application will remain in thelanguage of the operating system.

/////////////////////////////////////////////////////////////////////////////

 

原创粉丝点击