Solved

Writing to the registry in Windows 95

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

How your wiki can always stay up-to-date

Quip doubles as a “living” wiki and a project management tool that evolves with your organization. As you finish projects in Quip, the work remains, easily accessible to all team members, new and old.
- Increase transparency
- Onboard new hires faster
- Access from mobile/offline

Join & Write a Comment

In this tutorial I will show you how to use the Windows Speech API in Delphi. I will only cover basic functions such as text to speech and controlling the speed of the speech. SAPI Installation First you need to install the SAPI type library, th…
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 this tutorial you'll learn about bandwidth monitoring with flows and packet sniffing with our network monitoring solution PRTG Network Monitor (https://www.paessler.com/prtg). If you're interested in additional methods for monitoring bandwidt…
Polish reports in Access so they look terrific. Take yourself to another level. Equations, Back Color, Alternate Back Color. Write easy VBA Code. Tighten space to use less pages. Launch report from a menu, considering criteria only when it is filled…

762 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

16 Experts available now in Live!

Get 1:1 Help Now