下面是测试代码,只有通过MSN传送文件部分
CODE:
#include "stdafx.h"
#include
#include
#include "msgruaid.h" //这两个头文件就是接口的定义
#include "msgrua.h" //有兴趣的同学可以在网上找找(没找着可以找我要)
#include
int main(int argc, char* argv[])
{
IMessenger *pIMessenger = NULL; //a pointer to an IMessenger interface BSTR pbstrName, bstrFriendName;
IMessengerContact *MsnContact;
IMessengerContacts *MsnContacts;
IMessengerWindow *pIMsnWindow;
__MIDL___MIDL_itf_msgrua_0000_0002 dwStatus;
VARIANT vaTemp;
BSTR bstrFileName;
char *szOpenDlg;
char szMsnWindowsClass[] = "IMWindowClass";
char szButtonText[] = "打开(&O)";
HWND hWnd = NULL, hBtn = NULL;
DWORD dwControlId = 0;
char szCurDir[MAX_PATH], szBuf[MAX_PATH];
CoInitialize(0); //初始化COM库
CoCreateInstance(CLSID_Messenger, NULL, CLSCTX_ALL, IID_IMessenger, (void **)&pIMessenger); //创建一个实例
pIMessenger->get_MyContacts((IDispatch**)&MsnContacts); //取得好友列表
pIMessenger->get_Window((IDispatch**)&pIMsnWindow);
long nCount;
MsnContacts->get_Count(&nCount); //得到好友数
for (int i = 0; i <>Item(i, (IDispatch**)&MsnContact);
MsnContact->get_SigninName(&pbstrName); //账号
MsnContact->get_FriendlyName(&bstrFriendName); //签名
szOpenDlg = _com_util::ConvertBSTRToString(bstrFriendName);
MsnContact->get_Status(&dwStatus);
if (dwStatus == MISTATUS_ONLINE) //判断是否在线
{
GetCurrentDirectory(MAX_PATH, szCurDir);
%2
0 件のコメント:
コメントを投稿