| 网站首页 | 业界新闻 | 小组 | 威客 | 人才 | 下载频道 | 博客 | 代码贴 | 在线编程 | 编程论坛
欢迎加入我们,一同切磋技术
用户名:   
 
密 码:  
共有 2131 人关注过本帖
标题:c# api操作阿里旺旺的好友列表
只看楼主 加入收藏
细雨清风
Rank: 1
等 级:新手上路
帖 子:47
专家分:0
注 册:2007-12-11
结帖率:100%
收藏
 问题点数:0 回复次数:3 
c# api操作阿里旺旺的好友列表
我要操作阿里旺旺中的好友列表,例如打开指定好友的聊天对话框等,但是不知道为什么我往阿里旺旺好友列表里面SendMessage发送消息的时候返回值都是0 操作不成功,高手帮看看...

C# code

using System;
using System.Collections.Generic;
using
using System.Data;
using System.Drawing;
using System.Linq;
using System.Text;
using System.Windows.Forms;
using System.Threading;
using System.Runtime.InteropServices;
using Microsoft.Win32;
using System.Management;
using System.Configuration.Install;
using System.ServiceProcess;
namespace alwwhelp
{
    public partial class Form1 : Form
    {
        public Form1()
        {
            InitializeComponent();
        }

        public const UInt32 TV_FIRST = 0x4352;
        public const UInt32 TVGN_ROOT = 0x0000;
        public const UInt32 TVM_GETNEXTITEM = TV_FIRST + 10;
        public const UInt32 TVM_SETITEM = TV_FIRST + 13;
        public const UInt32 WM_USER = 0x0400;
        public const UInt32 TVM_SELECTITEM = WM_USER + 100;

       [DllImport("User32.dll", EntryPoint = "SendMessage")]
        private static extern UInt32 SendMessage(
        IntPtr hWnd,
        UInt32 Msg,
        UInt32 wParam,
        UInt32 lParam
        );

        #region Dll Import

        [DllImport("User32.dll", EntryPoint = "FindWindow")]
        private static extern IntPtr FindWindow(string lpClassName, string lpWindowName);

        [DllImport("user32.dll", EntryPoint = "FindWindowEx")] //找子窗体
        private static extern IntPtr FindWindowEx(IntPtr hwndParent, IntPtr hwndChildAfter, string lpszClass, string lpszWindow);

        #endregion

        private void button2_Click(object sender, EventArgs e)
        {
            IntPtr hwndCalc = FindWindow(null, "qzu274-阿里旺旺2009"); //查找阿里旺旺的句柄    qzu274-阿里旺旺2009--阿里旺旺登录成功后窗口标题
            IntPtr WorkingPage = new IntPtr(0);   //阿里旺旺下的WorkingPage子窗体
            IntPtr tabviewcontainer = new IntPtr(0);  //WorkingPage下的子窗体tabviewcontainer
            IntPtr contactlistpagecontainer = new IntPtr(0);//tabviewcontainer下的子窗体contactlistpagecontainer
            IntPtr contactlistpage = new IntPtr(0); //contactlistpagecontainer下的子窗体contactlistpage
            IntPtr gf = new IntPtr(0);//contactlistpage下的子窗体(好友窗体)
            IntPtr listview = new IntPtr(0);    //好友窗体下的树形窗体
            if (hwndCalc != IntPtr.Zero)
            {
                WorkingPage = FindWindowEx(hwndCalc, WorkingPage, "StandardWindow", "WorkingPage");   //获取WorkingPage句柄  
                tabviewcontainer = FindWindowEx(WorkingPage, tabviewcontainer, "StandardWindow", "tabviewcontainer"); //获取tabviewcontainer句柄
                contactlistpagecontainer = FindWindowEx(tabviewcontainer, contactlistpagecontainer, "StandardWindow", "contactlistpagecontainer");     //获取contactlistpagecontainer句柄
                contactlistpage = FindWindowEx(contactlistpagecontainer, contactlistpage, "StandardWindow", "contactlistpage");   //获取contactlistpage句柄
                gf = FindWindowEx(contactlistpage, gf, "StandardWindow", "好友");    //获取好友窗体句柄   
                listview = FindWindowEx(gf, listview, "WWUI.SuperListView", "");  //获取树形窗体句柄  
                if (listview != IntPtr.Zero)
                {
                    MessageBox.Show(listview.ToString());   //查看用户listview的句柄,这里可以查看到listview的句柄


                    // 这里有问题,不知道为什么返回值是0      

                    UInt32 rootHwnd = SendMessage(listview, TVM_GETNEXTITEM, TVGN_ROOT, 0x0);//获取树的根结点,也就是列表中第一个分类               
                    MessageBox.Show(rootHwnd.ToString());
                }
                else
                {
                    //未能获取句柄
                }
            }
        }
    }
}



我的思路是按照http://topic. 这里操作的,但是这里说阿里旺旺的好友控件是treeview 而我获得的阿里旺旺的好友控件却是“WWUI.SuperListView” ,请高手帮帮忙...
搜索更多相关主题的帖子: api 列表 好友 阿里旺旺 
2010-04-05 22:58
细雨清风
Rank: 1
等 级:新手上路
帖 子:47
专家分:0
注 册:2007-12-11
收藏
得分:0 
upup
2010-04-08 23:33
细雨清风
Rank: 1
等 级:新手上路
帖 子:47
专家分:0
注 册:2007-12-11
收藏
得分:0 
没人帮忙吗?
2010-04-08 23:33
细雨清风
Rank: 1
等 级:新手上路
帖 子:47
专家分:0
注 册:2007-12-11
收藏
得分:0 
高手在哪里啊???
2010-04-13 08:52
快速回复:c# api操作阿里旺旺的好友列表
数据加载中...
 
   



关于我们 | 广告合作 | 编程中国 | 清除Cookies | TOP | 手机版

编程中国 版权所有,并保留所有权利。
Powered by Discuz, Processed in 0.018441 second(s), 8 queries.
Copyright©2004-2024, BCCN.NET, All Rights Reserved