This is the C++ + MFC implementation of Agora RTC SDK examples for Windows. Before making any changes, read ARCHITECTURE.md to understand the structural rules.
# Build using Visual Studio (from command line)
cd windows/APIExample
msbuild APIExample.sln /p:Configuration=Release /p:Platform=x64
# Or open in Visual Studio and build manually
start APIExample.slnConfigure your Agora App ID in APIExample/APIExample/CConfig.h and CConfig.cpp:
// CConfig.h
class CConfig {
public:
static const char* GetAppId() { return "<#YOUR_APP_ID#>"; }
static const char* GetToken(const char* channelName) { return "<#YOUR_TOKEN#>"; }
};Do NOT:
- Introduce C# or other languages — use C++ only
- Use WinForms or WPF — use MFC only
- Deviate from MFC naming conventions (
Cprefix for classes,m_prefix for members) - Use modern C++ patterns (lambdas, smart pointers) unless already present in the file being modified
- Forget to call
leaveChannel()andrelease()when closing an example - Update UI from background threads — always post messages to the main thread
- Share engine instances between examples — each example manages its own lifecycle
- Forget to implement
IAgoraRtcEngineEventHandlerfor event handling
All work must conform to the rules defined in ARCHITECTURE.md:
- Every example is a dialog class inheriting from
CDialogExorCDialog - Each example implements
IAgoraRtcEngineEventHandlerinterface - Each example manages its own Agora engine lifecycle
- Message handlers are defined via
BEGIN_MESSAGE_MAP/END_MESSAGE_MAP - All examples are registered in
CSceneDialog - Configuration is managed centrally via
CConfigclass
- Language is C++ — do not introduce C# or other languages
- UI framework is MFC — do not introduce WinForms or WPF
- Use MFC conventions:
Cprefix for classes,m_prefix for member variables - Use message map pattern for event handling — do not introduce modern C++ patterns unless they already exist in the file being modified
- Match the code style, naming, and patterns of existing examples
Each example may contain a SKILL.md file in its folder. When working on or referencing a specific example:
- Check whether a
SKILL.mdexists in that example's directory - If it exists, read it before making changes — it describes the API usage, call flow, and known constraints
- If it does not exist, one will be created in the future; proceed using the source code as the reference
SKILL.md location pattern: APIExample/APIExample/[Basic|Advanced]/<ExampleName>/SKILL.md
For broader tasks, use the skills in .agent/skills/:
| Task | Skill | When to use |
|---|---|---|
| Add or modify an example | .agent/skills/upsert-case/ |
Need to create a new API demo or update an existing one |
| Code review | .agent/skills/review-case/ |
Review example code for lifecycle, thread safety, and convention compliance |