📄 importrobot.cpp
字号:
// ImportRobot.cpp
#include "stdafx.h"
#import "..\RobotServer\_RobotServer.tlb" \
no_namespace named_guids
int _tmain(int argc, _TCHAR* argv[])
{
CoInitialize(NULL);
try
{
IRobotPtr p(CLSID_CRobot);
p->PutBatteryLife(123);
long bl = p->GetBatteryLife();
char buf[32];
wsprintf(buf, "BatteryLife = %d", bl);
MessageBox(0, buf, "Msg", 0);
p->Speak(L"Hello World");
}
catch(_com_error& e)
{
MessageBox(0, e.ErrorMessage(), 0, 0);
}
CoUninitialize();
return 0;
}
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -