Skip to content

Commit

Permalink
Updates
Browse files Browse the repository at this point in the history
  • Loading branch information
saudsami committed Jul 4, 2024
1 parent d524b19 commit 837d592
Showing 1 changed file with 25 additions and 8 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -17,6 +17,7 @@ A complete code sample that implements the basic process of real-time interactio
#include <string>
// Include relevant header files
#include <IAgoraRtcEngine.h>
using namespace agora;
using namespace agora::rtc;
using namespace agora::media;
Expand All @@ -29,9 +30,7 @@ using namespace agora::media::base;
#define EID_USER_OFFLINE 0x00000004
// Define CAgoraQuickStartRtcEngineEventHandler class to handle user joining, leaving channel callbacks
class CAgoraQuickStartRtcEngineEventHandler
: public IRtcEngineEventHandler
{
class CAgoraQuickStartRtcEngineEventHandler : public IRtcEngineEventHandler {
public:
// Set the handle of the message receiving window
void SetMsgReceiver(HWND hWnd) { m_hMsgHanlder = hWnd; }
Expand Down Expand Up @@ -70,7 +69,6 @@ class CAgoraQuickStartDlg : public CDialog
// Construction
public:
CAgoraQuickStartDlg(CWnd* pParent = nullptr); // Standard constructor
virtual ~CAgoraQuickStartDlg();
// Dialog Data
Expand All @@ -88,7 +86,6 @@ public:
protected:
HICON m_hIcon;
CStatic m_staRemote;
CStatic m_staLocal;
CEdit m_edtChannelName;
Expand Down Expand Up @@ -234,7 +231,27 @@ void CAgoraQuickStartDlg::OnSysCommand(UINT nID, LPARAM lParam) {
CDialog::OnSysCommand(nID, lParam);
}
}
// If the dialog box has a minimize button, the framework should draw the icon
// If you add a minimize button to the dialog box, you need the following code
// to draw the icon. For MFC applications using the document/view model, this is done automatically by the framework
void CAgoraQuickStartDlg::OnPaint() {
if (IsIconic()) {
CPaintDC dc(this);
// Device context for drawing
SendMessage(WM_ICONERASEBKGND, reinterpret_cast<WPARAM>(dc.GetSafeHdc()),0);
// Center the icon in the 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();
}
}
// This function is called by the framework to obtain the cursor when the user drags the minimized window
HCURSOR CAgoraQuickStartDlg::OnQueryDragIcon() {
return static_cast<HCURSOR>(m_hIcon);
Expand Down Expand Up @@ -278,15 +295,15 @@ void CAgoraQuickStartDlg::OnBnClickedBtnJoin() {
m_rtcEngine->startPreview();
}
void CAgoraQuickStartDlg::OnBnClickedBtnLeave() {
// Stop local video preview
m_rtcEngine->stopPreview();
// Leave the channel
m_rtcEngine->leaveChannel();
// Clear local view
VideoCanvas canvas;
canvas.uid = 0;
m_rtcEngine->setupLocalVideo(canvas);
m_remoteRender = false;
// Stop the preview
m_rtcEngine->startPreview();
}
LRESULT CAgoraQuickStartDlg::OnEIDJoinChannelSuccess(WPARAM wParam, LPARAM lParam) {
// Join channel success callback
Expand Down

0 comments on commit 837d592

Please sign in to comment.