Automatic mine clearance program

xiaoxiao2021-03-06  21

Introduction: Automatic mine clearance tool.

Background: There are actually many people have completed this stuff, just as used as a learning C #, do not laugh!

Development Platform: Visualstudio.net 2003

OS: Windows XP SP2

Product Version of Winmine.exe: 5.1.2600.0

The automatic mine-mine tool program operation is as follows, you can see that the position and number of the bomb are exactly the same as WINMINE.EXE:

achieve

The program is divided into two parts, the core part, please see the following article:

http://www.codeproject.com/csharp/minememoryreader.asp

With this stuff, we can read the information of Bray from the memory of WINMINE.EXE (Minesweight Game Program), then display the location. I just implemented the function of the automatic game on this basis, in fact, "There is no technical content"! The following is the code I added.

Note: The Original Code in the comment refers to the code of the codeproject original text.

[DllImport ( "user32.dll", EntryPoint = "SendMessageA")] public static extern int SendMessage (IntPtr hwnd, int wMsg, UInt32 wParam, UInt32 lParam); protected const int WM_LBUTTONDOWN = 0x201; protected const int WM_LBUTTONUP = 0x202; protected const int WM_RBUTTONDOWN = 0x204; protected const int WM_RBUTTONUP = 0x205; protected const UInt32 MK_LBUTTON = 1; protected const UInt32 MK_RBUTTON = 2; protected UInt32 MAKELONG (UInt32 low, UInt32 high) {return (low & 0xFFFF) | ((high & 0xFFFF ) << 16);} private void buttonAutoPlay_Click (object sender, System.EventArgs e) {// NOTE: // Please modify the original code: processWinMine = myProcesses [0]; if (processWinMine == null) {MessageBox.Show ("NO Minesweeper Process Found!"); Return;} Const Int Cell_Width = 16; Const Int Cell_Height = 16; Const int grid_left = 12; const Int Grid_top = 58; // Note: // minesArray IS A 2-Dimension Array Which Specify WHETHER THERE IS A Bomb in The Cell // Please Modify The Original Code: IF (IISMINE == 0x8f) THEN SET MINESARRAY [X, Y] AS 1; Else Set MinesArray [x, y] as 0 int width = minesArray.getLength (0); int height = minesArray.getLength (1); int x, y; for (y = 0; y

转载请注明原文地址:https://www.9cbs.com/read-56817.html

New Post(0)