Patrick Allen
Programmer
I have some older source code ( ran on WinXP ) which I need to port to function on Win10. The basis for the code is to construct a list of filenames and list them in a listbox. The source is provided below … but, I need to replace it with similar code that works on the Win10 OS platform(s).
Can someone assist? … MANY THANKS IN ADVANCE
========= WinXP Era D7 Source Code ===================
procedure TfrmFormImport.InitializeFormsList;
var
SearchRec : TSearchRec;
szSearchStr : string;
szTmpStr1, szTmpStr2, szFormsPath : string;
begin
lboxForms.Clear;
szFormsPath := SQLFORMS + '*.sql';
szSearchStr := szFormsPath;
if FindFirst(szSearchStr, faAnyFile, SearchRec) = 0 then begin
szTmpStr1 := SearchRec.Name;
Delete(szTmpStr1, POS('.', szTmpStr1), 4);
szTmpStr2 := Copy(szTmpStr1, 1, Length(szTmpStr1));
if (not DataMod.tblOfflineForms.Locate('TableName', szTmpStr2, [])) then
lboxForms.Items.Add(szTmpStr2);
while FindNext(searchrec) = 0 do begin
szTmpStr1 := SearchRec.Name;
Delete(szTmpStr1, POS('.', szTmpStr1), 4);
szTmpStr2 := Copy(szTmpStr1, 1, Length(szTmpStr1));
if (not DataMod.tblOfflineForms.Locate('TableName', szTmpStr2, [])) then
lboxForms.Items.Add(szTmpStr2);
end;
FindClose(SearchRec);
end;
if lboxForms.Count = 0 then begin
memoSQLText.Clear;
InitializeDataAccessComponents;
end;
end;
Can someone assist? … MANY THANKS IN ADVANCE
========= WinXP Era D7 Source Code ===================
procedure TfrmFormImport.InitializeFormsList;
var
SearchRec : TSearchRec;
szSearchStr : string;
szTmpStr1, szTmpStr2, szFormsPath : string;
begin
lboxForms.Clear;
szFormsPath := SQLFORMS + '*.sql';
szSearchStr := szFormsPath;
if FindFirst(szSearchStr, faAnyFile, SearchRec) = 0 then begin
szTmpStr1 := SearchRec.Name;
Delete(szTmpStr1, POS('.', szTmpStr1), 4);
szTmpStr2 := Copy(szTmpStr1, 1, Length(szTmpStr1));
if (not DataMod.tblOfflineForms.Locate('TableName', szTmpStr2, [])) then
lboxForms.Items.Add(szTmpStr2);
while FindNext(searchrec) = 0 do begin
szTmpStr1 := SearchRec.Name;
Delete(szTmpStr1, POS('.', szTmpStr1), 4);
szTmpStr2 := Copy(szTmpStr1, 1, Length(szTmpStr1));
if (not DataMod.tblOfflineForms.Locate('TableName', szTmpStr2, [])) then
lboxForms.Items.Add(szTmpStr2);
end;
FindClose(SearchRec);
end;
if lboxForms.Count = 0 then begin
memoSQLText.Clear;
InitializeDataAccessComponents;
end;
end;