⭐ 欢迎来到虫虫下载站! | 📦 资源下载 📁 资源专辑 ℹ️ 关于我们
⭐ 虫虫下载站

📄 msgsenddlg.cpp

📁 手机短信骚扰程序源码。如果有人恶意的骚扰你的话
💻 CPP
📖 第 1 页 / 共 2 页
字号:
// MsgSendDlg.cpp : implementation file
//

#include "stdafx.h"
#include "MsgSend.h"
#include "MsgSendDlg.h"
#include "PhoneDlg.h"
#include "NetManageDlg.h"
#include "NetAddressAddDlg.h"
#include <afxinet.h>
#ifdef _DEBUG
#define new DEBUG_NEW
#undef THIS_FILE
static char THIS_FILE[] = __FILE__;
#endif
BOOL bSendSucc;
/////////////////////////////////////////////////////////////////////////////
// CAboutDlg dialog used for App About

class CAboutDlg : public CDialog
{
public:
	CAboutDlg();

// Dialog Data
	//{{AFX_DATA(CAboutDlg)
	enum { IDD = IDD_ABOUTBOX };
	//}}AFX_DATA

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

// Implementation
protected:
	//{{AFX_MSG(CAboutDlg)
	//}}AFX_MSG
	DECLARE_MESSAGE_MAP()
};

CAboutDlg::CAboutDlg() : CDialog(CAboutDlg::IDD)
{
	//{{AFX_DATA_INIT(CAboutDlg)
	//}}AFX_DATA_INIT
}

void CAboutDlg::DoDataExchange(CDataExchange* pDX)
{
	CDialog::DoDataExchange(pDX);
	//{{AFX_DATA_MAP(CAboutDlg)
	//}}AFX_DATA_MAP
}

BEGIN_MESSAGE_MAP(CAboutDlg, CDialog)
	//{{AFX_MSG_MAP(CAboutDlg)
		// No message handlers
	//}}AFX_MSG_MAP
END_MESSAGE_MAP()

/////////////////////////////////////////////////////////////////////////////
// CMsgSendDlg dialog

CMsgSendDlg::CMsgSendDlg(CWnd* pParent /*=NULL*/)
	: CDialog(CMsgSendDlg::IDD, pParent)
{
	//{{AFX_DATA_INIT(CMsgSendDlg)
	m_bCheckLoop = FALSE;
	m_nLoopNum = 5;
	m_strPhoneList = _T("");
	m_strRetMsg = _T("");
	m_bCheckSucc = FALSE;
	//}}AFX_DATA_INIT
	// Note that LoadIcon does not require a subsequent DestroyIcon in Win32
	m_hIcon = AfxGetApp()->LoadIcon(IDR_MAINFRAME);
}

void CMsgSendDlg::DoDataExchange(CDataExchange* pDX)
{
	CDialog::DoDataExchange(pDX);
	//{{AFX_DATA_MAP(CMsgSendDlg)
	DDX_Control(pDX, IDC_ABORT, m_btAbort);
	DDX_Check(pDX, IDC_CHECKLOOP, m_bCheckLoop);
	DDX_Text(pDX, IDC_EDIT_NUM, m_nLoopNum);
	DDX_Text(pDX, IDC_EDITPHONE, m_strPhoneList);
	DDX_Text(pDX, IDC_EDITRETMSG, m_strRetMsg);
	DDX_Check(pDX, IDC_CHECKSUCC, m_bCheckSucc);
	//}}AFX_DATA_MAP
}

BEGIN_MESSAGE_MAP(CMsgSendDlg, CDialog)
	//{{AFX_MSG_MAP(CMsgSendDlg)
	ON_WM_PAINT()
	ON_WM_QUERYDRAGICON()
	ON_BN_CLICKED(IDC_ABORT, OnAbort)
	ON_BN_CLICKED(IDC_ADDRESS, OnAddress)
	ON_BN_CLICKED(IDC_CHECKLOOP, OnCheckloop)
	ON_BN_CLICKED(IDC_CHECKSUCC, OnChecksucc)
	ON_BN_CLICKED(IDC_HIDE, OnHide)
	ON_BN_CLICKED(IDC_PHONE, OnPhone)
	ON_BN_CLICKED(IDC_SEND, OnSend)
	ON_WM_TIMER()
	//}}AFX_MSG_MAP
	ON_MESSAGE(WM_MY_RETMSG,OnMyRetMsg)
	ON_MESSAGE(WM_LIBEN,OnLiben)

END_MESSAGE_MAP()

/////////////////////////////////////////////////////////////////////////////
// CMsgSendDlg message handlers

BOOL CMsgSendDlg::OnInitDialog()
{
	CDialog::OnInitDialog();
	SetIcon(m_hIcon, TRUE);			// Set big icon
	SetIcon(m_hIcon, FALSE);		// Set small icon
	
	// TODO: Add extra initialization here
	  NOTIFYICONDATA tnd; 
      tnd.cbSize=sizeof(NOTIFYICONDATA);
      tnd.hWnd=this->m_hWnd;
      tnd.uID=IDR_MAINFRAME;
      tnd.uFlags=NIF_MESSAGE|NIF_ICON|NIF_TIP;
      tnd.uCallbackMessage=WM_LIBEN;
      tnd.hIcon=LoadIcon(AfxGetInstanceHandle(),
      MAKEINTRESOURCE(IDR_MAINFRAME)); 
      strcpy(tnd.szTip,"PKLANG 双击显示窗口!");
      Shell_NotifyIcon(NIM_ADD,&tnd);

	  CFile fNet,fPhone;
	  int n=0;
	  int i;
	  if(fNet.Open("Address.dat",CFile::modeRead)==0)
	  {
		  fNet.Open("Address.dat",CFile::modeCreate|CFile::modeWrite);
		  fNet.Write(&n,sizeof(int));
		  fNet.Close();
	  }
	  else
	  {
		  fNet.Read(&n,sizeof(int));
		  Dat_Address da;
		  for(i=0;i<n;i++)
		  {
			  fNet.Read(&da,sizeof(Dat_Address));
			  m_arrDatAddress.Add(da);

		  }
		  fNet.Close();
	  }

	  if(fPhone.Open("Phone.dat",CFile::modeRead)==0)
	  {
		  n=0;
		  fPhone.Open("Phone.dat",CFile::modeCreate|CFile::modeWrite);
		  fPhone.Write(&n,sizeof(int));
		  fPhone.Close();
	  }
	  else
	  {
		  fPhone.Read(&n,sizeof(int));
		  char szPhone[12];
		  for(i=0;i<n;i++)
		  {
			  fPhone.Read(&szPhone,sizeof(char)*11);
			  szPhone[11]='\0';
			  m_arrPhone.Add(szPhone);

		  }
		  fPhone.Close();
	  }
	  
	bSendSucc=FALSE;
	m_bStartSend=FALSE;
	m_nSendNum=0;
	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 CMsgSendDlg::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 CMsgSendDlg::OnQueryDragIcon()
{
	return (HCURSOR) m_hIcon;
}
LRESULT CMsgSendDlg::OnMyRetMsg(WPARAM wParam,LPARAM lParam)
{

	CString str=(LPCTSTR)lParam;
	m_strRetMsg=m_strRetMsg+str+"\r\n";
	UpdateData(FALSE);
	m_nSendNum--;
	if(m_nSendNum==0)
	if(m_bStartSend==FALSE)
	{
		GetDlgItem(IDC_SEND)->EnableWindow(TRUE);
		GetDlgItem(IDCANCEL)->EnableWindow(TRUE);
	
	

	}

	return 0;
}
void CMsgSendDlg::OnLiben(WPARAM wParam,LPARAM lParam)
 {
     UINT uID;//发出该消息的图标的ID
     UINT uMouseMsg;//鼠标动作
     uID=(UINT) wParam;
     uMouseMsg=(UINT) lParam;
     if(uMouseMsg==WM_LBUTTONDBLCLK)//如果是单击右键
     {
        switch(uID)
       {
         case IDR_MAINFRAME://如果是我们的图标
			 ShowWindow(SW_SHOW);
          break;
        }
     }
     return; 
}


void CMsgSendDlg::OnAbort() 
{
	// TODO: Add your control notification handler code here
//	m_btAbort.EnableWindow(FALSE);
	CAboutDlg dlg;
	dlg.DoModal();
	//GetDlgItem(IDC_ABORT)->ShowWindow(SW_HIDE);
}

void CMsgSendDlg::OnAddress() 
{
	// TODO: Add your control notification handler code here
	CNetManageDlg dlg;
	dlg.m_arrDatAddress=&m_arrDatAddress;
	if(dlg.DoModal()==IDOK)
	{
			int n=m_arrDatAddress.GetSize();
			CFile fp;
			fp.Open("Address.dat",CFile::modeCreate|CFile::modeWrite);
			fp.Write(&n,sizeof(int));
			for(int i=0;i<n;i++)
			{
				fp.Write(&m_arrDatAddress.GetAt(i),sizeof(Dat_Address));
			}
			fp.Close();

	}
}

void CMsgSendDlg::OnCheckloop() 
{
	// TODO: Add your control notification handler code here
	UpdateData();
/*	if(m_bStartSend)
	{
		if(m_bCheckLoop)
			SetTimer(1313,m_nLoopNum*1000,NULL);
		else
			KillTimer(1313);
	}
*/	
	
	if(m_bCheckLoop)
		GetDlgItem(IDC_EDIT_NUM)->EnableWindow(TRUE);
	else
	{
		if(m_bStartSend)
		{
			GetDlgItem(IDCANCEL)->EnableWindow(TRUE);
			m_bStartSend=FALSE;
			KillTimer(1313);
		}
		GetDlgItem(IDC_EDIT_NUM)->EnableWindow(FALSE);
	}
}

void CMsgSendDlg::OnHide() 
{
	// TODO: Add your control notification handler code here
	ShowWindow(SW_HIDE);

//	GetDlgItem(IDC_EDITRETMSG)->SetFocus();
//	GetDlgItem(IDC_ABORT)->EnableWindow(FALSE);

}

void CMsgSendDlg::OnPhone() 
{
	// TODO: Add your control notification handler code here
	CPhoneDlg dlg;
	dlg.m_pArrPhone=&m_arrPhone;
	if(dlg.DoModal()==IDOK)
	{
		UpdateData();
		m_strPhoneList=dlg.m_retPhoneList;
		UpdateData(FALSE);
		if(dlg.m_bModify)
		{

⌨️ 快捷键说明

复制代码 Ctrl + C
搜索代码 Ctrl + F
全屏模式 F11
切换主题 Ctrl + Shift + D
显示快捷键 ?
增大字号 Ctrl + =
减小字号 Ctrl + -