|
PROCEDURE TForm1.RunRunctionNamesTest(Sender : TObject);
VAR dllname : STRING;
...
VAR dllverinfo : TSSTDllVerInfo;
...
BEGIN
dllname := '';
...
dllverinfo := NIL;
execresult := 0;
...
IF DllHandle = 0 THEN
BEGIN
dllname := SelFileComboBox1.Text;
...
END;
IF loaddllretval = ERROR_SUCCESS THEN
BEGIN
TRY
//Create the TSSTDllVerInfo instance
dllverinfo := TSSTDllVerInfo.Create(dllname);
//Call the function that retrieves and writes the information
//to the TMemo's lines.
execresult := LogDllVersionInfo(dllverinfo, Memo1.Lines);
...
FINALLY
//Free the TSSTDllVerInfo instance
dllverinfo.Free();
END;
END;
...
FUNCTION TForm1.LogDllVersionInfo(adllverinfoinst : TSSTDllVerInfo; astrlist : TStrings) : INTEGER;
//Returns 0 (= ERROR_SUCCESS) upon successful execution, -1 or another non-zero value/error code
//to indicate failure.
//Note, that this function should be called in/from the same thread as the function that
//instantiated the TSSTDllVerInfo object (i.e. "adllverinfoinst").
VAR retval : INTEGER;
VAR newinfoline : STRING;
BEGIN
retval := 0;
newinfoline := '';
IF adllverinfoinst <> NIL THEN
BEGIN
TRY
newinfoline := 'Version information : ';
astrlist.Add(newinfoline);
//Retrieve the string assigned to the ResourceFileDescription version information string-name
newinfoline := 'File description : ' + adllverinfoinst.ResourceFileDescription;
astrlist.Add(newinfoline);
newinfoline := '';
//Retrieve the string assigned to the ResourceProductName version information string-name
newinfoline := 'Product version : ' + adllverinfoinst.ResourceProductName;
astrlist.Add(newinfoline);
newinfoline := '';
//etc.
newinfoline := 'Internal name : ' + adllverinfoinst.RetResourceInternalName;
astrlist.Add(newinfoline);
newinfoline := '';
newinfoline := 'File version : ' + adllverinfoinst.ResourceFileVersion;
astrlist.Add(newinfoline);
newinfoline := '';
newinfoline := 'Language : 0x' + adllverinfoinst.ResourceLanguageIdAsStr;
astrlist.Add(newinfoline);
newinfoline := 'Copyright : ' + adllverinfoinst.ResourceLegalCopyright;
astrlist.Add(newinfoline);
newinfoline := 'Comments : ' + adllverinfoinst.ResourceComments;
astrlist.Add(newinfoline);
newinfoline := 'Special Build : ' + adllverinfoinst.ResourceSpecialBuild;
astrlist.Add(newinfoline);
Memo1.Lines.Add(''); //Add an empty line (i.e. carriage reutrn + line feed)
EXCEPT
retval := -1;
END;
END
ELSE
retval := -1;
LogDllVersionInfo := retval;
END; |