This is a ghetto way to detect if the file you opened is .net
Requirements:
2 buttons
1 memo
1 TOpenDialog
Tut:
place 2 buttons on the form with a memo and click on the main form to see the code.
Now go back to your designer:
Name button 1 'Open EXE' with out single quotes. click on Open EXE to see code and paste this:
Code:
Now go back to your designer:
Name button2 to 'Check EXE' with out single quotes. click on Check EXE to see code and paste this:
place this before the begin within the procedure:
Code:
var
find: TStringList;
Code:
Requirements:
2 buttons
1 memo
1 TOpenDialog
Tut:
place 2 buttons on the form with a memo and click on the main form to see the code.
Now go back to your designer:
Name button 1 'Open EXE' with out single quotes. click on Open EXE to see code and paste this:
Code:
Code:
self.OpenDialog1.Execute();
//the functon below i grabbed online and it dumps all the ansi to a file allow me to sort through and find the text im look for.
FindASCIIStrings(self.OpenDialog1.FileName, 2, IncludeTrailingPathDelimiter(ExtractFilePath(paramstr(0))) + ExtractFileName(paramstr(1)) + 'check.txt');
memo1.Lines.Add('>> ' + OpenDialog1.FileName + ' Has Been Processed and is waiting for user action.');
Now go back to your designer:
Name button2 to 'Check EXE' with out single quotes. click on Check EXE to see code and paste this:
place this before the begin within the procedure:
Code:
var
find: TStringList;
Code:
Code:
find:= Tstringlist.Create;// create the object
Find.LoadFromFile('check.txt'); //loads and store the test in the tstring list via memory
if Pos('.NET Framework 4.5', Find.Text) or Pos('.NET Framework 4', Find.Text) or Pos('v2.0.50727', Find.Text) = 0 then // i only add from 4.5 and below.
memo1.Lines.Add('>> File is native and does not require the .NET Framework.')
else
memo1.Lines.Add('>> .NET Framework Detected');
