自己写的一个小程序,用来自动登录CSDN网站,并回复“程序人生”板块第一篇帖子。发下源码,大家有什么好的建议,欢迎留言。
点击这里,可以直接下载源码 点击打开链接 http://download.csdn.net/detail/jiajiayouba/5489601
附主要源码:
using System;
using System.Collections.Generic;
using System.ComponentModel;
using System.Data;
using System.Drawing;
using System.Linq;
using System.Text;
using System.Windows.Forms;
using System.Net;
using System.IO;
using System.Runtime.InteropServices;
using System.Text.RegularExpressions;
using mshtml;
using System.Threading;
using System.Configuration;
namespace WinFormSetup
{
public partial class Form1 : Form
{
private int isContinue = 0; //Check the document if ready
public Form1()
{
InitializeComponent();
this.txtWebSite.Text = "https://passport.csdn.net/account/login";
}
private void Form1_Load(object sender, EventArgs e)
{
this.txtUserName.Text = ConfigHelper.GetValue("userName");
this.txtPwd.Text = ConfigHelper.GetValue("userPwd");
this.chkRem.Checked = this.txtUserName.Text.Trim() == "" ? false : true;
}
/// <summary>
/// Load Button
/// </summary>
/// <param name="sender"></param>
/// <param name="e"></param>
private void btnLoad_Click(object sender, EventArgs e)
{
wb.Navigate(this.txtWebSite.Text);
}
/// <summary>
/// Block page pop alert, confirm, modal window
/// </summary>
/// <param name="sender"></param>
/// <param name="e"></param>
private void wb_Navigated(object sender, WebBrowserNavigatedEventArgs e)
{
IHTMLWindow2 win = (IHTMLWindow2)wb.Document.Window.DomWindow;
string s = "window.alert = null; window.confirm = null;window.open = null;windo