campo-sirio/ba/ba0close.cpp
guy 66a85ef230 Patch level : 2.0 476
Files correlati     : ba0.exe ba1.exe ba0200a.msk
Ricompilazione Demo : [ ]
Commento            :

ba0, ba0200a.msk:
aggiunta la possibilita' di escludere le immagini di sfondo
per velocizzare navigazione menu su macchhine lente o in teleassistenza

ba1, ba0close:
aggiunto il supporto per l'aggiornamento delle DLL


git-svn-id: svn://10.65.10.50/trunk@11186 c028cbd2-c16b-5b4b-a496-9718f37d4682
2003-05-26 13:00:26 +00:00

53 lines
1.4 KiB
C++
Executable File

#include <windows.h>
#include <stdio.h>
int PASCAL WinMain(HINSTANCE, HINSTANCE , LPSTR, int)
{
::Sleep(1000); // Apetta un secondo che termini ba0.exe
WIN32_FIND_DATA data;
HANDLE hHandle = ::FindFirstFile("*.??_", &data);
BOOL bRunning = hHandle != INVALID_HANDLE_VALUE;
while (bRunning)
{
const char* newext = NULL;
const char* oldpath = data.cFileName;
char drive[_MAX_DRIVE], path[_MAX_PATH], fname[_MAX_FNAME], ext[_MAX_EXT];
_splitpath(oldpath, drive, path, fname, ext);
if (stricmp(ext, ".ex_") == 0)
newext = ".exe"; else
if (stricmp(ext, ".dl_") == 0)
newext = ".dll";
if (newext != NULL)
{
char newpath[_MAX_PATH];
_makepath(newpath, drive, path, fname, newext);
if (::CopyFile(oldpath, newpath, FALSE))
{
::DeleteFile(oldpath);
}
else
{
char msg[512];
LPVOID lpMsgBuf;
FormatMessage(
FORMAT_MESSAGE_ALLOCATE_BUFFER | FORMAT_MESSAGE_FROM_SYSTEM | FORMAT_MESSAGE_IGNORE_INSERTS,
NULL, GetLastError(), MAKELANGID(LANG_NEUTRAL, SUBLANG_DEFAULT), // Default language
(LPTSTR) &lpMsgBuf, 0, NULL);
sprintf(msg, "Impossibile ridenominare il file %s in %s:\n%s",
oldpath, newpath, lpMsgBuf);
::LocalFree(lpMsgBuf);
::MessageBox(NULL, msg, "Errore", MB_ICONERROR | MB_OK);
}
}
bRunning = ::FindNextFile(hHandle, &data);
}
return 0;
}