📄 audioctl.cpp
字号:
// AUDIOCtl.cpp : Implementation of the CAUDIOCtrl ActiveX Control class.
#include "stdafx.h"
#include "AUDIO.h"
#include "AUDIOCtl.h"
#include "AUDIOPpg.h"
#ifdef _DEBUG
#define new DEBUG_NEW
#undef THIS_FILE
static char THIS_FILE[] = __FILE__;
#endif
IMPLEMENT_DYNCREATE(CAUDIOCtrl, COleControl)
/////////////////////////////////////////////////////////////////////////////
// Message map
BEGIN_MESSAGE_MAP(CAUDIOCtrl, COleControl)
//{{AFX_MSG_MAP(CAUDIOCtrl)
// NOTE - ClassWizard will add and remove message map entries
// DO NOT EDIT what you see in these blocks of generated code !
//}}AFX_MSG_MAP
ON_OLEVERB(AFX_IDS_VERB_PROPERTIES, OnProperties)
END_MESSAGE_MAP()
/////////////////////////////////////////////////////////////////////////////
// Dispatch map
BEGIN_DISPATCH_MAP(CAUDIOCtrl, COleControl)
//{{AFX_DISPATCH_MAP(CAUDIOCtrl)
DISP_FUNCTION(CAUDIOCtrl, "Begintalk", Begintalk, VT_EMPTY, VTS_NONE)
DISP_FUNCTION(CAUDIOCtrl, "Endtalk", Endtalk, VT_EMPTY, VTS_NONE)
DISP_FUNCTION(CAUDIOCtrl, "SetIpPort", SetIpPort, VT_EMPTY, VTS_BSTR VTS_BSTR VTS_I4 VTS_I4)
//}}AFX_DISPATCH_MAP
DISP_FUNCTION_ID(CAUDIOCtrl, "AboutBox", DISPID_ABOUTBOX, AboutBox, VT_EMPTY, VTS_NONE)
END_DISPATCH_MAP()
/////////////////////////////////////////////////////////////////////////////
// Event map
BEGIN_EVENT_MAP(CAUDIOCtrl, COleControl)
//{{AFX_EVENT_MAP(CAUDIOCtrl)
// NOTE - ClassWizard will add and remove event map entries
// DO NOT EDIT what you see in these blocks of generated code !
//}}AFX_EVENT_MAP
END_EVENT_MAP()
/////////////////////////////////////////////////////////////////////////////
// Property pages
// TODO: Add more property pages as needed. Remember to increase the count!
BEGIN_PROPPAGEIDS(CAUDIOCtrl, 1)
PROPPAGEID(CAUDIOPropPage::guid)
END_PROPPAGEIDS(CAUDIOCtrl)
/////////////////////////////////////////////////////////////////////////////
// Initialize class factory and guid
IMPLEMENT_OLECREATE_EX(CAUDIOCtrl, "AUDIO.AUDIOCtrl.1",
0xb1541b0c, 0x6629, 0x4ecb, 0xba, 0xb5, 0x59, 0xa7, 0x62, 0x7a, 0x57, 0x7d)
/////////////////////////////////////////////////////////////////////////////
// Type library ID and version
IMPLEMENT_OLETYPELIB(CAUDIOCtrl, _tlid, _wVerMajor, _wVerMinor)
/////////////////////////////////////////////////////////////////////////////
// Interface IDs
const IID BASED_CODE IID_DAUDIO =
{ 0x230d0d27, 0xa129, 0x46c1, { 0x9c, 0xa6, 0xc8, 0x2e, 0xfa, 0xc2, 0xce, 0x3d } };
const IID BASED_CODE IID_DAUDIOEvents =
{ 0x8012ff32, 0x10d0, 0x4d2b, { 0xbe, 0x95, 0xd5, 0xc7, 0x81, 0xd7, 0x66, 0xc5 } };
/////////////////////////////////////////////////////////////////////////////
// Control type information
static const DWORD BASED_CODE _dwAUDIOOleMisc =
OLEMISC_ACTIVATEWHENVISIBLE |
OLEMISC_SETCLIENTSITEFIRST |
OLEMISC_INSIDEOUT |
OLEMISC_CANTLINKINSIDE |
OLEMISC_RECOMPOSEONRESIZE;
IMPLEMENT_OLECTLTYPE(CAUDIOCtrl, IDS_AUDIO, _dwAUDIOOleMisc)
/////////////////////////////////////////////////////////////////////////////
// CAUDIOCtrl::CAUDIOCtrlFactory::UpdateRegistry -
// Adds or removes system registry entries for CAUDIOCtrl
BOOL CAUDIOCtrl::CAUDIOCtrlFactory::UpdateRegistry(BOOL bRegister)
{
// TODO: Verify that your control follows apartment-model threading rules.
// Refer to MFC TechNote 64 for more information.
// If your control does not conform to the apartment-model rules, then
// you must modify the code below, changing the 6th parameter from
// afxRegApartmentThreading to 0.
if (bRegister)
return AfxOleRegisterControlClass(
AfxGetInstanceHandle(),
m_clsid,
m_lpszProgID,
IDS_AUDIO,
IDB_AUDIO,
afxRegApartmentThreading,
_dwAUDIOOleMisc,
_tlid,
_wVerMajor,
_wVerMinor);
else
return AfxOleUnregisterClass(m_clsid, m_lpszProgID);
}
/////////////////////////////////////////////////////////////////////////////
// CAUDIOCtrl::CAUDIOCtrl - Constructor
CAUDIOCtrl::CAUDIOCtrl()
{
InitializeIIDs(&IID_DAUDIO, &IID_DAUDIOEvents);
// TODO: Initialize your control's instance data here.
}
/////////////////////////////////////////////////////////////////////////////
// CAUDIOCtrl::~CAUDIOCtrl - Destructor
CAUDIOCtrl::~CAUDIOCtrl()
{
// TODO: Cleanup your control's instance data here.
}
/////////////////////////////////////////////////////////////////////////////
// CAUDIOCtrl::OnDraw - Drawing function
void CAUDIOCtrl::OnDraw(
CDC* pdc, const CRect& rcBounds, const CRect& rcInvalid)
{
// TODO: Replace the following code with your own drawing code.
if (!pdc)
return;
CBitmap *pOldBitmap;
CBitmap bitmap;
CDC ppdc;
ppdc.CreateCompatibleDC(pdc);
bitmap.LoadBitmap(IDB_BITMAP);
pOldBitmap=ppdc.SelectObject(&bitmap);
pdc->BitBlt(0,0,rcBounds.Width(),rcBounds.Height(),&ppdc,0,0,SRCCOPY);
ppdc.SelectObject(pOldBitmap);
}
/////////////////////////////////////////////////////////////////////////////
// CAUDIOCtrl::DoPropExchange - Persistence support
void CAUDIOCtrl::DoPropExchange(CPropExchange* pPX)
{
ExchangeVersion(pPX, MAKELONG(_wVerMinor, _wVerMajor));
COleControl::DoPropExchange(pPX);
// TODO: Call PX_ functions for each persistent custom property.
}
/////////////////////////////////////////////////////////////////////////////
// CAUDIOCtrl::OnResetState - Reset control to default state
void CAUDIOCtrl::OnResetState()
{
COleControl::OnResetState(); // Resets defaults found in DoPropExchange
// TODO: Reset any other control state here.
}
/////////////////////////////////////////////////////////////////////////////
// CAUDIOCtrl::AboutBox - Display an "About" box to the user
void CAUDIOCtrl::AboutBox()
{
CDialog dlgAbout(IDD_ABOUTBOX_AUDIO);
dlgAbout.DoModal();
}
/////////////////////////////////////////////////////////////////////////////
// CAUDIOCtrl message handlers
void CAUDIOCtrl::Begintalk()
{
// TODO: Add your dispatch handler code here
m_talk.Play();
}
void CAUDIOCtrl::Endtalk()
{
// TODO: Add your dispatch handler code here
m_talk.End();
}
void CAUDIOCtrl::SetIpPort(LPCTSTR Password, LPCTSTR Usip, long Usport, long Myport)
{
// TODO: Add your dispatch handler code here
CString mPass = Password;
CString mIp = Usip;
if(mPass != "20080706372188")
AfxMessageBox("未注册版本,要正常使用此控件,请与 王嘉都 联系:TEL:13488099881 ");
m_talk.Setip_port(mIp,Usport,Myport);
}
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -