WinForm 天貓2013雙11自動搶紅包【源碼下載】


1. 正確獲取紅包流程

 

2. 軟件介紹

2.1 效果圖:

 

2.2 功能介紹

2.2.1 賬號登錄

頁面開始時,會載入這個網站: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 【親品牌】按鈕

調用Js,觸發點擊"親品牌,贏紅包"

 

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搜索到的)

①首先調用外部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 開發環境

系統:Win8.1 

VS版本:VS2010

.Net版本:4.0

4.2 未解決地方

①進行操作時,內存占用會達到100M左右。

②並且在運行2小時后,有明顯的卡頓現象。

③CPU占用達到8%左右。

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

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

 

5. 下載地址

1.百度雲盤:http://pan.baidu.com/s/1xfLmW

2.360雲盤:http://awwymzejsn.l19.yunpan.cn/lk/Q9vnEddhadStW

 

6.后記

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

 


免責聲明!

本站轉載的文章為個人學習借鑒使用,本站對版權不負任何法律責任。如果侵犯了您的隱私權益,請聯系本站郵箱yoyou2525@163.com刪除。



 
粵ICP備18138465號   © 2018-2025 CODEPRJ.COM