📄 skypephone.cpp
字号:
#include "stdafx.h"
#include "Skype.h"
#include "Client.h"
#include "User.h"
#include "UserCollection.h"
#include "SkypePhone.h"
#include "Call.h"
#include <afxpriv.h> // for AfxLoadString
#include "Resource.h"
CSkypePhone::CSkypePhone()
{
pSkype=NULL;
}
CSkypePhone::~CSkypePhone()
{
pSkype=NULL;
}
void CSkypePhone::OpenSkype(void)
{
class CClient SkypeClient;
SkypeClient=pSkype->GetClient();
if(!SkypeClient.GetIsRunning())
SkypeClient.Start(TRUE, TRUE);
pSkype->Attach(5, FALSE);
}
UINT CSkypePhone::GetUsersum()
{
CUserCollection Users;
Users=pSkype->GetFriends();
return Users.GetCount();
}
void CSkypePhone::DisplayUser(long index, CDC *pdc, int width, int height)
{
CUser User;
CUserCollection Users;
Users=pSkype->GetFriends();
if(index > Users.GetCount())
index=Users.GetCount();
User=Users.GetItem(index);
// TRACE("FullName: %s \n",User.GetFullName());
// TRACE("Handle: %s \n",User.GetHandle());
RECT Rect1;
CString str;
Rect1.left=0;
Rect1.top=0;
Rect1.right=width;
Rect1.bottom=0;
str=User.GetFullName();
if(str!="")
{
str+="\n";
}
str +=User.GetHandle();
pdc->DrawText(str, &Rect1, DT_CENTER|DT_WORDBREAK|DT_CALCRECT);
if(Rect1.bottom<height-16)
{
Rect1.top=(height-16-Rect1.bottom)/2;
Rect1.bottom+=Rect1.top;
}
Rect1.right=width;
pdc->DrawText(str, &Rect1, DT_CENTER|DT_WORDBREAK);
Rect1.top=height-16;
Rect1.bottom=height;
Rect1.left=0;
Rect1.right=width;
TCHAR buff[64];
memset(buff, 0, sizeof(buff));
AfxLoadString(IDS_CALL, buff);
pdc->DrawText(buff, &Rect1, DT_LEFT);
memset(buff, 0, sizeof(buff));
AfxLoadString(IDS_RETURN, buff);
pdc->DrawText(buff, &Rect1, DT_RIGHT);
}
CCall CSkypePhone::CallUser(long index)
{
CUser User;
CUserCollection Users;
Users=pSkype->GetFriends();
User=Users.GetItem(index);
return (pSkype->PlaceCall(User.GetHandle(), "", "", ""));
}
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -