Home · News · FAQ · Forums · Privacy Policy · Members List · Contact December 14 2018 22:49:15
Login

Username

Password


Not a member yet?
Click here to register.

Forgotten your password?
Request a new one here.
Games
Manic Miner
Blagger
Jet Set Willy
Crossroads II
The Brick Maze
Escape From ASCII Castle
Third-party showcase
Mountain Party
The Pyramid Maze
Many more...
Other things
Hangman
Delphi Tips/Tutorials
Word Search Generator
Last Seen Users
gascoyne02:44:04
yaya201711:55:10
andrewbroad20:21:59
magnus22:09:47
mickheaton 1 day
whammydiver 3 days
matt 3 days
fred 5 days
aplheating 5 days
discusb 5 days
sonnuvah 1 week
Shoutbox
You must login to post a message.

kinggeary
22 November 2018
Manic miner rules

pinglub007
31 July 2018
Last time I played JSW I was 12 yo... it was something like 33 years ago. Thanks fot this atmospheric revival

elhasnaouymed
30 June 2018
This is just a test message i am happy to join Hellow world!

libteen
17 June 2018
I need more lives on manic miner aaaarg

matt
09 June 2018
Hopefully it was just a temporary blip... Crossroads seems to be working now!

gascoyne
25 May 2018
Crossroads seems to have stopped working.

matt
20 November 2017
Having trouble playing the Java games? You'll probably need to use Internet Explorer - Firefox and Chrome no longer support Java. http://www.darnkitty.com/
java-help.php


megawolt
24 January 2017
Hi, guys! Nice to see you still playing here, it is hard to understand the kind of hobby)) but it is great

michael57
26 November 2016
CINDERELLA AIDAN

flakothedog
25 September 2016
Been a while (3 years). Good to see the all-time records are still going strong.

matt
14 May 2016
JAVA problems? Games won't load? Please go here: http://www.darnkitty.com/
java-help.php


xzavierg
05 April 2016
im the best the king of the brick maze

frankef
27 September 2015
hello

megawolt
11 August 2015
Back to second division battles))

gascoyne
21 March 2015
Back from hols & I see the top of the table battle has been hotting up....work to do!

Shoutbox Archive

Delphi Tips and Tutorials
Tip #2: Saving the position and size of a window between instances

If you want to save the position of your window so that it starts up in the same place as when the user closed it down, the following code will save the window position to the registry. You could put a call to SaveFormPositionToRegistry in the FormDestroy event of your main form. Change the registry key to something more appropriate to your application.

  procedure TfrmExample.SaveFormPositionToRegistry;
  var
    r: TRegistry;
  begin
    r := TRegistry.Create;
    try
      r.RootKey := HKEY_CURRENT_USER;
      if r.OpenKey('\Software\darnkitty.com\Example\Options', True) then
      begin
        r.WriteInteger('PosTop', Top);
        r.WriteInteger('PosLeft', Left);
        r.WriteInteger('PosWidth', Width);
        r.WriteInteger('PosHeight', Height);
        r.CloseKey;
      end;
    finally
      r.Free;
    end;
  end;

The following code will read in the saved values and position the window in the correct place. Once again, change the registry key to something more appropriate to your application.

  procedure TfrmExample.LoadFormPositionFromRegistry;
  var
    r: TRegistry;
  begin
    r := TRegistry.Create;
    try
      r.RootKey := HKEY_CURRENT_USER;
      r.Access := KEY_READ;
      if r.OpenKey('\Software\darnkitty.com\Example\Options', False) then
      begin
        try
          Top := r.ReadInteger('PosTop');
          Left := r.ReadInteger('PosLeft');
          Width := r.ReadInteger('PosWidth');
          Height := r.ReadInteger('PosHeight');
        except
        end;

        r.CloseKey;
      end;
    finally
      r.Free;
    end;
  end;

You would put a call to LoadFormPositionFromRegistry in the FormCreate event of your main form. Remember also to add the Registry unit to the uses clause in your form or else the code will not compile.

Note that there is a try..except block around the ReadIntegers. This is to cover the chance that the key exists and is successfully opened, but the four integers do not exist yet (this may happen the first time the user runs the application). Since this is purely a cosmetic procedure, in my opinion, there is no need to re-raise any exception or otherwise do anything with it.

<< Previous tip Back to tips and tutorials Next tip >>
Google





Current high scores    

 Manic Miner
discusb59839
gascoyne40420
magnus34312
mickheaton33228
russ129127509
fred14780
more... 
 Crossroads II
sonnuvah479455
gascoyne435765
russ1291354450
matt161840
fred132885
rolby125700
more... 
 Jet Set Willy
gascoyne12m4953
more... 
 Blagger
more... 
 The Brick Maze
russ129133865
gascoyne13400
more... 
 ASCII Castle
gascoyne1070
more... 
 JSW Endurance
more... 
Games developed by g2 Ltd Powered by PHP-Fusion version 6 © 2003-2005