Login | Register

Registry

September 7, 2006, 18:51 by Calle
[loading]
-->
<b>Question:</b> Hello,

I need somone who is very familliar with registry functions to help me out.

I have a code that is run in the creation code for my main room for me program.

In this program i creat files(actually text files) with the .nmf extension

Anyways,\, a friend of mine made some doe with the registry functions to assosiate this extension with my program and then in turn make these files have y programs icon and when you double click them it opens my program etc and loads them......
Anyways here is the code:

global.num_questions = 0;
reg_check_value=registry_exists_ext(".nmf","";);
if (reg_check_value=false)
{
registry_write_string_ext(".nmf","","NoteMate";);
registry_write_string_ext("NoteMate","","NoteMate File";);
registry_write_string_ext("NoteMateDefaultIcon","",working_directory +
"note-mate.exe";);
registry_write_string_ext("NoteMateshellopencommand","",
working_directory + 'note-mate.exe "%1"');
execute_shell("Note-Mate-Help.htm","";);
}
if (parameter_count()>=1)
{
LoadQuestions(parameter_string(1));
GenerateRandomOrder(global.num_questions);
if (global.num_questions>0) room_goto(test_room);
}


the parameter count stuff just does the loading of the file etc.....

Anyways When I run the progrma for the first time it doesnt do what it is supposed to.... can anyone help?

Mark

<b>Answer:</b> First, to answer you question, you are probably writing to the wrong root directory. Try to write to hkey_classes_root instead, like this:

registry_set_root(2);

Because....

0 = HKEY_CURRENT_USER
1 = HKEY_LOCAL_MACHINE
2 = HKEY_CLASSES_ROOT
3 = HKEY_USERS

For those who are further intrested:

HKEY_CLASSES_ROOT contains information pertaining to OLE (object linking and embedding), file association mappings, Windows shortcuts and some other aspects of the user interface.

In HKEY_CLASSES_ROOT you'll find the names of all registered file types (such as .doc, .exe, .html and so on) and their associated properties. This key is, in fact, a pointer to another subkey, HKEY_LOCAL_MACHINE\Software\Classes.

HKEY_CURRENT_USER contains user-specific information. The contents of this key are derived from information in the HKEY_USERS key at logon time.

HKEY_LOCAL_MACHINE contains computer-specific information, including info about installed hardware and software settings. The information in this key is used by all users of the computer.

HKEY_USERS contains user information such as default application settings, desktop configuration and so on. Some of the information is user-specific and some is available to all users of the computer. The default, generic settings are stored in a subkey HKEY_USERS\.DEFAULT. A new subkey is created for each user who logs onto the computer. At first, that new subkey contains a copy of the contents of the .DEFAULT subkey. As the user changes desktop and application settings, those changes are stored in the user's subkey.

HKEY_CURRENT_CONFIG handles Plug & Play settings and information about multiple hardware configurations. Settings in this key are derived from a subkey of HKEY_LOCAL_MACHINE\Config.

HKEY_DYN_DATA maintains a dynamic record of the current status of the computer.

Comments

Loading comments... [loading]
.
Users logged in:

game maker articles, game maker examples, game maker tutorials, gmtutorials, game maker questions and answers, game maker crash course, how to create games