MCPcopy Create free account
hub / github.com/DentonW/DevIL / GetPrevImage

Function GetPrevImage

DevIL/examples/windows_example/windows_example.cpp:1394–1457  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

1392
1393
1394bool GetPrevImage()
1395{
1396 HANDLE Search;
1397 WIN32_FIND_DATA FindData;
1398 int i = 0, j, Total = 0, FileNamePos = -1;
1399 TCHAR *Ext, *CurName;
1400
1401 Search = FindFirstFile(L"*.*", &FindData);
1402 CurName = wcsrchr(CurFileName, '\\');
1403 if (CurName == NULL) {
1404 CurName = CurFileName;
1405 }
1406 else {
1407 CurName++; // Skip the '\'
1408 }
1409
1410 do {
1411 if (!_wcsicmp(FindData.cFileName, L".") || !_wcsicmp(FindData.cFileName, L".."))
1412 continue;
1413 Ext = GetExtension(FindData.cFileName);
1414 if (Ext == NULL)
1415 continue;
1416 for (j = 0; ExtList[j] != NULL; j++) {
1417 if (CheckExtension(FindData.cFileName, ExtList[j])) {
1418 if (!_wcsicmp(FindData.cFileName, CurName))
1419 FileNamePos = Total;
1420 Total++;
1421 break;
1422 }
1423 }
1424 } while (FindNextFile(Search, &FindData));
1425
1426 FindClose(Search);
1427 Search = FindFirstFile(L"*.*", &FindData);
1428
1429 if (Total == 0 || FileNamePos == -1)
1430 return false;
1431
1432 if (FileNamePos == 0)
1433 FileNamePos = Total;
1434
1435 do {
1436 if (!_wcsicmp(FindData.cFileName, L".") || !_wcsicmp(FindData.cFileName, L".."))
1437 continue;
1438 Ext = GetExtension(FindData.cFileName);
1439 if (Ext == NULL)
1440 continue;
1441 for (j = 0; ExtList[j] != NULL; j++) {
1442 if (CheckExtension(FindData.cFileName, ExtList[j])) {
1443 if (FileNamePos == i+1) {
1444 wcscpy(OpenFileName, FindData.cFileName);
1445 i++;
1446 break;
1447 }
1448 i++;
1449 break;
1450 }
1451 }

Callers 1

WndProcFunction · 0.70

Calls 2

GetExtensionFunction · 0.85
CheckExtensionFunction · 0.85

Tested by

no test coverage detected