资源简介

微信PC版协议实现,本人亲自调试通过,不会出现1100的错误,值得你做二次开发: 1.获取服务器分配的一个唯一会话ID 2.通过会话ID获得随机登录二维码 3.轮询手机端是否已经扫描二维码并确认 4.访问登录地址,获得uin和sid 5.初始化微信信息获得当前用户的信息 6.获得所有的好友列表 7.保持与服务器的信息同步 8.获得别人发来的消息 9.向用户发送消息

资源截图

代码片段和文件信息

using System;
using System.Collections.Generic;
using System.ComponentModel;
using System.Data;
using System.Drawing;
using System.Text;
using System.Windows.Forms;
using System.Drawing.Drawing2D;
using WeChat.NET.HTTP;
using System.Net;
using System.Linq;
using Newtonsoft.Json.Linq;

namespace WeChat.NET
{
    /// 
    /// 微信登录窗体
    /// 

    public partial class frmLogin : Form
    {
        public frmLogin()
        {
            InitializeComponent();
        }
        /// 
        /// 关闭按钮
        /// 

        /// 
        /// 
        private void picClose_Click(object sender EventArgs e)
        {
            Close();
        }
        /// 
        /// 窗体加载
        /// 

        /// 
        /// 
        private void frmLogin_Load(object sender EventArgs e)
        {
            DoLogin();
        }

        /// 
        /// 返回二维码界面 重新加载二维码
        /// 

        /// 
        /// 
        private void linkReturn_linkClicked(object sender linkLabellinkClickedEventArgs e)
        {
            linkReturn.Visible = false;
            DoLogin();
        }


        /// 
        /// 登录相关逻辑
        /// 

        private void DoLogin()
        {
            picQRCode.Image = null;
            picQRCode.SizeMode = PictureBoxSizeMode.Zoom;
            lblTip.Text = “手机微信扫一扫以登录“;
            ((Action)(delegate()
            {
                //异步加载二维码
                LoginService ls = new LoginService();
                Image qrcode = ls.GetQRCode();
                if (qrcode != null)
                {
                    this.BeginInvoke((Action)delegate()
                    {
                        picQRCode.Image = qrcode;
                    });

                    object login_result = null;
                    while (true)  //循环判断手机扫面二维码结果
                    {
                        login_result = ls.LoginCheck();
                        if (login_result is Image) //已扫描 未登录
                        {
                            this.BeginInvoke((Action)delegate()
                            {
                                lblTip.Text = “请点击手机上登录按钮“;
                                picQRCode.SizeMode = PictureBoxSizeMode.CenterImage;  //显示头像
                                picQRCode.Image = login_result as Image;
                                linkReturn.Visible = true;
                            });
                        }
                        if (login_result is string)  //已完成登录
                        {
                            //访问登录跳转URL
                            ls.GetSidUid(login_result as string);
                          //  WXService wxs = new WXService();
                           // Jobject init_result = wxs.WxInit();
                            //打开主界面
      

 属性            大小     日期    时间   名称
----------- ---------  ---------- -----  ----

    .......       378  2015-10-30 17:59  WeChat.NET-master\WeChat.NET-master\.gitattributes

    .......       574  2015-10-30 17:59  WeChat.NET-master\WeChat.NET-master\.gitignore

    ..A..H.     89600  2017-11-07 15:39  WeChat.NET-master\WeChat.NET-master\.vs\WeChat.NET\v14\.suo

    .......    146814  2015-10-30 17:59  WeChat.NET-master\WeChat.NET-master\assert\9.png

    .......       745  2015-10-30 17:59  WeChat.NET-master\WeChat.NET-master\assert\back.png

    .......       373  2015-10-30 17:59  WeChat.NET-master\WeChat.NET-master\assert\female.png

    .......       713  2015-10-30 17:59  WeChat.NET-master\WeChat.NET-master\assert\info.png

    .......       365  2015-10-30 17:59  WeChat.NET-master\WeChat.NET-master\assert\male.png

    .......     17712  2015-10-30 17:59  WeChat.NET-master\WeChat.NET-master\assert\p1.png

    .......     23839  2015-10-30 17:59  WeChat.NET-master\WeChat.NET-master\assert\p2.png

    .......     29857  2015-10-30 17:59  WeChat.NET-master\WeChat.NET-master\assert\p3.png

    .......     30808  2015-10-30 17:59  WeChat.NET-master\WeChat.NET-master\assert\p4.png

    .......     22813  2015-10-30 17:59  WeChat.NET-master\WeChat.NET-master\assert\p5.png

    .......     22793  2015-10-30 17:59  WeChat.NET-master\WeChat.NET-master\assert\p6.png

    .......     40760  2015-10-30 17:59  WeChat.NET-master\WeChat.NET-master\assert\p7.png

    .......    148754  2015-10-30 17:59  WeChat.NET-master\WeChat.NET-master\assert\splash.jpg

    .......      1474  2015-10-30 17:59  WeChat.NET-master\WeChat.NET-master\README.MD

    .......       141  2015-10-30 17:59  WeChat.NET-master\WeChat.NET-master\WeChat.NET\app.config

    .......    862208  2015-10-30 17:59  WeChat.NET-master\WeChat.NET-master\WeChat.NET\bin\Debug\CFLite.dll

    .......  13911552  2015-10-30 17:59  WeChat.NET-master\WeChat.NET-master\WeChat.NET\bin\Debug\icudt40.dll

    .......   1245184  2015-10-30 17:59  WeChat.NET-master\WeChat.NET-master\WeChat.NET\bin\Debug\icuin40.dll

    .......   1079296  2015-10-30 17:59  WeChat.NET-master\WeChat.NET-master\WeChat.NET\bin\Debug\icuuc40.dll

    .......   1059328  2015-10-30 17:59  WeChat.NET-master\WeChat.NET-master\WeChat.NET\bin\Debug\javascriptCore.dll

    .......    225280  2015-10-30 17:59  WeChat.NET-master\WeChat.NET-master\WeChat.NET\bin\Debug\libcurl.dll

    .......   1017344  2015-10-30 17:59  WeChat.NET-master\WeChat.NET-master\WeChat.NET\bin\Debug\libeay32.dll

    .......     61952  2015-10-30 17:59  WeChat.NET-master\WeChat.NET-master\WeChat.NET\bin\Debug\libexslt.dll

    .......   1919488  2015-10-30 17:59  WeChat.NET-master\WeChat.NET-master\WeChat.NET\bin\Debug\libxml2.dll

    .......    170496  2015-10-30 17:59  WeChat.NET-master\WeChat.NET-master\WeChat.NET\bin\Debug\libxslt.dll

     文件     510976  2015-10-30 17:59  WeChat.NET-master\WeChat.NET-master\WeChat.NET\bin\Debug\Newtonsoft.Json.dll

    .......    121344  2015-10-30 17:59  WeChat.NET-master\WeChat.NET-master\WeChat.NET\bin\Debug\objc.dll

............此处省略107个文件信息

评论

共有 条评论