欧美bbbwbbbw肥妇,免费乱码人妻系列日韩,一级黄片

WinForm天貓雙11自動搶紅包源碼分享

 更新時間:2016年10月13日 09:20:14   作者:polk6  
這篇文章主要為大家分享了WinForm天貓雙11自動搶紅包源碼,具有一定的參考價值,感興趣的小伙伴們可以參考一下

本文實例為大家分享了搶紅包源碼,供大家參考,具體內(nèi)容如下

1. 正確獲取紅包流程

2. 軟件介紹

2.1 效果圖:

2.2 功能介紹

2.2.1 賬號登錄
頁面開始時,會載入這個網(wǎng)站:https://login.taobao.com/member/login.jhtml?redirect_url=http%3A%2F%2F1111.tmall.com%2F

登錄成功后,會自動跳轉到1111.tmall.com活動頁面。

2.2.2 【去抽獎】按鈕
這按鈕是手動跳轉到1111.tmall.com頁面 

2.2.3 【開始狂歡】按鈕
隱藏活動界面的載入Div

 

2.2.4 【親品牌】按鈕
調(diào)用Js,觸發(fā)點擊"親品牌,贏紅包"

2.2.5 【開始游戲】按鈕
①在這之前,會顯示"游戲攻略"界面,需要手動點擊"不再提示"和"開始游戲"

②然后點擊【開始游戲】按鈕,會模擬鼠標點擊和"再來一次"。

3. 主要代碼

備注:wbTmall 為System.Windows.Forms.WebBrowser 控件。

3.1 操作js代碼

復制代碼 代碼如下:
string GameStart_js = "javascript:document.getElementById('" + this._ac_playagain + "').click()";
WbTmall.Navigate(GameStart_js);

3.2 關閉Js錯誤提示

復制代碼 代碼如下:
WbTmall.ScriptErrorsSuppressed = true;

3.3 模擬鼠標點擊(google搜索到的)

①首先調(diào)用外部API

[DllImport("user32.dll", CharSet = CharSet.Auto, SetLastError = false)]
static extern IntPtr SendMessage(IntPtr hWnd, uint Msg, IntPtr wParam, IntPtr lParam);
 
[DllImport("user32.dll", SetLastError = true)]
static extern IntPtr GetWindow(IntPtr hWnd, uint uCmd);
 
[DllImport("user32.dll", CharSet = CharSet.Auto)]
static extern int GetClassName(IntPtr hWnd, StringBuilder lpClassName, int nMaxCount);

②模擬鼠標點擊

int x = 100; // X coordinate of the click
int y = 100; // Y coordinate of the click
IntPtr handle = WbTmall.Handle;
StringBuilder className = new StringBuilder(100);
while (className.ToString() != "Internet Explorer_Server") // The class control for the browser
{
 handle = GetWindow(handle, 5); // Get a handle to the child window
 GetClassName(handle, className, className.Capacity);
}
 
IntPtr lParam = (IntPtr)((y << 16) | x); // The coordinates
IntPtr wParam = IntPtr.Zero; // Additional parameters for the click (e.g. Ctrl)
const uint downCode = 0x201; // Left click down code
const uint upCode = 0x202; // Left click up code
SendMessage(handle, downCode, wParam, lParam); // Mouse button down
SendMessage(handle, upCode, wParam, lParam); // Mouse button up  

4. 備注

4.1 開發(fā)環(huán)境

系統(tǒng):Win8.1

VS版本:VS2010

.Net版本:4.0

4.2 未解決地方

①進行操作時,內(nèi)存占用會達到100M左右。

②并且在運行2小時后,有明顯的卡頓現(xiàn)象。

③CPU占用達到8%左右。

不知是代碼的原因,還是抽獎頁面是HTML5的canvas原因。

④抽中紅包的話,會卡在"抽中紅包"界面,點下"查看金額"就好了(抱歉,因為沒做抽中紅包的判斷),然后再點下【親品牌】按鈕就又可以玩了。。

5. 下載地址:http://xiazai.jb51.net/201610/yuanma/winformchoujiang(jb51.net).rar

6.后記

抱歉各位,11月8號這個活動結束了,軟件不能用了。之前沒注意到活動結束日期。

以上就是本文的全部內(nèi)容,希望對大家的學習有所幫助,也希望大家多多支持腳本之家。

相關文章

最新評論