?
Solved

Writing to the registry in Windows 95

Posted on 2001-07-04
3
Medium Priority
?
136 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
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
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

The uses clause is one of those things that just tends to grow and grow. Most of the time this is in the main form, as it's from this form that all others are called. If you have a big application (including many forms), the uses clause in the in…
This article explains how to create forms/units independent of other forms/units object names in a delphi project. Have you ever created a form for user input in a Delphi project and then had the need to have that same form in a other Delphi proj…
NetCrunch network monitor is a highly extensive platform for network monitoring and alert generation. In this video you'll see a live demo of NetCrunch with most notable features explained in a walk-through manner. You'll also get to know the philos…
Add bar graphs to Access queries using Unicode block characters. Graphs appear on every record in the color you want. Give life to numbers. Hopes this gives you ideas on visualizing your data in new ways ~ Create a calculated field in a query: …
Suggested Courses
Course of the Month11 days, 21 hours left to enroll

752 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