📄 dmsdlg.cpp
字号:
strcat(bufsend,strSongName); //歌曲的名称
sprintf(g_Data.pack_body,bufsend);
}
else
{
sprintf(g_Data.pack_body,"0");
}
}
catch(_com_error e)
{
}
break;
case 10003:
try
{
NextSongId=atoi(bStr[3])+1;
sprintf(strNextSongId,"%d",NextSongId);
command="SELECT * FROM NEWMQJ where type1= '";
command+=bStr[1];
command+="' and type2= '";
command+=bStr[2];
command+="' and type3= '";
command+=strNextSongId;
command+="'";
query = command;
m_pRecordset.CreateInstance("ADODB.Recordset");
m_pRecordset->Open(query,_variant_t((IDispatch*)m_pConnection,true),adOpenStatic,adLockOptimistic,adCmdText);
nCount2=m_pRecordset->GetRecordCount();
sprintf(g_Data.pack_body,"");
strcpy(bufsend, "");
if(nCount2!=0)
{
strcpy(bufsend, strNextSongId); //歌曲id
strcat(bufsend,"|");
//strcat(bufsend,bStr[1]); //歌曲的名称
strSongName = (LPCTSTR)(_bstr_t)m_pRecordset->GetCollect("name");//歌曲的名称
strcat(bufsend,strSongName); //歌曲的名称
sprintf(g_Data.pack_body,bufsend);
}
else
{
sprintf(g_Data.pack_body,"0");
}
}
catch(_com_error e)
{
}
break;
case 10004:
try
{
NextSongId=atoi(bStr[3])+1;
sprintf(strNextSongId,"%d",NextSongId);
command="SELECT * FROM NEWMQJ where type1= '";
command+=bStr[1];
command+="' and type2= '";
command+=bStr[2];
command+="' and type3= '";
command+=strNextSongId;
command+="'";
query = command;
m_pRecordset.CreateInstance("ADODB.Recordset");
m_pRecordset->Open(query,_variant_t((IDispatch*)m_pConnection,true),adOpenStatic,adLockOptimistic,adCmdText);
nCount2=m_pRecordset->GetRecordCount();
sprintf(g_Data.pack_body,"");
strcpy(bufsend, "");
if(nCount2!=0)
{
strcpy(bufsend, strNextSongId); //歌曲id
strcat(bufsend,"|");
//strcat(bufsend,bStr[1]); //歌曲的名称
strSongName = (LPCTSTR)(_bstr_t)m_pRecordset->GetCollect("name");//歌曲的名称
strcat(bufsend,strSongName); //歌曲的名称
sprintf(g_Data.pack_body,bufsend);
}
else
{
sprintf(g_Data.pack_body,"0");
}
}
catch(_com_error e)
{
}
break;
case 10005:
try
{
NextSongId=atoi(bStr[3])+1;
sprintf(strNextSongId,"%d",NextSongId);
command="SELECT * FROM NEWMQJ where type1= '";
command+=bStr[1];
command+="' and type2= '";
command+=bStr[2];
command+="' and type3= '";
command+=strNextSongId;
command+="'";
query = command;
m_pRecordset.CreateInstance("ADODB.Recordset");
m_pRecordset->Open(query,_variant_t((IDispatch*)m_pConnection,true),adOpenStatic,adLockOptimistic,adCmdText);
nCount2=m_pRecordset->GetRecordCount();
sprintf(g_Data.pack_body,"");
strcpy(bufsend, "");
if(nCount2!=0)
{
strcpy(bufsend, strNextSongId); //歌曲id
strcat(bufsend,"|");
//strcat(bufsend,bStr[1]); //歌曲的名称
strSongName = (LPCTSTR)(_bstr_t)m_pRecordset->GetCollect("name");//歌曲的名称
strcat(bufsend,strSongName); //歌曲的名称
sprintf(g_Data.pack_body,bufsend);
}
else
{
sprintf(g_Data.pack_body,"0");
}
}
catch(_com_error e)
{
}
break;
case 10006:
try
{
NextSongId=atoi(bStr[0]);
sprintf(strNextSongId,"%d",NextSongId);
command="SELECT mobile FROM olduser where mobile= '";
command+=bStr[0];
command+="'";
query = command;
m_pRecordset.CreateInstance("ADODB.Recordset");
m_pRecordset->Open(query,_variant_t((IDispatch*)m_pConnection,true),adOpenStatic,adLockOptimistic,adCmdText);
nCount2=m_pRecordset->GetRecordCount();
sprintf(g_Data.pack_body,"");
strcpy(bufsend, "");
if(nCount2!=0)
{
sprintf(g_Data.pack_body,"1");
//插入数据库播打记录
//*******
insertcommand="insert into BDUSER(mobile,datetime,callmobile) values('";
insertcommand+=bStr[0];
insertcommand+="',getdate(),'125905860')";
m_pConnection->Execute((LPCTSTR)insertcommand,&Affected,adCmdUnknown);
//*********
}
else
{
sprintf(g_Data.pack_body,"2");
//插入数据库播打记录
//插入数据库播打记录
//*******
insertcommand="insert into BDUSER(mobile,datetime,callmobile) values('";
insertcommand+=bStr[0];
insertcommand+="',getdate(),'125905860')";
m_pConnection->Execute((LPCTSTR)insertcommand,&Affected,adCmdUnknown);
//*********
}
}
catch(_com_error e)
{
}
break;
case 10007:
try
{
NextSongId=atoi(bStr[3])+1;
sprintf(strNextSongId,"%d",NextSongId);
command="SELECT * FROM MQJ where type1= '";
command+=bStr[1];
command+="' and type2= '";
command+=bStr[2];
command+="' and type3= '";
command+=strNextSongId;
command+="'";
query = command;
m_pRecordset.CreateInstance("ADODB.Recordset");
m_pRecordset->Open(query,_variant_t((IDispatch*)m_pConnection,true),adOpenStatic,adLockOptimistic,adCmdText);
nCount2=m_pRecordset->GetRecordCount();
sprintf(g_Data.pack_body,"");
strcpy(bufsend, "");
if(nCount2!=0)
{
strcpy(bufsend, strNextSongId); //歌曲id
strcat(bufsend,"|");
//strcat(bufsend,bStr[1]); //歌曲的名称
strSongName = (LPCTSTR)(_bstr_t)m_pRecordset->GetCollect("name");//歌曲的名称
strcat(bufsend,strSongName); //歌曲的名称
sprintf(g_Data.pack_body,bufsend);
}
else
{
sprintf(g_Data.pack_body,"0");
}
}
catch(_com_error e)
{
}
break;
case 10008:
try
{
NextSongId=atoi(bStr[3])+1;
sprintf(strNextSongId,"%d",NextSongId);
command="SELECT * FROM MQJ where type1= '";
command+=bStr[1];
command+="' and type2= '";
command+=bStr[2];
command+="' and type3= '";
command+=strNextSongId;
command+="'";
query = command;
m_pRecordset.CreateInstance("ADODB.Recordset");
m_pRecordset->Open(query,_variant_t((IDispatch*)m_pConnection,true),adOpenStatic,adLockOptimistic,adCmdText);
nCount2=m_pRecordset->GetRecordCount();
sprintf(g_Data.pack_body,"");
strcpy(bufsend, "");
if(nCount2!=0)
{
strcpy(bufsend, strNextSongId); //歌曲id
strcat(bufsend,"|");
//strcat(bufsend,bStr[1]); //歌曲的名称
strSongName = (LPCTSTR)(_bstr_t)m_pRecordset->GetCollect("name");//歌曲的名称
strcat(bufsend,strSongName); //歌曲的名称
sprintf(g_Data.pack_body,bufsend);
}
else
{
sprintf(g_Data.pack_body,"0");
}
}
catch(_com_error e)
{
}
break;
case 10009:
try
{
NextSongId=atoi(bStr[3])+1;
sprintf(strNextSongId,"%d",NextSongId);
command="SELECT * FROM MQJ where type1= '";
command+=bStr[1];
command+="' and type2= '";
command+=bStr[2];
command+="' and type3= '";
command+=strNextSongId;
command+="'";
query = command;
m_pRecordset.CreateInstance("ADODB.Recordset");
m_pRecordset->Open(query,_variant_t((IDispatch*)m_pConnection,true),adOpenStatic,adLockOptimistic,adCmdText);
nCount2=m_pRecordset->GetRecordCount();
sprintf(g_Data.pack_body,"");
strcpy(bufsend, "");
if(nCount2!=0)
{
strcpy(bufsend, strNextSongId); //歌曲id
strcat(bufsend,"|");
//strcat(bufsend,bStr[1]); //歌曲的名称
strSongName = (LPCTSTR)(_bstr_t)m_pRecordset->GetCollect("name");//歌曲的名称
strcat(bufsend,strSongName); //歌曲的名称
sprintf(g_Data.pack_body,bufsend);
}
else
{
sprintf(g_Data.pack_body,"0");
}
}
catch(_com_error e)
{
}
break;
case 10010:
try
{
NextSongId=atoi(bStr[3])+1;
sprintf(strNextSongId,"%d",NextSongId);
command="SELECT * FROM MQJ where type1= '";
command+=bStr[1];
command+="' and type2= '";
command+=bStr[2];
command+="' and type3= '";
command+=strNextSongId;
command+="'";
query = command;
m_pRecordset.CreateInstance("ADODB.Recordset");
m_pRecordset->Open(query,_variant_t((IDispatch*)m_pConnection,true),adOpenStatic,adLockOptimistic,adCmdText);
nCount2=m_pRecordset->GetRecordCount();
sprintf(g_Data.pack_body,"");
strcpy(bufsend, "");
if(nCount2!=0)
{
strcpy(bufsend, strNextSongId); //歌曲id
strcat(bufsend,"|");
//strcat(bufsend,bStr[1]); //歌曲的名称
strSongName = (LPCTSTR)(_bstr_t)m_pRecordset->GetCollect("name");//歌曲的名称
strcat(bufsend,strSongName); //歌曲的名称
sprintf(g_Data.pack_body,bufsend);
}
else
{
sprintf(g_Data.pack_body,"0");
}
}
catch(_com_error e)
{
}
break;
case 10011:
try
{
NextSongId=atoi(bStr[3])+1;
sprintf(strNextSongId,"%d",NextSongId);
command="SELECT * FROM MQJ where type1= '";
command+=bStr[1];
command+="' and type2= '";
command+=bStr[2];
command+="' and type3= '";
command+=strNextSongId;
command+="'";
query = command;
m_pRecordset.CreateInstance("ADODB.Recordset");
m_pRecordset->Open(query,_variant_t((IDispatch*)m_pConnection,true),adOpenStatic,adLockOptimistic,adCmdText);
nCount2=m_pRecordset->GetRecordCount();
sprintf(g_Data.pack_body,"");
strcpy(bufsend, "");
if(nCount2!=0)
{
strcpy(bufsend, strNextSongId); //歌曲id
strcat(bufsend,"|");
//strcat(bufsend,bStr[1]); //歌曲的名称
strSongName = (LPCTSTR)(_bstr_t)m_pRecordset->GetCollect("name");//歌曲的名称
strcat(bufsend,strSongName); //歌曲的名称
sprintf(g_Data.pack_body,bufsend);
}
else
{
sprintf(g_Data.pack_body,"0");
}
}
catch(_com_error e)
{
}
break;
default:
break;
};
m_pRecordset->Close();
m_pRecordset.Release();
m_pConnection->Close();
m_pConnection.Release();
SendMsgFunc * fsend = (SendMsgFunc*)GetProcAddress(hModule, "VSPPSendMessage");
if(NULL == fsend)
{
::AfxMessageBox("Call VSPPSendMessage() failed");
return;
}
int iret = fsend( (unsigned char*)g_Data.IP, g_Data.port,g_Data.pack_head, g_Data.pack_body );
send++;
if(iret == 0)
{
str.Format("%d",send);
strcat(buf, g_Data.pack_body);
pDlg->GetDlgItem(IDC_SEND)->SetWindowText(str);
pDlg->GetDlgItem(IDC_EDIT_SENDP)->SetWindowText(buf);
}
memset(buf, '_', MAX_PACKET_LEN); // release..
buf[MAX_PACKET_LEN] = 0;
delete[] buf; buf = 0;
//LeaveCriticalSection(&dataCS);
}
void CDMSDlg::OnCancel()
{
try
{
// TODO: Add extra cleanup here
/* //释放与数据源的连接
if(m_pConnection->State == adStateOpen)
m_pConnection ->Close();
m_pConnection.Release();
if(m_pRecordset->State == adStateOpen)
m_pRecordset->Close();
m_pRecordset.Release();
*/
//释放线程句柄
end = true;
DWORD exitcode;
GetExitCodeThread(recvThread, &exitcode);
TerminateThread(recvThread,exitcode);
CloseHandle((void*)recvThread);
if(hModule) FreeLibrary(hModule);
CDialog::OnCancel();
}
catch(_com_error e)
{
::AfxMessageBox("End");
CDialog::OnCancel();
}
CDialog::OnCancel();
}
void CDMSDlg::OnButton2()
{
}
void CDMSDlg::OnButton4()
{
}
void CDMSDlg::OnButton1()
{
}
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -