i am working on a application in Delphi 7
that will run and display the the log created by FastMM4.pas
.
The application will be installed anywhere on the system. I have modified the FastMM4.pas
so that it will CreateProcess
(inshort execute my application)
The code from my previous Question and Sertac Akyuz's answer
The leakTracker.exe
will take in the fastmm4's log file as the parameter and open the file and display. The modified fastMM4.pas
will be used in any other application.
Procedure OpenTheLeakReader
begin
CmdLine := 'C:\Program Files\leakTracker\leakTracker.exe "';
lstrcat(CmdLine,CTheArGuements );
ZeroMemory(@SInfo, SizeOf(SInfo));
SInfo.cb := SizeOf(SInfo);
CreateProcess(nil, CmdLine, nil, nil, False, NORMAL_PRIORITY_CLASS, nil, nil, sInfo, pInfo);
end;
This works fine but i have hardcoded the path
because to get my application path..
[FastMM4] -cannot use SysUtils.pas //*1
-cannot use Registry.pas //*2
-cannot use ParamStr(0) //*3
-cannot use unitWithSysRegis //*4
[someAplicationWhichWillUseFastMM4] -Uses FastMM4.pas
in the FAstMM4.pas
finalization
i have this
if ifLeakedMemory then OpenTheLeakReader;
since i cannot have
*1 - SysUtils.pas
- in FastMM4.pass as this will un-install fastmmm4
*2 - Registry.pas
- to search leakTracker
installation path but will uninstall fastmm4
*3 - paramstr(0)
- it gives a error at the close of application.
*4 - unitWithSysRegis
- with SysUtils,Registry also not possible in Fastm4 uses clause.
So I am stuck as how to get the path of leakTracker.exe
and send the path of the log file to the `leakTracker.exe' through CreateProcess.
windows
unit? It hasRegOpenKeyEx
,RegGetValueEx
etc. If not, you could copy the definitions from there. – Blorgbeard