Can't rename a registry key


Can somebody tell me why this does not work: begin //save settings to relevent registry key Reg := TRegistry.Create; try Reg.RootKey := HKEY_CURRENT_USER; if CurrentPlace PlaceNames.Text then begin //key has been renamed if Reg.OpenKey(PROGKEY, False) then begin Reg.RenameValue(CurrentPlace, PlaceNames.Text); ...
Posted On: Thursday 22nd of November 2012 11:16:55 PM Total Views:  85
View Complete with Replies

RELATED TOPICS OF Delphi Programming PROGRAMMING LANGUAGE




How to rename a directory in Delphi

I can only find a procedure to rename files in the documentation.
VIEWS ON THIS POST

76

Posted on:

Thursday 20th September 2012
View Replies!

Possible to rename or move file being used by other process?

h3305 wrote: > Is there a way to gain access to a file created within my app but which > hasn't been released by the process that created it > > There is a temp file created by a 3rd-party component (XLSReadWrite) > used in my app. Apparently the component doesn't release the file until > the app closes. > > The problem is that my app optionally calls another app built with the > same 3rd-party component, which tries to create another temp file with > the same name and location and gets blocked by an "I/O 32" error. > > I know exactly when my first app runs the second app, and can detect > when the second app is finished (during which time the first app does > not need to do anything but wait.) So if I could get control of the > file, I could change its name temporarily and then change it back > afterwards. But even within the app that created it, I can't seem to > get control of the file. (Of course, I could try to rewrite the 3rd- > party component, but that is asking for trouble). > > Is there any way (other than rewriting the 3rd-party component) that I > can gain access to the file within the app where it is created to either > move it or rename it temporarily while the 2nd app runs and closes What you want to do it _close the handle_ that the component has open. It's possible that you could get a list of the handles your process has open, and then figure out which one refers to the disk file that the other program wants to use. Then you could call CloseHandle on it. I don't know how to get a list of open handles, though. Even if you could do all that, the component in your program wouldn't know about it. It would still have a field that holds the original file-handle value, and it would still think that the file is open. It's left with a stale handle value, so any further attempts to use that file will fail in your program. Rewriting the component isn't asking for trouble. It's asking for the right solution. There are well established ways of getting temporary files, and that component isn't using them. Call GetTempPath and then GetTempFileName. The latter will generate a unique name, and then it can create the file, guaranteeing that no other calls to GetTempFileName will accidentally generate the same name. You have the source code, right Find the place where it generates or uses the file name and use the above functions to generate a unique one instead. It's also reasonable for you to request that the vendor fix both the component and the other application. -- Rob
VIEWS ON THIS POST

112

Posted on:

Friday 21st September 2012
View Replies!

Reading a different computer's registry file

I have a user.dat registry file from a dead Win98 machine. What is the best way for me to open the file and extract out bits of data that I need I'm assuming the registry api's only work with the machine you are on and with the LIVE registry files. -- Best regards, Harold , "Remy Lebeau (TeamB)" wrote in message > Then you only have a portion of the Registry. You need system.dat as well. Yes I have that one too. > From a programming standpoint (since you did post this to a programming > newsgroup), you would have to open and parse the file manually. Or use a Yeah I wanted to write a program to read the keys out I wanted. the registry components I've seen seem to work only on the machine's registry where I am running the program. Can't get it to open another file, like one of the .dat files.
VIEWS ON THIS POST

157

Posted on:

Thursday 27th September 2012
View Replies!

Console app 'Press any key to continue...'?

How can I wait for a key to be pressed in a console application without the key being printed in the screen At the moment I am using readln; to pause execution. But its a bit unprofessional because the user can type whatever garbage they want all over the screen before pressing enter. Is there a way I could implement a 'Press any key to continue...' style behavior
VIEWS ON THIS POST

114

Posted on:

Wednesday 3rd October 2012
View Replies!

Msg of escape key?

Can someone help me: How to check that the Msg param of IsShortCut is the escape key Rael
VIEWS ON THIS POST

31

Posted on:

Saturday 6th October 2012
View Replies!

Iterating over an Ini file and all it's keys

I maintain a program which still uses INI files, so whenever we release a new update, all the old ini files get overwritten with blank fresh ones, meaning the user loses all their preferences. It would be simple to just not write over the ini files, but I also don't know if they've changed names, keys have been added, removed, etc. So what I've started going is I go through all the ini files the first time the program is run, and it looks at the old versions' ini files and sees if it can find one with the same name, if it does it fills any values in the old one it can find that are also in the new version's ini. My only problem is that I am getting they keys of the ini files of which I'm checking and writing by using ReadSections then ReadSection, which gives me all the sections and all the keys in each section. Only problem is I have some INI files without sections. Yep, just plain key=value. So I can't do ReadSection which would normally give me all the key names. How can I find key names when I'm not using sections. And yes I know it should be I'm not rewriting the program just maintaining and adding on to it. - Dan
VIEWS ON THIS POST

38

Posted on:

Monday 8th October 2012
View Replies!

keypress delay

g'day all , I am reading keypresses using the forms onkeydown event to move an graphic on an image(like a sprite in a game)..Is there a way of eliminating that small delay before the key press repeats.
VIEWS ON THIS POST

31

Posted on:

Tuesday 9th October 2012
View Replies!

Where is the install key for Interbase 2007 located?

I have Interbase 2007 on my Delphi 2007 Enterprise CD but it asks for a serial number and key code that I don't see anywhere on anything Codegear shipped me. How do I find the key for interbase I only have the keys for the main Delphi/CodegearDevelopmentStudio (enterprise) stuff. Warren Postma
VIEWS ON THIS POST

38

Posted on:

Tuesday 9th October 2012
View Replies!

Customising keyboard shortcuts

Is there any way to customise the keyboard shortcuts or create your own mappings in Delphi 2007 -- Toby
VIEWS ON THIS POST

27

Posted on:

Tuesday 9th October 2012
View Replies!

Controlling where Alt keyboard input goes

This is a bit different than my last thread, and seems to need it's own format. I have an SDI application that actually has multiple forms open, but only one shown. To show the correct form, I use the following code snippet : FActiveModules.CurrentModule.Module.Parent := pParent; FActiveModules.CurrentModule.Module.align := alClient; FActiveModules.CurrentModule.Module.Show; where pParent is a panel that sits on the mainform and shows the form the user is acessing. Each form has a series of buttons, each with hot keys. I've noticed that if I open and display form1, and then open and display form2, that if the user hits a hot key that sites on form1, the form1 button will fire. It seems that the hot key searching is looking through all the active forms embedded in the main form in the application and runs the first one it finds which makes sense. However, in this case, it's not what I want. I've searched around on Google, but couldn't find anything relating to this. Is there a way to limit where the hot key search looks before stopping I tried setting the form1.parent to nil at runtime, but it didn't work. I guess I could remove the forms from the application list, but I don't think that's a great idea, nor do I think it'll work. I looked at the CM_DialogChar handler, but I want to skip the hotkey for all forms, except the active form, and the key handling doesn't look like it provides this ability. Is there a way to do this Paul
VIEWS ON THIS POST

38

Posted on:

Tuesday 16th October 2012
View Replies!

Reading a different computer's registry file

I have a user.dat registry file from a dead Win98 machine. What is the best way for me to open the file and extract out bits of data that I need I'm assuming the registry api's only work with the machine you are on and with the LIVE registry files. -- Best regards, Harold , "Remy Lebeau (TeamB)" wrote in message > Then you only have a portion of the Registry. You need system.dat as well. Yes I have that one too. > From a programming standpoint (since you did post this to a programming > newsgroup), you would have to open and parse the file manually. Or use a Yeah I wanted to write a program to read the keys out I wanted. the registry components I've seen seem to work only on the machine's registry where I am running the program. Can't get it to open another file, like one of the .dat files.
VIEWS ON THIS POST

96

Posted on:

Tuesday 16th October 2012
View Replies!

Compile fails: Unable to rename xxx.~pas

> Seen exactly the same here. A pity, as I would really like to have my > .PAS files indexed. I just stop Copernic, finish Delphi, and restart > Copernic. > > Have you reported the problem I feel someone should. Never seen the point of indexers - a full text search of files on my c: drive doesn't take that long Cheers, Chris , Chris Morgan wrote: >> Seen exactly the same here. A pity, as I would really like to have my >> .PAS files indexed. I just stop Copernic, finish Delphi, and restart >> Copernic. >> >> Have you reported the problem I feel someone should. > > Never seen the point of indexers - a full text search of files > on my c: drive doesn't take that long Does it give you the results before you're even finished typing the word you want to search for Google Desktop Search does. -- Rob , "Rob Kennedy" wrote in message news:475875dc@newsgroups.borland.com... > Chris Morgan wrote: >>> Seen exactly the same here. A pity, as I would really like to have my >>> .PAS files indexed. I just stop Copernic, finish Delphi, and restart >>> Copernic. >>> >>> Have you reported the problem I feel someone should. >> >> Never seen the point of indexers - a full text search of files >> on my c: drive doesn't take that long > > Does it give you the results before you're even finished typing the word > you want to search for Google Desktop Search does. But thats google not coppernic. Besides, indexing basically boils down to a list of files which is continually monitored for changes to files, filenames etc. It isn't really fiar to call it a true search like the windows search feature which does it live in real time. , >> Never seen the point of indexers - a full text search of files >> on my c: drive doesn't take that long > > Does it give you the results before you're even finished typing the word > you want to search for Google Desktop Search does. > Why do I need that I'd rather wait 30 secs when I need to search for something, rather than have the constant overhead of an unecessary file monitor running all the time. Cheers, Chris
VIEWS ON THIS POST

101

Posted on:

Tuesday 16th October 2012
View Replies!

Code Monkeys

lol. Hope you enjoy this as much as I did....(its clean http://www.youtube.com/watchv=v4Wy7gRGgeA --
VIEWS ON THIS POST

26

Posted on:

Tuesday 16th October 2012
View Replies!

Where is the install key for Interbase 2007 located?

I have Interbase 2007 on my Delphi 2007 Enterprise CD but it asks for a serial number and key code that I don't see anywhere on anything Codegear shipped me. How do I find the key for interbase I only have the keys for the main Delphi/CodegearDevelopmentStudio (enterprise) stuff. Warren Postma
VIEWS ON THIS POST

21

Posted on:

Tuesday 16th October 2012
View Replies!

Customising keyboard shortcuts

Is there any way to customise the keyboard shortcuts or create your own mappings in Delphi 2007 -- Toby
VIEWS ON THIS POST

28

Posted on:

Tuesday 16th October 2012
View Replies!

are there hotkeys for setting and navigating through code?

are there any hotkeys for setting and navigating through code in the source editor for D7
VIEWS ON THIS POST

61

Posted on:

Tuesday 16th October 2012
View Replies!

Saving list box values to the registry

Hi , whats the best way to save a list boxes values to the registry. I know I could cycle through each one, but i think there's a better way. Any ideas Cheers, Paul...
VIEWS ON THIS POST

93

Posted on:

Saturday 10th November 2012
View Replies!

Unique key per machine / instance

In my client / server application I need a unique key for each instance of the application on all machines in a local network. I thought about a combination of the local IP address and the Application.Handle. Is this ok ...
VIEWS ON THIS POST

33

Posted on:

Saturday 10th November 2012
View Replies!

How usb key letter assigned?

I would like to know how letter (disk drive letter) are assigned to USB port when we attach a USB key to a computer. It looks like USB key always get the same letter - which is fine (is it ...
VIEWS ON THIS POST

29

Posted on:

Thursday 22nd November 2012
View Replies!

OnKeyDown and Arrow keys

Why would the Arrow keys not fire the OnKeyDown event of a form They do so with new applications that I create, but I can't get them to fire on the main form of an existing app. TIA, Glynn -- ...
VIEWS ON THIS POST

38

Posted on:

Thursday 22nd November 2012
View Replies!