Solved

Writing to the registry in Windows 95

Posted on 2001-07-04
3
128 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 200 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

Is Your Active Directory as Secure as You Think?

More than 75% of all records are compromised because of the loss or theft of a privileged credential. Experts have been exploring Active Directory infrastructure to identify key threats and establish best practices for keeping data safe. Attend this month’s webinar to learn more.

Question has a verified solution.

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

Introduction Raise your hands if you were as upset with FireMonkey as I was when I discovered that there was no TListview.  I use TListView in almost all of my applications I've written, and I was not going to compromise by resorting to TStringGrid…
In my programming career I have only very rarely run into situations where operator overloading would be of any use in my work.  Normally those situations involved math with either overly large numbers (hundreds of thousands of digits or accuracy re…
Along with being a a promotional video for my three-day Annielytics Dashboard Seminor, this Micro Tutorial is an intro to Google Analytics API data.
Sending a Secure fax is easy with eFax Corporate (http://www.enterprise.efax.com). First, just open a new email message. In the To field, type your recipient's fax number @efaxsend.com. You can even send a secure international fax — just include t…

920 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

Need Help in Real-Time?

Connect with top rated Experts

14 Experts available now in Live!

Get 1:1 Help Now