├── CleanTempFiles.bat
├── README.md
├── TestFindPic.sln
├── TestFindPic
├── GameState.cpp
├── GameState.h
├── PicDlg.cpp
├── PicDlg.h
├── ReadMe.txt
├── TestFindPic.cpp
├── TestFindPic.h
├── TestFindPic.rc
├── TestFindPic.vcproj
├── TestFindPicDlg.cpp
├── TestFindPicDlg.h
├── bm.cpp
├── bm.h
├── bmp
│ └── FindMe.bmp
├── res
│ ├── TestFindPic.ico
│ └── TestFindPic.rc2
├── resource.h
├── stdafx.cpp
├── stdafx.h
└── targetver.h
├── snatshot1.png
├── snatshot2.bmp
└── snatshot2.png
/CleanTempFiles.bat:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/wanttobeno/Study_FindPicAlgorithm/11fac068002b02222d02433e5cb74b0ddff68cea/CleanTempFiles.bat
--------------------------------------------------------------------------------
/README.md:
--------------------------------------------------------------------------------
1 |
2 | #### 前提
3 |
4 | 以前用过大漠插件通过查图写过简单的外挂,对原理还挺好奇的。
5 | 今天在帖子附件中看到一段查图算法,提取出来,做了个demo。
6 |
7 | https://bbs.pediy.com/thread-197474.htm
8 |
9 | #### 测试查找效率
10 |
11 | - 查找小房子
12 |
13 |
14 |
15 |
16 |
17 | - 查找整个桌面
18 |
19 |
20 |
21 |
22 |
23 |
24 | #### 效率问题
25 |
26 | resemble: 相似度,相同像素占总像素的比例,默认值为0.9
27 |
28 | 相似度越大查找效率越快
29 |
30 | #### 查图算法
31 |
32 | ```cpp
33 | BOOL FindPic(const Cbm & bmWnd, const Cbm & bmFile, LPCRECT rectTarget, OUT PRECT retRect, int resemble, COLORREF rgb)
34 | {
35 | if (!(bmFile.pBits && bmWnd.pBits) || bmFile.cxDib > bmWnd.cxDib || bmFile.cyDib > bmWnd.cyDib)
36 | return FALSE;
37 |
38 | resemble = max(resemble, 0);
39 | resemble = min(resemble, 100);
40 |
41 | BYTE r = GetRValue(rgb);
42 | BYTE g = GetGValue(rgb);
43 | BYTE b = GetBValue(rgb);
44 |
45 |
46 | // 实际范围
47 | RECT rectDefault;
48 | if (rectTarget && bmWnd.IsInRect(*rectTarget))
49 | rectDefault = *rectTarget;
50 | else
51 | bmWnd.GetBitmapRect(rectDefault);
52 |
53 | // bmFile图像坐标(x, y), bmWnd图像坐标(x + xOffset, y + yOffset)
54 | int yTotal = rectDefault.bottom - bmFile.cyDib;
55 | int xTotal = rectDefault.right - bmFile.cxDib;
56 | int invalidTotal = (100 - resemble) * (bmFile.cxDib * bmFile.cyDib);
57 | int validTotal = resemble * (bmFile.cxDib * bmFile.cyDib);
58 |
59 |
60 | // ignoreNum忽略值, validNum有效值,invalidNum无效值
61 | int invalidNum = 0, validNum = 0, ignoreNum = 0;
62 | for (int yOffset = rectDefault.top; yOffset <= yTotal; yOffset++)
63 | for (int xOffset = rectDefault.left; xOffset <= xTotal; xOffset++)
64 | {
65 | for (int y = 0, bflag = TRUE; bflag && (y < bmFile.cyDib); y++)
66 | for (int x = 0; x < bmFile.cxDib; x++)
67 | {
68 | int FileIndex = (bmFile.cyDib - 1 - y) * bmFile.cBits + 3 * x;
69 | int WndIndex = (bmWnd.cyDib - 1 - yOffset - y) * bmWnd.cBits + 3 * (xOffset + x);
70 |
71 |
72 | if (r == bmFile.pBits[FileIndex + 2] &&
73 | g == bmFile.pBits[FileIndex + 1] &&
74 | b == bmFile.pBits[FileIndex] &&
75 | 0xF8 != bmWnd.pBits[WndIndex + 2] &&
76 | 0xFC != bmWnd.pBits[WndIndex + 1] &&
77 | 0xF8 != bmWnd.pBits[WndIndex]) {
78 |
79 | ignoreNum++;
80 | }
81 | else if (bmFile.pBits[FileIndex + 2] == bmWnd.pBits[WndIndex + 2] &&
82 | bmFile.pBits[FileIndex + 1] == bmWnd.pBits[WndIndex + 1] &&
83 | bmFile.pBits[FileIndex] == bmWnd.pBits[WndIndex]) {
84 |
85 | validNum++;
86 | }
87 | else
88 | invalidNum++;
89 |
90 |
91 | if (100 * invalidNum > invalidTotal)
92 | {
93 | invalidNum = validNum = ignoreNum = 0;
94 | bflag = FALSE;
95 | break;
96 | }
97 |
98 | if (100 * (validNum + ignoreNum) >= validTotal)
99 | {
100 | if (retRect)
101 | {
102 | retRect->left = xOffset;
103 | retRect->top = yOffset;
104 | retRect->right = xOffset + bmFile.cxDib;
105 | retRect->bottom = yOffset + bmFile.cyDib;
106 | }
107 | return TRUE;
108 | }
109 | }
110 | }
111 | return FALSE;
112 | }
113 | ```
114 |
115 |
--------------------------------------------------------------------------------
/TestFindPic.sln:
--------------------------------------------------------------------------------
1 |
2 | Microsoft Visual Studio Solution File, Format Version 10.00
3 | # Visual Studio 2008
4 | Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "TestFindPic", "TestFindPic\TestFindPic.vcproj", "{E24DD75D-3144-478B-8A70-E24CFFF7806E}"
5 | EndProject
6 | Global
7 | GlobalSection(SolutionConfigurationPlatforms) = preSolution
8 | Debug|Win32 = Debug|Win32
9 | Release|Win32 = Release|Win32
10 | EndGlobalSection
11 | GlobalSection(ProjectConfigurationPlatforms) = postSolution
12 | {E24DD75D-3144-478B-8A70-E24CFFF7806E}.Debug|Win32.ActiveCfg = Debug|Win32
13 | {E24DD75D-3144-478B-8A70-E24CFFF7806E}.Debug|Win32.Build.0 = Debug|Win32
14 | {E24DD75D-3144-478B-8A70-E24CFFF7806E}.Release|Win32.ActiveCfg = Release|Win32
15 | {E24DD75D-3144-478B-8A70-E24CFFF7806E}.Release|Win32.Build.0 = Release|Win32
16 | EndGlobalSection
17 | GlobalSection(SolutionProperties) = preSolution
18 | HideSolutionNode = FALSE
19 | EndGlobalSection
20 | EndGlobal
21 |
--------------------------------------------------------------------------------
/TestFindPic/GameState.cpp:
--------------------------------------------------------------------------------
1 | #include "StdAfx.h"
2 | #include "GameState.h"
3 | //#include "PreDemo.h"
4 | //#include "mapLine.h"
5 | //#include "km.h"
6 | #include
7 | #include
8 | #include
9 | #pragma comment(lib, "WINMM.LIB")
10 |
11 | #include "TestFindPic.h"
12 | extern CTestFindPicApp theApp;
13 |
14 | int FindNumberPic(const Cbm & bmWnd, LPCRECT rectTarget, PRECT retRect, int resemble = 100, COLORREF rgb = 0);
15 |
16 | BOOL FindSymbolPic(const Cbm & bmWnd, int NumberSymbol, LPCRECT rectTarget, PRECT retRect, int resemble = 100, COLORREF rgb = 0);
17 |
18 |
19 |
20 | BOOL bF9 = FALSE;
21 | BOOL bctrlE = FALSE;
22 |
23 |
24 | /************************多图比较找图函数***************************************
25 | * 形参说明hwndScreen: 截图窗口句柄
26 | * Folderpath: 小图所在的文件夹路径,类似“pic\\”
27 | * (OUT) FileName: 返回找到的文件名,如果没找到则返回NULL
28 | * (IN OUT) rect:返回找到匹配图的中心x\y坐标。没找到则返回零
29 | *********************************************************************************/
30 | BOOL FindSomePic(const Cbm & bmWnd, PCTSTR FileName, LPCRECT rectTarget, PRECT retRect, PTSTR retFileName, int resemble, COLORREF rgb)
31 | {
32 | WIN32_FIND_DATA fData;
33 | BOOL bFind = FALSE;
34 | TCHAR FilePath[MAX_PATH];
35 | TCHAR FileDir[MAX_PATH];
36 | _tcscpy_s(FilePath, MAX_PATH, FileName);
37 | _tcscpy_s(FileDir, MAX_PATH, FileName);
38 |
39 |
40 | if (FileName[lstrlen(FileName) - 1] == '\\')
41 | _tcscat_s(FilePath, MAX_PATH, _T("*.bmp"));
42 | else if (_tcschr(FileName, '*'))
43 | _tcsrchr(FileDir, '\\')[1] = '\0';
44 | else
45 | {
46 | bFind = FindPic(bmWnd, FileName, rectTarget, retRect, resemble, rgb);
47 | if (retFileName)
48 | {
49 | if (bFind)
50 | _tcscpy_s(retFileName, MAX_PATH, FileName);
51 | else
52 | retFileName[0] = '\0';
53 | }
54 |
55 | return bFind;
56 | }
57 |
58 | HANDLE hFile = FindFirstFile(FilePath, &fData);
59 | if (hFile == INVALID_HANDLE_VALUE)
60 | {
61 | TRACE(_T("FindSomePic --- read file failed.\n"));
62 | return FALSE;
63 | }
64 |
65 | do{
66 | wsprintf(FilePath, _T("%s%s"), FileDir, fData.cFileName);
67 | bFind = FindPic(bmWnd, FilePath, rectTarget, retRect, resemble, rgb);
68 | }while (!bFind && FindNextFile(hFile, &fData));
69 |
70 | FindClose(hFile);
71 |
72 | if (retFileName)
73 | {
74 | if (bFind)
75 | _tcscpy_s(retFileName, MAX_PATH, fData.cFileName);
76 | else
77 | retFileName[0] = '\0';
78 | }
79 |
80 | return bFind;
81 | }
82 |
83 |
84 | BOOL FindSomePic(HWND hWnd, PCTSTR FileName, LPCRECT rectTarget, PRECT retRect, PTSTR retFileName, int resemble, COLORREF rgb)
85 | {
86 | return FindSomePic(Cbm(hWnd), FileName, rectTarget, retRect, retFileName, resemble, rgb);
87 | }
88 |
89 |
90 | BOOL FindSomePicEx(const Cbm & bmWnd, PCTSTR FileName, PRECT pRect,
91 | PTSTR retFileName, int deviation, int resemble, COLORREF rgb)
92 | {
93 | WIN32_FIND_DATA fData;
94 | BOOL bFind = FALSE;
95 | TCHAR FilePath[MAX_PATH];
96 | TCHAR FileDir[MAX_PATH];
97 |
98 | _tcscpy_s(FilePath, MAX_PATH, FileName);
99 | _tcscpy_s(FileDir, MAX_PATH, FileName);
100 | if (FileName[lstrlen(FileName) - 1] == '\\')
101 | _tcscat_s(FilePath, MAX_PATH, _T("*.bmp"));
102 | else if (_tcschr(FileName, '*'))
103 | _tcsrchr(FileDir, '\\')[1] = '\0';
104 | else
105 | {
106 | bFind = FindPicEx(bmWnd, FileName, pRect, deviation, resemble, rgb);
107 | if (retFileName)
108 | {
109 | if (bFind)
110 | _tcscpy_s(retFileName, MAX_PATH, FileName);
111 | else
112 | retFileName[0] = '\0';
113 | }
114 |
115 | return bFind;
116 | }
117 |
118 | HANDLE hFile = FindFirstFile(FilePath, &fData);
119 | if (hFile == INVALID_HANDLE_VALUE)
120 | {
121 | TRACE(_T("FindSomePic --- read file failed.\n"));
122 | return FALSE;
123 | }
124 |
125 | do{
126 | wsprintf(FilePath, _T("%s%s"), FileDir, fData.cFileName);
127 | bFind = FindPicEx(bmWnd, Cbm(FilePath), pRect, deviation, resemble, rgb);
128 | }while (!bFind && FindNextFile(hFile, &fData));
129 |
130 | FindClose (hFile);
131 |
132 | if (retFileName)
133 | {
134 | if (bFind)
135 | _tcscpy_s(retFileName, MAX_PATH, fData.cFileName);
136 | else
137 | retFileName[0] = '\0';
138 | }
139 |
140 | return bFind;
141 | }
142 |
143 |
144 | BOOL FindSomePicEx(HWND hWnd, PCTSTR FileName, PRECT pRect,
145 | PTSTR retFileName, int deviation, int resemble, COLORREF rgb)
146 | {
147 | return FindSomePicEx(Cbm(hWnd), FileName, pRect, retFileName, deviation, resemble, rgb);
148 | }
149 |
150 |
151 | /***********通过游戏鼠标图标,查找光标在游戏窗口中的坐标******************/
152 | BOOL GetGameCursorPos(HWND hWnd, POINT & pt, int resemble, COLORREF rgb)
153 | {
154 | return GetGameCursorPos(Cbm(hWnd), pt, resemble, rgb);
155 | }
156 |
157 | BOOL GetGameCursorPos(const Cbm & bmWnd, POINT & pt, int resemble, COLORREF rgb)
158 | {
159 |
160 | CRect rect;
161 |
162 | TCHAR retFileName[MAX_PATH];
163 | BOOL bFind = FindSomePic(bmWnd, _T("bmp\\gameCursor\\"), NULL, &rect, retFileName, resemble, rgb);
164 | if (bFind)
165 | {
166 | if (_tcscmp(retFileName, _T("puzhuo.bmp")) == 0)
167 | {
168 | pt.x = rect.left - 35;
169 | pt.y = rect.top + 5;
170 | }else if (_tcscmp(retFileName, _T("inputcursor.bmp")) == 0)
171 | {
172 | pt = rect.CenterPoint();
173 | }else
174 | {
175 | pt.x = rect.left - 5;
176 | pt.y = rect.top - 4;
177 | }
178 | }
179 |
180 | return bFind;
181 | }
182 |
183 |
184 | // 获取当前所在场景
185 |
186 | int GetMapIndex(HWND hWnd, int resemble, COLORREF rgb)
187 | {
188 | return GetMapIndex(Cbm(hWnd), resemble, rgb);
189 | }
190 |
191 |
192 | int GetMapIndex(const Cbm & bmWnd, int resemble, COLORREF rgb)
193 | {
194 | TCHAR FileName[MAX_PATH];
195 | int mapIndex;
196 | const RECT rect = RECT_MAPINFO;
197 | RECT rectTemp = rect;
198 | if (FindSomePic(bmWnd, _T("bmp\\address\\"), &rect, &rectTemp, FileName, resemble, rgb))
199 | {
200 | mapIndex = _tstoi(FileName);
201 | rectTemp.left = rect.left;
202 | rectTemp.right = rect.right;
203 | if (FindSomePic(bmWnd, _T("bmp\\chNum\\"), &rectTemp, NULL, FileName, resemble, rgb))
204 | mapIndex += _tstoi(FileName);
205 | }
206 | else
207 | mapIndex = UNKNOWN_MAP;
208 |
209 | return mapIndex;
210 | }
211 |
212 |
213 |
214 | //获取当前血量,返回值为0~100的百分数
215 | UINT GetRoleStatusValue(const Cbm & bmWnd, int StatusType)
216 | {
217 | //血条在坐标(582,11)~(631,11)的RGB值
218 | static COLORREF RedValueRGB[50] = {
219 | 0x000058, 0x000060, 0x000068, 0x000058, 0x000060, 0x0800A0, 0x000098, 0x0800A0, 0x0800A8, 0x000098,
220 | 0x080088, 0x000070, 0x000070, 0x0800A0, 0x080088, 0x080088, 0x080088, 0x080088, 0x080088, 0x000098,
221 | 0x000098, 0x0800B0, 0x0800A0, 0x080088, 0x080088, 0x080088, 0x080088, 0x000068, 0x000070, 0x000068,
222 | 0x000070, 0x000070, 0x0800B0, 0x0800B0, 0x000098, 0x000070, 0x080490, 0x080078, 0x080090, 0x0800A8,
223 | 0x0800B8, 0x0800B0, 0x000098, 0x080088, 0x080098, 0x0800B8, 0x0800B8, 0x0800B8, 0x0800B0, 0x000068
224 | };
225 |
226 | //蓝条在坐标(583,23)~(632,23)的RGB值
227 | static COLORREF BlueValueRGB[50] = {
228 | 0x502000, 0x582800, 0x703000, 0x582400, 0x682C00, 0xA04C00, 0x984000, 0xA84800, 0xA05000, 0x984400,
229 | 0x903C00, 0x783800, 0x703400, 0xA04C00, 0x883C00, 0x903C00, 0x903C00, 0x883C00, 0x883C00, 0x984000,
230 | 0x984000, 0xB05400, 0xA04C00, 0x903C00, 0x883C00, 0x903C00, 0x903C00, 0x683000, 0x703400, 0x683000,
231 | 0x783800, 0x783800, 0xB05400, 0xB05000, 0x984000, 0x783800, 0x904C00, 0x783C00, 0x904800, 0xA05000,
232 | 0xB85C00, 0xB05400, 0x904800, 0x883C00, 0x985400, 0xB85C00, 0xB85C00, 0xB85C00, 0xB05400, 0x783C00
233 | };
234 |
235 | int i = 0;
236 | while (i < 50)
237 | {
238 | BOOL bFind = FALSE;
239 | switch (StatusType)
240 | {
241 | case HEALTH_POINT:
242 | bFind = bmWnd.GetPixel(582 + i, 11) == RedValueRGB[i];
243 | break;
244 | case MANA_POINT:
245 | bFind = bmWnd.GetPixel(583 + i, 23) == BlueValueRGB[i];
246 | break;
247 | default:
248 | break;
249 | }
250 | if (bFind)
251 | i++;
252 | else
253 | break;
254 | }
255 |
256 | return 2 * i;
257 | }
258 |
259 |
260 |
261 | //获取当前游戏窗口左上角显示的人物坐标
262 | BOOL GetGameRolePos(HWND hWnd, POINT &ptPos, int resemble, COLORREF rgb)
263 | {
264 | return GetGameRolePos(Cbm(hWnd), ptPos, resemble, rgb);
265 | }
266 |
267 | BOOL GetGameRolePos(const Cbm & bmWnd, POINT &ptPos, int resemble, COLORREF rgb)
268 | {
269 | RECT rectLeftBracket, rectRightBracket, rectComma, rectNumber;
270 | rectComma = RECT_MAPINFO;
271 | BOOL bFindComma = FALSE;
272 | int i, num;
273 |
274 | memset(&ptPos, 0, sizeof(POINT));
275 |
276 | if (!FindSymbolPic(bmWnd, LEFTBRACKET, RECT_MAPINFO, &rectLeftBracket, resemble, rgb))
277 | return FALSE;
278 | if (!FindSymbolPic(bmWnd, RIGHTBRACKET, RECT_MAPINFO, &rectRightBracket, resemble, rgb))
279 | return FALSE;
280 | for (i = 0; i < 3; i++)
281 | {
282 | bFindComma = FindSymbolPic(bmWnd, COMMA1 + i, RECT_MAPINFO, &rectComma, resemble, rgb);
283 | if (bFindComma)
284 | break;
285 | }
286 | if (!bFindComma)
287 | return FALSE;
288 |
289 | for (i = 0; i < (rectComma.left - rectLeftBracket.right) / 6; i++)
290 | {
291 | rectNumber = rectLeftBracket;
292 | rectNumber.left = rectLeftBracket.right + 1 + i * 6;
293 | rectNumber.right = rectLeftBracket.right + 6 + i * 6;
294 |
295 | num = FindNumberPic(bmWnd, &rectNumber, NULL, resemble, rgb);
296 | if (num == INVALID_VALUE)
297 | return FALSE;
298 | else
299 | {
300 | ptPos.x = ptPos.x * 10 + num;
301 | }
302 | }
303 | for (i = 0; i < (rectRightBracket.left - rectComma.right) / 6; i++)
304 | {
305 | rectNumber = rectLeftBracket;
306 | rectNumber.left = rectComma.right + 1 + i * 6;
307 | rectNumber.right = rectComma.right + 6 + i * 6;
308 |
309 | num = FindNumberPic(bmWnd, &rectNumber, NULL, resemble, rgb);
310 | if (num == INVALID_VALUE)
311 | return FALSE;
312 | else
313 | {
314 | ptPos.y = ptPos.y * 10 + num;
315 | }
316 | }
317 |
318 | return TRUE;
319 | }
320 |
321 |
322 | BOOL FindSymbolPic(const Cbm & bmWnd, int NumberSymbol, LPCRECT rectTarget, PRECT retRect, int resemble, COLORREF rgb)
323 | {
324 | TCHAR FileName[MAX_PATH];
325 | wsprintf(FileName, _T("bmp\\symbol\\%02dSymbol.bmp"), NumberSymbol);
326 |
327 | return FindPic(bmWnd, FileName, rectTarget, retRect, resemble, rgb);
328 | }
329 |
330 |
331 | int FindNumberPic(const Cbm & bmWnd, LPCRECT rectTarget, PRECT retRect, int resemble, COLORREF rgb)
332 | {
333 | TCHAR FileName[MAX_PATH];
334 | BOOL bFind = FindSomePic(bmWnd, _T("bmp\\number\\"), rectTarget, retRect, FileName, resemble, rgb);
335 |
336 | if (!bFind)
337 | return INVALID_VALUE;
338 | else
339 | return _tstoi(FileName);
340 | }
341 |
342 |
343 | BOOL GetTeleportItemPos(int TeleportPos, SIZE & size)
344 | {
345 | CString strPos, strPosValue;
346 |
347 | strPos.Format(_T("strPos%d"), TeleportPos);
348 | strPosValue = theApp.GetProfileString(_T("PosSetting"), strPos);
349 |
350 | if (strPosValue.IsEmpty())
351 | return FALSE;
352 | else
353 | {
354 | size.cx = (strPosValue[1] - '1')* 51;
355 | size.cy = (strPosValue[0] - 'A') * 51;
356 | return TRUE;
357 | }
358 | }
359 |
360 |
361 | BOOL ShutDown(DWORD dwFlag)
362 | {
363 | HANDLE hToken;
364 | TOKEN_PRIVILEGES tkp;
365 |
366 | // 打开当前进程访问代号
367 | if (!OpenProcessToken(GetCurrentProcess(), TOKEN_ADJUST_PRIVILEGES | TOKEN_QUERY, &hToken))
368 | return FALSE;
369 |
370 | LookupPrivilegeValue(NULL, SE_SHUTDOWN_NAME, &tkp.Privileges[0].Luid);//获取本地唯一标识用于在特定系统中设置权限
371 | tkp.PrivilegeCount = 1;
372 | tkp.Privileges[0].Attributes = SE_PRIVILEGE_ENABLED;
373 | AdjustTokenPrivileges(hToken, FALSE, &tkp, 0, NULL, 0);
374 | //提升访问令牌权限
375 |
376 | return ExitWindowsEx(dwFlag, 0);
377 | }
378 |
379 |
380 |
381 | __declspec(naked)
382 | int GetSystem()
383 | {
384 | _asm
385 | {
386 | mov eax,fs:[0x30]
387 | mov eax,[eax+0A4h]
388 | ret
389 | }
390 | }
391 |
392 | BOOL CreateFolder(PCTSTR FilePath)
393 | {
394 | int len = lstrlen(FilePath);
395 | for (int pos = 0; pos < len - 1; pos++)
396 | {
397 | if (FilePath[pos] == '\\' || FilePath[pos] == '/')
398 | {
399 | CString FileDirectory(FilePath, pos + 1);
400 | // 判断文件夹路径是否存在,不存在则创建文件夹
401 | if (!PathIsDirectory(FileDirectory))
402 | {
403 | if (!CreateDirectory(FileDirectory, NULL))
404 | return FALSE;
405 | }
406 | }
407 | }
408 | return TRUE;
409 | }
410 |
--------------------------------------------------------------------------------
/TestFindPic/GameState.h:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/wanttobeno/Study_FindPicAlgorithm/11fac068002b02222d02433e5cb74b0ddff68cea/TestFindPic/GameState.h
--------------------------------------------------------------------------------
/TestFindPic/PicDlg.cpp:
--------------------------------------------------------------------------------
1 | // PicDlg.cpp : implementation file
2 | //
3 |
4 | #include "stdafx.h"
5 | #include "TestFindPic.h"
6 | #include "PicDlg.h"
7 |
8 |
9 | // CPicDlg dialog
10 |
11 | IMPLEMENT_DYNAMIC(CPicDlg, CDialog)
12 |
13 | CPicDlg::CPicDlg(CWnd* pParent /*=NULL*/)
14 | : CDialog(CPicDlg::IDD, pParent)
15 | {
16 |
17 | }
18 |
19 | CPicDlg::~CPicDlg()
20 | {
21 | }
22 |
23 | void CPicDlg::DoDataExchange(CDataExchange* pDX)
24 | {
25 | CDialog::DoDataExchange(pDX);
26 | }
27 |
28 |
29 | BEGIN_MESSAGE_MAP(CPicDlg, CDialog)
30 | ON_WM_ERASEBKGND()
31 | ON_WM_NCHITTEST()
32 | END_MESSAGE_MAP()
33 |
34 |
35 | // CPicDlg message handlers
36 |
37 | BOOL CPicDlg::OnEraseBkgnd(CDC* pDC)
38 | {
39 | //return CDialog::OnEraseBkgnd(pDC);
40 | CBrush backBrush(0xff8080);
41 | CBrush* pOldBrush = pDC->SelectObject(&backBrush);
42 | CRect rect;
43 | pDC->GetClipBox(&rect);
44 | pDC->PatBlt(rect.left, rect.top, rect.Width(), rect.Height(), PATCOPY);
45 | pDC->SelectObject(pOldBrush);
46 | return TRUE;
47 | }
48 |
49 | LRESULT CPicDlg::OnNcHitTest(CPoint point)
50 | {
51 | // TODO: Add your message handler code here and/or call default
52 | return HTCAPTION;
53 | //return CDialog::OnNcHitTest(point);
54 | }
55 |
--------------------------------------------------------------------------------
/TestFindPic/PicDlg.h:
--------------------------------------------------------------------------------
1 | #pragma once
2 |
3 |
4 | // CPicDlg dialog
5 |
6 | class CPicDlg : public CDialog
7 | {
8 | DECLARE_DYNAMIC(CPicDlg)
9 |
10 | public:
11 | CPicDlg(CWnd* pParent = NULL); // standard constructor
12 | virtual ~CPicDlg();
13 |
14 | // Dialog Data
15 | enum { IDD = IDD_DLG_PIC };
16 |
17 |
18 | protected:
19 | virtual void DoDataExchange(CDataExchange* pDX); // DDX/DDV support
20 |
21 | DECLARE_MESSAGE_MAP()
22 | public:
23 | afx_msg BOOL OnEraseBkgnd(CDC* pDC);
24 | afx_msg LRESULT OnNcHitTest(CPoint point);
25 | };
26 |
--------------------------------------------------------------------------------
/TestFindPic/ReadMe.txt:
--------------------------------------------------------------------------------
1 | ================================================================================
2 | MICROSOFT FOUNDATION CLASS LIBRARY : TestFindPic Project Overview
3 | ===============================================================================
4 |
5 | The application wizard has created this TestFindPic application for
6 | you. This application not only demonstrates the basics of using the Microsoft
7 | Foundation Classes but is also a starting point for writing your application.
8 |
9 | This file contains a summary of what you will find in each of the files that
10 | make up your TestFindPic application.
11 |
12 | TestFindPic.vcproj
13 | This is the main project file for VC++ projects generated using an application wizard.
14 | It contains information about the version of Visual C++ that generated the file, and
15 | information about the platforms, configurations, and project features selected with the
16 | application wizard.
17 |
18 | TestFindPic.h
19 | This is the main header file for the application. It includes other
20 | project specific headers (including Resource.h) and declares the
21 | CTestFindPicApp application class.
22 |
23 | TestFindPic.cpp
24 | This is the main application source file that contains the application
25 | class CTestFindPicApp.
26 |
27 | TestFindPic.rc
28 | This is a listing of all of the Microsoft Windows resources that the
29 | program uses. It includes the icons, bitmaps, and cursors that are stored
30 | in the RES subdirectory. This file can be directly edited in Microsoft
31 | Visual C++. Your project resources are in 1033.
32 |
33 | res\TestFindPic.ico
34 | This is an icon file, which is used as the application's icon. This
35 | icon is included by the main resource file TestFindPic.rc.
36 |
37 | res\TestFindPic.rc2
38 | This file contains resources that are not edited by Microsoft
39 | Visual C++. You should place all resources not editable by
40 | the resource editor in this file.
41 |
42 |
43 | /////////////////////////////////////////////////////////////////////////////
44 |
45 | The application wizard creates one dialog class:
46 |
47 | TestFindPicDlg.h, TestFindPicDlg.cpp - the dialog
48 | These files contain your CTestFindPicDlg class. This class defines
49 | the behavior of your application's main dialog. The dialog's template is
50 | in TestFindPic.rc, which can be edited in Microsoft Visual C++.
51 |
52 |
53 | /////////////////////////////////////////////////////////////////////////////
54 |
55 | Other Features:
56 |
57 | ActiveX Controls
58 | The application includes support to use ActiveX controls.
59 |
60 | /////////////////////////////////////////////////////////////////////////////
61 |
62 | Other standard files:
63 |
64 | StdAfx.h, StdAfx.cpp
65 | These files are used to build a precompiled header (PCH) file
66 | named TestFindPic.pch and a precompiled types file named StdAfx.obj.
67 |
68 | Resource.h
69 | This is the standard header file, which defines new resource IDs.
70 | Microsoft Visual C++ reads and updates this file.
71 |
72 | TestFindPic.manifest
73 | Application manifest files are used by Windows XP to describe an applications
74 | dependency on specific versions of Side-by-Side assemblies. The loader uses this
75 | information to load the appropriate assembly from the assembly cache or private
76 | from the application. The Application manifest maybe included for redistribution
77 | as an external .manifest file that is installed in the same folder as the application
78 | executable or it may be included in the executable in the form of a resource.
79 | /////////////////////////////////////////////////////////////////////////////
80 |
81 | Other notes:
82 |
83 | The application wizard uses "TODO:" to indicate parts of the source code you
84 | should add to or customize.
85 |
86 | If your application uses MFC in a shared DLL, you will need
87 | to redistribute the MFC DLLs. If your application is in a language
88 | other than the operating system's locale, you will also have to
89 | redistribute the corresponding localized resources MFC90XXX.DLL.
90 | For more information on both of these topics, please see the section on
91 | redistributing Visual C++ applications in MSDN documentation.
92 |
93 | /////////////////////////////////////////////////////////////////////////////
94 |
--------------------------------------------------------------------------------
/TestFindPic/TestFindPic.cpp:
--------------------------------------------------------------------------------
1 |
2 | // TestFindPic.cpp : Defines the class behaviors for the application.
3 | //
4 |
5 | #include "stdafx.h"
6 | #include "TestFindPic.h"
7 | #include "TestFindPicDlg.h"
8 |
9 | #include "PicDlg.h"
10 |
11 | #ifdef _DEBUG
12 | #define new DEBUG_NEW
13 | #endif
14 |
15 |
16 | // CTestFindPicApp
17 |
18 | BEGIN_MESSAGE_MAP(CTestFindPicApp, CWinAppEx)
19 | ON_COMMAND(ID_HELP, &CWinApp::OnHelp)
20 | END_MESSAGE_MAP()
21 |
22 |
23 | // CTestFindPicApp construction
24 |
25 | CTestFindPicApp::CTestFindPicApp()
26 | {
27 | // TODO: add construction code here,
28 | // Place all significant initialization in InitInstance
29 | }
30 |
31 |
32 | // The one and only CTestFindPicApp object
33 |
34 | CTestFindPicApp theApp;
35 |
36 |
37 | // CTestFindPicApp initialization
38 |
39 | BOOL CTestFindPicApp::InitInstance()
40 | {
41 | // InitCommonControlsEx() is required on Windows XP if an application
42 | // manifest specifies use of ComCtl32.dll version 6 or later to enable
43 | // visual styles. Otherwise, any window creation will fail.
44 | INITCOMMONCONTROLSEX InitCtrls;
45 | InitCtrls.dwSize = sizeof(InitCtrls);
46 | // Set this to include all the common control classes you want to use
47 | // in your application.
48 | InitCtrls.dwICC = ICC_WIN95_CLASSES;
49 | InitCommonControlsEx(&InitCtrls);
50 |
51 | CWinAppEx::InitInstance();
52 |
53 | AfxEnableControlContainer();
54 |
55 | // Standard initialization
56 | // If you are not using these features and wish to reduce the size
57 | // of your final executable, you should remove from the following
58 | // the specific initialization routines you do not need
59 | // Change the registry key under which our settings are stored
60 | // TODO: You should modify this string to be something appropriate
61 | // such as the name of your company or organization
62 | SetRegistryKey(_T("Local AppWizard-Generated Applications"));
63 |
64 | CTestFindPicDlg dlg;
65 | m_pMainWnd = &dlg;
66 | INT_PTR nResponse = dlg.DoModal();
67 | if (nResponse == IDOK)
68 | {
69 | // TODO: Place code here to handle when the dialog is
70 | // dismissed with OK
71 | }
72 | else if (nResponse == IDCANCEL)
73 | {
74 | // TODO: Place code here to handle when the dialog is
75 | // dismissed with Cancel
76 | }
77 |
78 | // Since the dialog has been closed, return FALSE so that we exit the
79 | // application, rather than start the application's message pump.
80 | return FALSE;
81 | }
82 |
--------------------------------------------------------------------------------
/TestFindPic/TestFindPic.h:
--------------------------------------------------------------------------------
1 |
2 | // TestFindPic.h : main header file for the PROJECT_NAME application
3 | //
4 |
5 | #pragma once
6 |
7 | #ifndef __AFXWIN_H__
8 | #error "include 'stdafx.h' before including this file for PCH"
9 | #endif
10 |
11 | #include "resource.h" // main symbols
12 |
13 |
14 | // CTestFindPicApp:
15 | // See TestFindPic.cpp for the implementation of this class
16 | //
17 |
18 | class CTestFindPicApp : public CWinAppEx
19 | {
20 | public:
21 | CTestFindPicApp();
22 |
23 | // Overrides
24 | public:
25 | virtual BOOL InitInstance();
26 |
27 | // Implementation
28 |
29 | DECLARE_MESSAGE_MAP()
30 | };
31 |
32 | extern CTestFindPicApp theApp;
--------------------------------------------------------------------------------
/TestFindPic/TestFindPic.rc:
--------------------------------------------------------------------------------
1 | // Microsoft Visual C++ generated resource script.
2 | //
3 | #include "resource.h"
4 |
5 | #define APSTUDIO_READONLY_SYMBOLS
6 | /////////////////////////////////////////////////////////////////////////////
7 | //
8 | // Generated from the TEXTINCLUDE 2 resource.
9 | //
10 | #ifndef APSTUDIO_INVOKED
11 | #include "targetver.h"
12 | #endif
13 | #include "afxres.h"
14 |
15 | /////////////////////////////////////////////////////////////////////////////
16 | #undef APSTUDIO_READONLY_SYMBOLS
17 |
18 | /////////////////////////////////////////////////////////////////////////////
19 | // Chinese (P.R.C.) resources
20 |
21 | #if !defined(AFX_RESOURCE_DLL) || defined(AFX_TARG_CHS)
22 | #ifdef _WIN32
23 | LANGUAGE LANG_CHINESE, SUBLANG_CHINESE_SIMPLIFIED
24 | #pragma code_page(936)
25 | #endif //_WIN32
26 |
27 | #ifdef APSTUDIO_INVOKED
28 | /////////////////////////////////////////////////////////////////////////////
29 | //
30 | // TEXTINCLUDE
31 | //
32 |
33 | 1 TEXTINCLUDE
34 | BEGIN
35 | "resource.h\0"
36 | END
37 |
38 | 2 TEXTINCLUDE
39 | BEGIN
40 | "#ifndef APSTUDIO_INVOKED\r\n"
41 | "#include ""targetver.h""\r\n"
42 | "#endif\r\n"
43 | "#include ""afxres.h""\r\n"
44 | "\0"
45 | END
46 |
47 | 3 TEXTINCLUDE
48 | BEGIN
49 | "#define _AFX_NO_SPLITTER_RESOURCES\r\n"
50 | "#define _AFX_NO_OLE_RESOURCES\r\n"
51 | "#define _AFX_NO_TRACKER_RESOURCES\r\n"
52 | "#define _AFX_NO_PROPERTY_RESOURCES\r\n"
53 | "\r\n"
54 | "#if !defined(AFX_RESOURCE_DLL) || defined(AFX_TARG_ENU)\r\n"
55 | "LANGUAGE 9, 1\r\n"
56 | "#pragma code_page(1252)\r\n"
57 | "#include ""res\\TestFindPic.rc2"" // non-Microsoft Visual C++ edited resources\r\n"
58 | "#include ""afxres.rc"" // Standard components\r\n"
59 | "#endif\r\n"
60 | "\0"
61 | END
62 |
63 | #endif // APSTUDIO_INVOKED
64 |
65 |
66 | /////////////////////////////////////////////////////////////////////////////
67 | //
68 | // Icon
69 | //
70 |
71 | // Icon with lowest ID value placed first to ensure application icon
72 | // remains consistent on all systems.
73 | IDR_MAINFRAME ICON "res\\TestFindPic.ico"
74 |
75 | /////////////////////////////////////////////////////////////////////////////
76 | //
77 | // Dialog
78 | //
79 |
80 | IDD_DLG_PIC DIALOGEX 0, 0, 228, 138
81 | STYLE DS_SETFONT | DS_FIXEDSYS | WS_POPUP | WS_BORDER | WS_SYSMENU
82 | FONT 8, "MS Shell Dlg", 400, 0, 0x1
83 | BEGIN
84 | CONTROL 129,IDC_STATIC,"Static",SS_BITMAP | SS_REALSIZEIMAGE,57,20,113,97,WS_EX_TRANSPARENT
85 | END
86 |
87 |
88 | /////////////////////////////////////////////////////////////////////////////
89 | //
90 | // DESIGNINFO
91 | //
92 |
93 | #ifdef APSTUDIO_INVOKED
94 | GUIDELINES DESIGNINFO
95 | BEGIN
96 | IDD_DLG_PIC, DIALOG
97 | BEGIN
98 | LEFTMARGIN, 7
99 | RIGHTMARGIN, 221
100 | TOPMARGIN, 7
101 | BOTTOMMARGIN, 131
102 | END
103 | END
104 | #endif // APSTUDIO_INVOKED
105 |
106 |
107 | /////////////////////////////////////////////////////////////////////////////
108 | //
109 | // Bitmap
110 | //
111 |
112 | IDB_BITMAP1 BITMAP "bmp\\FindMe.bmp"
113 | #endif // Chinese (P.R.C.) resources
114 | /////////////////////////////////////////////////////////////////////////////
115 |
116 |
117 | /////////////////////////////////////////////////////////////////////////////
118 | // English (U.S.) resources
119 |
120 | #if !defined(AFX_RESOURCE_DLL) || defined(AFX_TARG_ENU)
121 | #ifdef _WIN32
122 | LANGUAGE LANG_ENGLISH, SUBLANG_ENGLISH_US
123 | #pragma code_page(1252)
124 | #endif //_WIN32
125 |
126 | /////////////////////////////////////////////////////////////////////////////
127 | //
128 | // Dialog
129 | //
130 |
131 | IDD_ABOUTBOX DIALOGEX 0, 0, 170, 62
132 | STYLE DS_SETFONT | DS_MODALFRAME | DS_FIXEDSYS | WS_POPUP | WS_CAPTION | WS_SYSMENU
133 | CAPTION "About TestFindPic"
134 | FONT 8, "MS Shell Dlg", 0, 0, 0x1
135 | BEGIN
136 | ICON IDR_MAINFRAME,IDC_STATIC,14,14,21,20
137 | LTEXT "TestFindPic, Version 1.0",IDC_STATIC,42,14,114,8,SS_NOPREFIX
138 | LTEXT "Copyright (C) 2018",IDC_STATIC,42,26,114,8
139 | DEFPUSHBUTTON "OK",IDOK,113,41,50,14,WS_GROUP
140 | END
141 |
142 | IDD_TESTFINDPIC_DIALOG DIALOGEX 0, 0, 215, 85
143 | STYLE DS_SETFONT | DS_MODALFRAME | DS_FIXEDSYS | WS_POPUP | WS_VISIBLE | WS_CAPTION | WS_SYSMENU
144 | EXSTYLE WS_EX_APPWINDOW
145 | CAPTION "TestFindPic"
146 | FONT 8, "MS Shell Dlg", 0, 0, 0x1
147 | BEGIN
148 | PUSHBUTTON "FindPic",IDC_BTN_FIND_PIC,19,47,50,14
149 | LTEXT "Static",IDC_STATIC_POS,43,15,134,23
150 | PUSHBUTTON "FindDesk",IDC_BTN_FIND_DESK,119,49,50,14
151 | END
152 |
153 |
154 | /////////////////////////////////////////////////////////////////////////////
155 | //
156 | // Version
157 | //
158 |
159 | VS_VERSION_INFO VERSIONINFO
160 | FILEVERSION 1,0,0,1
161 | PRODUCTVERSION 1,0,0,1
162 | FILEFLAGSMASK 0x3fL
163 | #ifdef _DEBUG
164 | FILEFLAGS 0x1L
165 | #else
166 | FILEFLAGS 0x0L
167 | #endif
168 | FILEOS 0x4L
169 | FILETYPE 0x1L
170 | FILESUBTYPE 0x0L
171 | BEGIN
172 | BLOCK "StringFileInfo"
173 | BEGIN
174 | BLOCK "040904e4"
175 | BEGIN
176 | VALUE "CompanyName", "TODO: "
177 | VALUE "FileDescription", "TODO: "
178 | VALUE "FileVersion", "1.0.0.1"
179 | VALUE "InternalName", "TestFindPic.exe"
180 | VALUE "LegalCopyright", "TODO: (c) . All rights reserved."
181 | VALUE "OriginalFilename", "TestFindPic.exe"
182 | VALUE "ProductName", "TODO: "
183 | VALUE "ProductVersion", "1.0.0.1"
184 | END
185 | END
186 | BLOCK "VarFileInfo"
187 | BEGIN
188 | VALUE "Translation", 0x409, 1252
189 | END
190 | END
191 |
192 |
193 | /////////////////////////////////////////////////////////////////////////////
194 | //
195 | // DESIGNINFO
196 | //
197 |
198 | #ifdef APSTUDIO_INVOKED
199 | GUIDELINES DESIGNINFO
200 | BEGIN
201 | IDD_ABOUTBOX, DIALOG
202 | BEGIN
203 | LEFTMARGIN, 7
204 | RIGHTMARGIN, 163
205 | TOPMARGIN, 7
206 | BOTTOMMARGIN, 55
207 | END
208 |
209 | IDD_TESTFINDPIC_DIALOG, DIALOG
210 | BEGIN
211 | LEFTMARGIN, 7
212 | RIGHTMARGIN, 206
213 | TOPMARGIN, 7
214 | BOTTOMMARGIN, 78
215 | END
216 | END
217 | #endif // APSTUDIO_INVOKED
218 |
219 |
220 | /////////////////////////////////////////////////////////////////////////////
221 | //
222 | // String Table
223 | //
224 |
225 | STRINGTABLE
226 | BEGIN
227 | IDS_ABOUTBOX "&About TestFindPic..."
228 | END
229 |
230 | #endif // English (U.S.) resources
231 | /////////////////////////////////////////////////////////////////////////////
232 |
233 |
234 |
235 | #ifndef APSTUDIO_INVOKED
236 | /////////////////////////////////////////////////////////////////////////////
237 | //
238 | // Generated from the TEXTINCLUDE 3 resource.
239 | //
240 | #define _AFX_NO_SPLITTER_RESOURCES
241 | #define _AFX_NO_OLE_RESOURCES
242 | #define _AFX_NO_TRACKER_RESOURCES
243 | #define _AFX_NO_PROPERTY_RESOURCES
244 |
245 | #if !defined(AFX_RESOURCE_DLL) || defined(AFX_TARG_ENU)
246 | LANGUAGE 9, 1
247 | #pragma code_page(1252)
248 | #include "res\TestFindPic.rc2" // non-Microsoft Visual C++ edited resources
249 | #include "afxres.rc" // Standard components
250 | #endif
251 |
252 | /////////////////////////////////////////////////////////////////////////////
253 | #endif // not APSTUDIO_INVOKED
254 |
255 |
--------------------------------------------------------------------------------
/TestFindPic/TestFindPic.vcproj:
--------------------------------------------------------------------------------
1 |
2 |
11 |
12 |
15 |
16 |
17 |
18 |
19 |
27 |
30 |
33 |
36 |
39 |
45 |
56 |
59 |
65 |
68 |
75 |
78 |
81 |
84 |
87 |
90 |
93 |
96 |
97 |
106 |
109 |
112 |
115 |
118 |
124 |
136 |
139 |
145 |
148 |
157 |
160 |
163 |
166 |
169 |
172 |
175 |
178 |
179 |
180 |
181 |
182 |
183 |
188 |
191 |
192 |
195 |
198 |
202 |
203 |
206 |
210 |
211 |
212 |
215 |
216 |
219 |
220 |
223 |
226 |
227 |
230 |
231 |
232 |
233 |
238 |
241 |
242 |
245 |
246 |
249 |
250 |
253 |
254 |
257 |
258 |
261 |
262 |
263 |
268 |
271 |
272 |
275 |
276 |
279 |
280 |
283 |
284 |
285 |
288 |
291 |
292 |
295 |
296 |
297 |
300 |
301 |
302 |
303 |
307 |
308 |
309 |
--------------------------------------------------------------------------------
/TestFindPic/TestFindPicDlg.cpp:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/wanttobeno/Study_FindPicAlgorithm/11fac068002b02222d02433e5cb74b0ddff68cea/TestFindPic/TestFindPicDlg.cpp
--------------------------------------------------------------------------------
/TestFindPic/TestFindPicDlg.h:
--------------------------------------------------------------------------------
1 |
2 | // TestFindPicDlg.h : header file
3 | //
4 |
5 | #pragma once
6 | #include "afxwin.h"
7 | #include "PicDlg.h"
8 |
9 | // CTestFindPicDlg dialog
10 | class CTestFindPicDlg : public CDialog
11 | {
12 | // Construction
13 | public:
14 | CTestFindPicDlg(CWnd* pParent = NULL); // standard constructor
15 |
16 | // Dialog Data
17 | enum { IDD = IDD_TESTFINDPIC_DIALOG };
18 |
19 | protected:
20 | virtual void DoDataExchange(CDataExchange* pDX); // DDX/DDV support
21 |
22 |
23 | // Implementation
24 | protected:
25 | HICON m_hIcon;
26 |
27 | // Generated message map functions
28 | virtual BOOL OnInitDialog();
29 | afx_msg void OnSysCommand(UINT nID, LPARAM lParam);
30 | afx_msg void OnPaint();
31 | afx_msg HCURSOR OnQueryDragIcon();
32 | DECLARE_MESSAGE_MAP()
33 | public:
34 | afx_msg void OnBnClickedBtnFindPic();
35 | CStatic m_pTxtPos;
36 | CPicDlg m_picDlg;
37 | afx_msg void OnBnClickedBtnFindDesk();
38 |
39 | void FindPicTest(HWND hWnd,LPCTSTR pFindFile);
40 |
41 | };
42 |
--------------------------------------------------------------------------------
/TestFindPic/bm.cpp:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/wanttobeno/Study_FindPicAlgorithm/11fac068002b02222d02433e5cb74b0ddff68cea/TestFindPic/bm.cpp
--------------------------------------------------------------------------------
/TestFindPic/bm.h:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/wanttobeno/Study_FindPicAlgorithm/11fac068002b02222d02433e5cb74b0ddff68cea/TestFindPic/bm.h
--------------------------------------------------------------------------------
/TestFindPic/bmp/FindMe.bmp:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/wanttobeno/Study_FindPicAlgorithm/11fac068002b02222d02433e5cb74b0ddff68cea/TestFindPic/bmp/FindMe.bmp
--------------------------------------------------------------------------------
/TestFindPic/res/TestFindPic.ico:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/wanttobeno/Study_FindPicAlgorithm/11fac068002b02222d02433e5cb74b0ddff68cea/TestFindPic/res/TestFindPic.ico
--------------------------------------------------------------------------------
/TestFindPic/res/TestFindPic.rc2:
--------------------------------------------------------------------------------
1 | //
2 | // TestFindPic.RC2 - resources Microsoft Visual C++ does not edit directly
3 | //
4 |
5 | #ifdef APSTUDIO_INVOKED
6 | #error this file is not editable by Microsoft Visual C++
7 | #endif //APSTUDIO_INVOKED
8 |
9 |
10 | /////////////////////////////////////////////////////////////////////////////
11 | // Add manually edited resources here...
12 |
13 | /////////////////////////////////////////////////////////////////////////////
14 |
--------------------------------------------------------------------------------
/TestFindPic/resource.h:
--------------------------------------------------------------------------------
1 | //{{NO_DEPENDENCIES}}
2 | // Microsoft Visual C++ generated include file.
3 | // Used by TestFindPic.rc
4 | //
5 | #define IDM_ABOUTBOX 0x0010
6 | #define IDD_ABOUTBOX 100
7 | #define IDS_ABOUTBOX 101
8 | #define IDD_TESTFINDPIC_DIALOG 102
9 | #define IDR_MAINFRAME 128
10 | #define IDB_BITMAP1 129
11 | #define IDD_DLG_PIC 130
12 | #define IDC_BTN_FIND_PIC 1000
13 | #define IDC_STATIC_POS 1001
14 | #define IDC_BUTTON2 1002
15 | #define IDC_BTN_FIND_DESK 1002
16 |
17 | // Next default values for new objects
18 | //
19 | #ifdef APSTUDIO_INVOKED
20 | #ifndef APSTUDIO_READONLY_SYMBOLS
21 | #define _APS_NEXT_RESOURCE_VALUE 131
22 | #define _APS_NEXT_COMMAND_VALUE 32771
23 | #define _APS_NEXT_CONTROL_VALUE 1003
24 | #define _APS_NEXT_SYMED_VALUE 101
25 | #endif
26 | #endif
27 |
--------------------------------------------------------------------------------
/TestFindPic/stdafx.cpp:
--------------------------------------------------------------------------------
1 |
2 | // stdafx.cpp : source file that includes just the standard includes
3 | // TestFindPic.pch will be the pre-compiled header
4 | // stdafx.obj will contain the pre-compiled type information
5 |
6 | #include "stdafx.h"
7 |
8 |
9 |
--------------------------------------------------------------------------------
/TestFindPic/stdafx.h:
--------------------------------------------------------------------------------
1 |
2 | // stdafx.h : include file for standard system include files,
3 | // or project specific include files that are used frequently,
4 | // but are changed infrequently
5 |
6 | #pragma once
7 |
8 | #ifndef _SECURE_ATL
9 | #define _SECURE_ATL 1
10 | #endif
11 |
12 | #ifndef VC_EXTRALEAN
13 | #define VC_EXTRALEAN // Exclude rarely-used stuff from Windows headers
14 | #endif
15 |
16 | #include "targetver.h"
17 |
18 | #define _ATL_CSTRING_EXPLICIT_CONSTRUCTORS // some CString constructors will be explicit
19 |
20 | // turns off MFC's hiding of some common and often safely ignored warning messages
21 | #define _AFX_ALL_WARNINGS
22 |
23 | #include // MFC core and standard components
24 | #include // MFC extensions
25 |
26 |
27 | #include // MFC Automation classes
28 |
29 |
30 |
31 | #ifndef _AFX_NO_OLE_SUPPORT
32 | #include // MFC support for Internet Explorer 4 Common Controls
33 | #endif
34 | #ifndef _AFX_NO_AFXCMN_SUPPORT
35 | #include // MFC support for Windows Common Controls
36 | #endif // _AFX_NO_AFXCMN_SUPPORT
37 |
38 | #include // MFC support for ribbons and control bars
39 |
40 |
41 |
42 |
43 |
44 |
45 |
46 |
47 |
48 | #ifdef _UNICODE
49 | #if defined _M_IX86
50 | #pragma comment(linker,"/manifestdependency:\"type='win32' name='Microsoft.Windows.Common-Controls' version='6.0.0.0' processorArchitecture='x86' publicKeyToken='6595b64144ccf1df' language='*'\"")
51 | #elif defined _M_IA64
52 | #pragma comment(linker,"/manifestdependency:\"type='win32' name='Microsoft.Windows.Common-Controls' version='6.0.0.0' processorArchitecture='ia64' publicKeyToken='6595b64144ccf1df' language='*'\"")
53 | #elif defined _M_X64
54 | #pragma comment(linker,"/manifestdependency:\"type='win32' name='Microsoft.Windows.Common-Controls' version='6.0.0.0' processorArchitecture='amd64' publicKeyToken='6595b64144ccf1df' language='*'\"")
55 | #else
56 | #pragma comment(linker,"/manifestdependency:\"type='win32' name='Microsoft.Windows.Common-Controls' version='6.0.0.0' processorArchitecture='*' publicKeyToken='6595b64144ccf1df' language='*'\"")
57 | #endif
58 | #endif
59 |
60 |
61 |
--------------------------------------------------------------------------------
/TestFindPic/targetver.h:
--------------------------------------------------------------------------------
1 |
2 | #pragma once
3 |
4 | // The following macros define the minimum required platform. The minimum required platform
5 | // is the earliest version of Windows, Internet Explorer etc. that has the necessary features to run
6 | // your application. The macros work by enabling all features available on platform versions up to and
7 | // including the version specified.
8 |
9 | // Modify the following defines if you have to target a platform prior to the ones specified below.
10 | // Refer to MSDN for the latest info on corresponding values for different platforms.
11 | #ifndef WINVER // Specifies that the minimum required platform is Windows Vista.
12 | #define WINVER 0x0600 // Change this to the appropriate value to target other versions of Windows.
13 | #endif
14 |
15 | #ifndef _WIN32_WINNT // Specifies that the minimum required platform is Windows Vista.
16 | #define _WIN32_WINNT 0x0600 // Change this to the appropriate value to target other versions of Windows.
17 | #endif
18 |
19 | #ifndef _WIN32_WINDOWS // Specifies that the minimum required platform is Windows 98.
20 | #define _WIN32_WINDOWS 0x0410 // Change this to the appropriate value to target Windows Me or later.
21 | #endif
22 |
23 | #ifndef _WIN32_IE // Specifies that the minimum required platform is Internet Explorer 7.0.
24 | #define _WIN32_IE 0x0700 // Change this to the appropriate value to target other versions of IE.
25 | #endif
26 |
27 |
--------------------------------------------------------------------------------
/snatshot1.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/wanttobeno/Study_FindPicAlgorithm/11fac068002b02222d02433e5cb74b0ddff68cea/snatshot1.png
--------------------------------------------------------------------------------
/snatshot2.bmp:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/wanttobeno/Study_FindPicAlgorithm/11fac068002b02222d02433e5cb74b0ddff68cea/snatshot2.bmp
--------------------------------------------------------------------------------
/snatshot2.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/wanttobeno/Study_FindPicAlgorithm/11fac068002b02222d02433e5cb74b0ddff68cea/snatshot2.png
--------------------------------------------------------------------------------