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

📄 selectg.cpp

📁 短信发送工具
💻 CPP
字号:
// SELECTG.cpp : implementation file
//

#include "stdafx.h"
#include "SMS.h"
#include "SELECTG.h"
#include "SBSMS.h"
#ifdef _DEBUG
#define new DEBUG_NEW
#undef THIS_FILE
static char THIS_FILE[] = __FILE__;
#endif

/////////////////////////////////////////////////////////////////////////////
// CSELECTG dialog


CSELECTG::CSELECTG(CWnd* pParent /*=NULL*/)
	: CDialog(CSELECTG::IDD, pParent)
{
	//{{AFX_DATA_INIT(CSELECTG)
		// NOTE: the ClassWizard will add member initialization here
	//}}AFX_DATA_INIT
}


void CSELECTG::DoDataExchange(CDataExchange* pDX)
{
	CDialog::DoDataExchange(pDX);
	//{{AFX_DATA_MAP(CSELECTG)
		// NOTE: the ClassWizard will add DDX and DDV calls here
	//}}AFX_DATA_MAP
}


BEGIN_MESSAGE_MAP(CSELECTG, CDialog)
	//{{AFX_MSG_MAP(CSELECTG)
	ON_BN_CLICKED(IDC_BUTTON1, OnSELECT1)

	ON_BN_CLICKED(IDC_BUTTON2, OnSelect3)

	ON_LBN_DBLCLK(IDC_LIST1, OnDblclkList1)
	ON_LBN_DBLCLK(IDC_LIST2, OnDblclkList2)
	//}}AFX_MSG_MAP
END_MESSAGE_MAP()

/////////////////////////////////////////////////////////////////////////////
// CSELECTG message handlers

BOOL CSELECTG::OnInitDialog() 
{
	CDialog::OnInitDialog();
	CListBox* pListBox=(CListBox*)this->GetDlgItem(IDC_LIST1);
    _variant_t strQuery,Holder;
	strQuery="select *from gname";
	theApp.ADOExecute(theApp.m_pADOSet, strQuery);
    iCount=theApp.m_pADOSet->GetRecordCount();
	 if (iCount>0)
	{
		 theApp.m_pADOSet->MoveFirst();
    for (int i=0;i<iCount;i++)
	{Holder=theApp.m_pADOSet->GetCollect("groupname");
	strText=(Holder.vt==VT_NULL?"":(char*)(_bstr_t)Holder);
	pListBox->AddString(strText);
    theApp.m_pADOSet->MoveNext();
	}
    
	}
  
	// TODO: Add extra initialization here
	
	return TRUE;  // return TRUE unless you set the focus to a control
	              // EXCEPTION: OCX Property Pages should return FALSE
}

void CSELECTG::OnOK() 
{
	// TODO: Add extra validation here
	 CListBox* pListBox2=(CListBox*)this->GetDlgItem(IDC_LIST2);
     
	 int iCount;
	
	 CString SQL;
	_variant_t strQuery,Holder;
	 int count=pListBox2->GetCount();

	 if(count <=0)
	 {
	   AfxMessageBox("请选择用户组!");
	   return;
	 }
	 else if(count >6)
	 {
		 AfxMessageBox("每次最多只能同时选择六个用户组!");
		 return;
	 }
	 else 
	 {
		 for (int i=0;i<count;i++)
		 {	  pListBox2->GetText(i,theApp.group[i]);
		      SQL=SQL+" "+theApp.group[i];
		 }

	 }

	strQuery="select *from guser where gname in('"+theApp.group[0]+"','"+theApp.group[1]+"','"+theApp.group[2]+"','"+theApp.group[3]+"','"+theApp.group[4]+"','"+theApp.group[5]+"')";
	theApp.ADOExecute(theApp.m_pADOSet, strQuery);
    iCount=theApp.m_pADOSet->GetRecordCount();
	 if (iCount>0)
	 {
	    theApp.m_pADOSet->MoveFirst();
       for ( int i=1;i<=iCount;i++)
	   {Holder=theApp.m_pADOSet->GetCollect("gmobilenumber");
       theApp.mobile[i]=(Holder.vt==VT_NULL?"":(char*)(_bstr_t)Holder);
        theApp.m_pADOSet->MoveNext();
	   }
    
	 }
    else 
	{
       AfxMessageBox("您选择的用户组还未添加号码!");
	   return;
    }
	this->pSBSMS->view(SQL,iCount);
   
	CDialog::OnOK();

}

void CSELECTG::OnSELECT1() 
{
	 CListBox* pListBox=(CListBox*)this->GetDlgItem(IDC_LIST1);
	 CListBox* pListBox2=(CListBox*)this->GetDlgItem(IDC_LIST2);

	 int i=pListBox->GetCurSel();
		if(i<0)
	{
	   AfxMessageBox("请选择一个用户组!");
	   return;
	}
	 
	  pListBox->GetText(i,ExamNo);
	  
      pListBox2->AddString(ExamNo);
	  pListBox->DeleteString(i);
	// TODO: Add your control notification handler code here
	
}


void CSELECTG::OnSelect3() 
{
	
	 CListBox* pListBox=(CListBox*)this->GetDlgItem(IDC_LIST1);
	 CListBox* pListBox2=(CListBox*)this->GetDlgItem(IDC_LIST2);
	 int i=pListBox2->GetCurSel();
		if(i<0)
	{
	   AfxMessageBox("请选择一个用户组!");
	   return;
	}

	  pListBox2->GetText(i,ExamNo);
	   pListBox->AddString(ExamNo);
      pListBox2->DeleteString(i);
	// TODO: Add your control notification handler code here
	
}



void CSELECTG::OnDblclkList1() 
{OnSELECT1() ;
	// TODO: Add your control notification handler code here
	
}

void CSELECTG::OnDblclkList2() 
{
OnSelect3()  ;	// TODO: Add your control notification handler code here
	
}

⌨️ 快捷键说明

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