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號這個活動結束了,軟件不能用了。之前沒注意到活動結束日期。
?
End C#文章導航 菜單加載中...轉載于:https://www.cnblogs.com/polk6/p/3411532.html
總結
以上是生活随笔為你收集整理的WinForm 天猫2013双11自动抢红包【源码下载】的全部內容,希望文章能夠幫你解決所遇到的問題。
- 上一篇: sql处理排序
- 下一篇: error LNK1123: 转换到 C