[Okta Webinar] Learn how to a build a cloud-first strategyRegister Now

x
?
Solved

Writing to the registry in Windows 95

Posted on 2001-07-04
3
Medium Priority
?
141 Views
Last Modified: 2010-04-06
I have written an application that uses the windows registry to store an integer value, and when required, read and modify that integer value.

 The Following code shows this, Note that "<Registry Path>" represents the path to the applications Registry Key.


      Reg := TRegistry.Create;
      with Reg do
        begin
          try
            begin
              Rootkey := HKEY_LOCAL_MACHINE;
              OpenKey(<Registry Path>,True);
              if not ValueExists('IntegerValue') then
                begin
                  WriteInteger('IntegerValue',0);
                  BookingStatsReportCount := 0;
                end
              else
                begin
                  BookingStatsReportCount := ReadInteger('98');
                end;
              Reg.CloseKey;
            end;
          finally
            Reg.Free;
          end;
        end;

This code works fine for Windows 98, Me, and NT4, but when the application is installed and run in windows 95 I get a runtime error like:

"Error:      Failed to set data 'IntegerValue'   Data was not written"

Is there something with the registry in Windows 95 that is different to later versions?

 If so, How can I get around this problem other than recommending that the application not be run under windows 95?
0
Comment
Question by:geofizzydrink
3 Comments
 
LVL 13

Expert Comment

by:Epsylon
ID: 6251674
What does ReadInteger('98') do? Does the key '98' exist?
0
 
LVL 4

Accepted Solution

by:
jsweby earned 600 total points
ID: 6251695
I have often come across the error "Failed to set data for <KEY>" & it has always, without fail, been the following problem (which doesn't sound applicable to you but I thought I'd share it with you in case it helps):

This always comes up for us on NT workstations where the administrator has not allowed the user to modify the registry; each individual key can be set on NT Server to be modified or not by particular users. If your 95 machine which has the problem is part of an NT network, make sure the users have registry permissions, at the very least for the key(s) you want to change. The program on NT Server is called regsvr32.

J.
0
 
LVL 11

Expert Comment

by:Goodangel Matope
ID: 6252121
You can try to use TRegIniFile instead of TRegistry, It was meant for use with Windows 3.x but it works with Win95. That was what I used to use for Win95 applications.
0

Featured Post

Technology Partners: We Want Your Opinion!

We value your feedback.

Take our survey and automatically be enter to win anyone of the following:
Yeti Cooler, Amazon eGift Card, and Movie eGift Card!

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Introduction The parallel port is a very commonly known port, it was widely used to connect a printer to the PC, if you look at the back of your computer, for those who don't have newer computers, there will be a port with 25 pins and a small print…
Introduction I have seen many questions in this Delphi topic area where queries in threads are needed or suggested. I know bumped into a similar need. This article will address some of the concepts when dealing with a multithreaded delphi database…
Please read the paragraph below before following the instructions in the video — there are important caveats in the paragraph that I did not mention in the video. If your PaperPort 12 or PaperPort 14 is failing to start, or crashing, or hanging, …
As many of you are aware about Scanpst.exe utility which is owned by Microsoft itself to repair inaccessible or damaged PST files, but the question is do you really think Scanpst.exe is capable to repair all sorts of PST related corruption issues?
Suggested Courses
Course of the Month19 days, 3 hours left to enroll

834 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question