Thread: Some reg editing help please...

  1. #1
    Registered User
    Join Date
    Aug 2004
    Posts
    731

    Some reg editing help please...

    Ok first off. I know what your going to say, "You should learn this and this before you do that". I know I should but I want to skip the stuff I won't use right now and get on to something I will use. I amtrying to make a preogram delete a certain key. Now I heard of this website that tells the functions for it all, but I'm not sure if I am doing any of it right. Well just look at the start of the code...


    Code:
    #include <iostream.h>
    #include <conio.h>
    #include <cstdlib>
    int main()
    {
        LONG RegConnectRegistry(mycomputername,HKEY_CURRENT_USER,PHKEY phkResult);
        LONG RegDeleteKey(HKEY_CURRENT_USER,Test Key);
        getch();
        return 0;
    }

    Yes I did put extra #include files in it because I will use them later. But it says there is a syntaxt error before the ( in the the LONG RegConnectRegistry line.

    There is also this error I had before and is relly bugging me...
    ` LONG' undeclared (first use this function)

    Soo.... say anything you want but I would perfer just a little help please...

    Thank you.

    Edit: I think I may have put this post in the wrong forum. Oops...

    Edit Edit: And yes I know I need more functions to make this work but first I need to know what is wrong here.
    Last edited by Rune Hunter; 08-22-2004 at 11:22 AM.

  2. #2
    erstwhile
    Join Date
    Jan 2002
    Posts
    2,227
    >>I know what your going to say, "You should learn this and this before you do that".<<

    And you would be completely correct.

    >> I want to skip the stuff I won't use right now<<

    Like the fundamentals.

    The reason that people recommend you learn fundamentals and have a minimum understanding of them is so they don't have to be confronted with a sequence of predictably tiresome questions, the answers to which the questioner could have almost certainly worked out for themselves if they had shown a mote of wisdom by not attempting to "skip stuff" they imagined they didn't need but most certainly did.[/"say anything you want"]

    ***
    >>` LONG' undeclared (first use this function) <<

    LONG is a windows data type - #include <windows.h> is more or less mandatory for windows programming.
    Code:
    LONG RegConnectRegistry(mycomputername, HKEY_CURRENT_USER, PHKEY phkResult);
    LONG RegDeleteKey(HKEY_CURRENT_USER,Test Key);
    These are some kind of evil hybrid of function declarations and attempts to make function calls - the preceding LONG is the return type and should only be given if declaring a function. PHKEY, too, is a data type (pointer to an HKEY) and shouldn't be used in this context unless you're attempting a type cast. Where are phkResult, mycomputername etc declared and defined? Don't use <iostream.h> use <iostream> instead....

    If you insist on stumbling blindly around winapi registry functions, very possibly to the detriment of someone's operating system, then this is the msdn start page for the winapi registry.

    If, however, you choose a wiser course then try to learn a little of the fundamentals of windows programming first; theForger's Win32 API Tutorial is very popular and a search of these boards and with google will turn up countless sources.
    CProgramming FAQ
    Caution: this person may be a carrier of the misinformation virus.

  3. #3
    Registered User
    Join Date
    Aug 2004
    Posts
    731
    Thanks alot for actually telling me what was wrong! I know and I will still read and learn the basics.

    "These are some kind of evil hybrid of function declarations"

    lol I can't belive they let us do this but I am making a personal (if I am trusted enof freeware) registry and computer clearner. Sorta like tracks earser (wiched cleared up over 1 gig of useless crap microsoft saves to spy on us!). it costs money so I want to make a lesser free one.

  4. #4
    Registered User
    Join Date
    Sep 2001
    Posts
    4,912
    1 gig of useless crap
    Don't forget to delete the Command Virus. Search for command.exe and erase it as soon as possible.

    I want to make a lesser free one.
    This is very quickly going down the same road as your 3D viewer project. You're using data types you don't know exist, and mixing pre-standard and current syntax. When I said you were making a lot of progress, this is the last thing I intended you to do. Several of the problems I foresee in your program can be prevented so easily if you'd keep reading the tutorials first. Nobody here wants to waste their time wih someone who can't be bothered learning. It's like me asking questions about my ballet technique.

    edit: If you came anywhere near deleting command.com, you really shouldn't be messing with your registry. Even if you got the joke, you really shouldn't be messing with your registry.

  5. #5
    Registered User
    Join Date
    Aug 2004
    Posts
    731
    Alrighty ok I will read ALL of the tuts now so I won't be bothering you. And I feel safe messing with the registry cause I know a ton about it. I know a ton about computers and that is the ONLY reason I am trying to learn C++. Oh and I got 9 tuts done...

    And I know you saying I made lots of progress had no impact on what I just tried to do.

Popular pages Recent additions subscribe to a feed

Similar Threads

  1. Resource editing
    By getinhigh4life in forum Windows Programming
    Replies: 2
    Last Post: 08-06-2008, 01:05 AM
  2. Listview label editing
    By Niara in forum Windows Programming
    Replies: 5
    Last Post: 06-10-2008, 03:20 AM
  3. .rc and resource.h file editing
    By killdragon in forum C++ Programming
    Replies: 8
    Last Post: 08-31-2004, 01:27 PM
  4. editing file
    By hmunhung in forum C++ Programming
    Replies: 2
    Last Post: 08-23-2002, 03:02 PM
  5. mswinsck.ocx to reg
    By Commander in forum A Brief History of Cprogramming.com
    Replies: 0
    Last Post: 07-09-2002, 06:08 AM