Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations SkipVought on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Tripping Over Simplicity with Delphi 7

Status
Not open for further replies.

BillKilgore

Programmer
Mar 17, 2002
60
0
0
US
Hello All,

I put together a little routine that takes two similar .txt files, loads their data into two separate arrays, compares the two arrays, updates one array based on the data from the comparison, and writes out the updated array to one of the .txt files. This is a stand-alone project utilizing a single small .pas routine that compiled OK with one warning, "Unit 'FileCtrl' is specific to a platform ." The
FileCtrl always reappears during a save or a compile after having been deleted manually.

(I think that is a separate issue from the main problem. I'll deal with it later but thought I should
mention it just in case.)

Sounds simple and wasn't too hard to do but when I go to run it from my Delphi 7 editor on a Dell Vostro 1400 with Vista business I get the runtime error, "Unable to create process: The requested operation requires elevation." I don't understand what is meant by "elevation." The pascal program shows as being part of the associated project and the project code looks the same as other projects that do run. I've never encountered this before.
My question do any of you have any idea what this is about and how to go about over coming it?

This thing started out so simple and now it's a big deal.

Thank you for sticking with me to this point.

Bill Kilgore
 
the code you made must be using some API function in behind that is flagged by W7/Vista operation that needs elevated privileges, this is UAC at work.
For example copying a file could trigger UAC.
To run the project under D7 you must run D7 as administrator (right click the icon).

Cheers,
Daddy

-----------------------------------------------------
What You See Is What You Get
Never underestimate tha powah of tha google!
 
One other comment - Do your files have to be in arrays? When working with a plain text file, here's the easiest way I've seen:

Code:
procedure CompareFiles(File1, File2: String);
var
  L1, L2: TStringList; //Represents a list of strings
  X: Integer; //Used for the loop
  Line1, Line2: String; //Used to temporarily store an individual line from each file
begin
  L1:= TStringList.Create; //Create list objects
  L2:= TStringList.Create;
  try
    L1.LoadFromFile(File1);
    L2.LoadFromFile(File2);
    //NOTE - This assumes both lists have same number of lines.
    //Additional protection needed if line count is different
    for X:= 0 to L1.Count - 1 do begin //Loop through each line
      Line1:= L1[X]; //Get Line # X from each file
      Line2:= L2[X];
      //Do something to compare Line1 with Line2

    end;
  finally
    L1.Free; //Free list objects
    L2.Free;
  end;
end;

As for your specific problem, whosrdaddy is right, this is windows security preventing you from saving a file.


JD Solutions
 
Many thanks! I never thought that this problem superceded the Delphi environment. I recently downloaded some updates for my Op Sys and probably screwed ut up then. This also answers some other problems I'ce been having.
The reason used arrays is because one of the files is ~200 lines and the other is ~3000+. That and the fact that I was re-writing the second based on data I derived from the first. I arrayed the data from the first because eventually I will use that to re-write the first to eliminate repeats.
Well, now to adjust my Defender!

Thanks again, Bill Kilgore
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top