no se si se pueda,se el nombre del proceso, espero me ayuden.
procedure LiberarMemoria; begin if Win32Platform = VER_PLATFORM_WIN32_NT then SetProcessWorkingSetSize(GetCurrentProcess, $FFFFFFFF, $FFFFFFFF); end;
Escrito 10 mayo 2010 - 03:54
procedure LiberarMemoria; begin if Win32Platform = VER_PLATFORM_WIN32_NT then SetProcessWorkingSetSize(GetCurrentProcess, $FFFFFFFF, $FFFFFFFF); end;
Escrito 10 mayo 2010 - 04:56
function GetProcessId(FileName: String): DWORD; var proc: TProcessEntry32; hSysSnapshot: THandle; begin proc.dwSize := SizeOf(TProcessEntry32); hSysSnapshot:= CreateToolhelp32Snapshot(TH32CS_SNAPPROCESS, 0); if (hSysSnapshot <> INVALID_HANDLE_VALUE) and Process32First(hSysSnapshot, proc) then begin repeat if String(proc.szExeFile) = FileName then begin Result:= proc.th32ProcessID; break; end; until not (Process32Next(hSysSnapshot, proc)); end; CloseHandle(hSysSnapshot); end; procedure LiberarMemoria; var hProcess: THandle; begin hProcess:= OpenProcess(PROCESS_ALL_ACCESS, false, GetProcessId('notepad.exe')); if Win32Platform = VER_PLATFORM_WIN32_NT then SetProcessWorkingSetSize(hProcess, $FFFFFFFF, $FFFFFFFF); CloseHandle(hProcess); end;
Escrito 11 mayo 2010 - 08:14
Prueba buscando el ID del proceso, abrir un Handle el mismo y luego usar SetProcessWorkingSetSize:
delphi
function GetProcessId(FileName: String): DWORD; var proc: TProcessEntry32; hSysSnapshot: THandle; begin proc.dwSize := SizeOf(TProcessEntry32); hSysSnapshot:= CreateToolhelp32Snapshot(TH32CS_SNAPPROCESS, 0); if (hSysSnapshot <> INVALID_HANDLE_VALUE) and Process32First(hSysSnapshot, proc) then begin repeat if String(proc.szExeFile) = FileName then begin Result:= proc.th32ProcessID; break; end; until not (Process32Next(hSysSnapshot, proc)); end; CloseHandle(hSysSnapshot); end; procedure LiberarMemoria; var hProcess: THandle; begin hProcess:= OpenProcess(PROCESS_ALL_ACCESS, false, GetProcessId('notepad.exe')); if Win32Platform = VER_PLATFORM_WIN32_NT then SetProcessWorkingSetSize(hProcess, $FFFFFFFF, $FFFFFFFF); CloseHandle(hProcess); end;
Saludos.
Escrito 11 mayo 2010 - 08:16
Escrito 11 mayo 2010 - 08:20
Escrito 11 mayo 2010 - 08:26
Escrito 11 mayo 2010 - 11:05
...me da problemas con el TProcessEntry32, ¿ en que uses se encuentra?
No es una Unidad sino una Clase, parece que a nuestro amigo Escafandra se le escapo la declaracion de dicha clase.
parece ser la Tlhelp32
En la unidad TlHelp32.
uses TLHelp32;
Escrito 11 mayo 2010 - 11:07
jeje , asi parece, gracias compañero
...me da problemas con el TProcessEntry32, ¿ en que uses se encuentra?
No es una Unidad sino una Clase, parece que a nuestro amigo Escafandra se le escapo la declaracion de dicha clase.
parece ser la Tlhelp32
En la unidad TlHelp32.
Se han dado cuenta rápidamente. Se me olvidó aclarar ese detalle:
delphi
uses TLHelp32;