1

我正在使用 c# 制作离线 WhatsApp 批量短信软件。我没有收到 WART 连接代码。错误是连接登录失败。该怎么办?谁能帮我吗?回复我。尽快。

我的编码如下:

using System;
using System.Collections.Generic;
using System.ComponentModel;
using System.Data;
using System.Drawing;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
using System.Windows.Forms;
using smsdemo1;
using WhatsAppApi;

namespace smsdemo1
{
    public partial class Form1 : Form
    {
        public Form1()
        {
            InitializeComponent();
        }

        private void btn_send_Click_Click(object sender, EventArgs e)
        {

            string from = "919999999999"; //(Enter Your Mobile Number)
            string to = txt_to.Text;
            string msg = txt_msg.Text;
            MessageBox.Show("1 st test");
            WhatsApp wa = new WhatsApp(from, "Password", "nickname", false, false);
            MessageBox.Show("2 st test");
            wa.OnConnectSuccess += () =>
            {
                MessageBox.Show("3 st test");
                MessageBox.Show("Connected to WhatsApp...");

                wa.OnLoginSuccess += (phonenumber, data) =>
                {
                    MessageBox.Show("4 st test");
                    wa.SendMessage(to, msg);
                    MessageBox.Show("Message Sent...");
                };
                wa.OnLoginFailed += (data) =>
                {
                    MessageBox.Show("Login Failed : {0} : ", data);
                };

                wa.Login();
            };
            wa.OnConnectFailed += (Exception) =>
            {
                MessageBox.Show("Connection Failed...");
            };
            wa.Connect();
            wa.SendMessage(to, msg);
            wa.Disconnect();

        }
    }
}
4

0 回答 0