Thread: Using Windows Registry

  1. #1
    C/C++ Learner & Lover
    Join Date
    Aug 2008
    Location
    Argentina
    Posts
    193

    Using Windows Registry

    Which library is used to manipulate the windows registry in c? Is it there any doc about it?
    Thanks

  2. #2
    Registered User
    Join Date
    Sep 2004
    Location
    California
    Posts
    3,268
    Just use the Win32 registry API.
    bit∙hub [bit-huhb] n. A source and destination for information.

  3. #3
    C/C++ Learner & Lover
    Join Date
    Aug 2008
    Location
    Argentina
    Posts
    193
    But, don't you need a Microsoft Visual environment to use it?

  4. #4
    Registered User
    Join Date
    Sep 2004
    Location
    California
    Posts
    3,268
    I think you just need the platform SDK installed.
    bit∙hub [bit-huhb] n. A source and destination for information.

  5. #5
    C/C++ Learner & Lover
    Join Date
    Aug 2008
    Location
    Argentina
    Posts
    193
    Mmm.. I really don't know, I'm not a Windows native programmer, if I have the SDK installed, how can I include the libraries?

  6. #6
    Registered User
    Join Date
    Mar 2007
    Posts
    142
    Biggest problem with Registry API is the naming conventions, the names used for certain entities in the api. Be sure to understand that first. Then the rest will come much easier.

    I remember staring at some example code and the documentation and I couldn't connect one with the other. I felt stupid very often while I was dealing with the registry.

    Read this post by Raymond Chen and try to read the comments too.

    ---

    I see while I was writing this, you two were talking about some very basic issues. You must have some C compiler for Windows? If you can't link the library to your exe, you can always use LoadLibrary() and GetProcAddress().
    Last edited by idelovski; 09-02-2009 at 04:46 PM.

  7. #7
    Registered User
    Join Date
    Sep 2004
    Location
    California
    Posts
    3,268
    What compiler are you using?
    bit∙hub [bit-huhb] n. A source and destination for information.

  8. #8
    C/C++ Learner & Lover
    Join Date
    Aug 2008
    Location
    Argentina
    Posts
    193
    DJGPP, which one will you recommend me?

  9. #9
    Registered User
    Join Date
    Sep 2004
    Location
    California
    Posts
    3,268
    That appears to be a DOS compiler. I suggest you use MS Visual Studio Express which is free.
    bit∙hub [bit-huhb] n. A source and destination for information.

  10. #10
    C/C++ Learner & Lover
    Join Date
    Aug 2008
    Location
    Argentina
    Posts
    193
    Thanks, I'll take a look at it, it's a DOS compiler, but I was thinking to use GTK+ with it.. but well, I think I'll have to use the Visual Studio

  11. #11
    Guest Sebastiani's Avatar
    Join Date
    Aug 2001
    Location
    Waterloo, Texas
    Posts
    5,708
    The mingw port of gcc is also an excellent compiler for Windows, plus if you're using C++, it's more standard-compliant than the Microsoft compiler. At any rate, to use the API any Windows compiler will do - just include windows.h.

  12. #12
    Malum in se abachler's Avatar
    Join Date
    Apr 2007
    Posts
    3,195
    Quote Originally Posted by lautarox View Post
    But, don't you need a Microsoft Visual environment to use it?
    If you have to ask that you definitely should not be messing witht eh registry.

  13. #13
    C++まいる!Cをこわせ!
    Join Date
    Oct 2007
    Location
    Inside my computer
    Posts
    24,654
    It's fine if storing and retrieving data.
    Quote Originally Posted by Adak View Post
    io.h certainly IS included in some modern compilers. It is no longer part of the standard for C, but it is nevertheless, included in the very latest Pelles C versions.
    Quote Originally Posted by Salem View Post
    You mean it's included as a crutch to help ancient programmers limp along without them having to relearn too much.

    Outside of your DOS world, your header file is meaningless.

  14. #14
    Malum in se abachler's Avatar
    Join Date
    Apr 2007
    Posts
    3,195
    Quote Originally Posted by Elysia View Post
    It's fine if storing and retrieving data.
    The registry is not a scratch pad to save all your inane application specific data in.

  15. #15
    Guest Sebastiani's Avatar
    Join Date
    Aug 2001
    Location
    Waterloo, Texas
    Posts
    5,708
    Quote Originally Posted by abachler View Post
    The registry is not a scratch pad to save all your inane application specific data in.
    Hmm. Maybe someone should have informed MS about that.

    Seriously, though, I don't think Elysia was implying that. The purpose of the registry isn't just to provide a database for the system but in fact all applications. Naturally, there are probably some "common sense" exceptions that should be observed (for the sake of system performance, at least) such as not storing massive amounts of data there (eg: code, output from log files, etc), but using it to store important application settings and the like makes good sense for a number of reasons (more uniform access for your application, the system, other programs, etc, less complex logic for storing/retrieving database-centric data, etc). The main thing though, is just to be consistent, and to be very careful not to accidentally overwrite system-critical data, obviously.

Popular pages Recent additions subscribe to a feed

Similar Threads

  1. Network Programming in C for Windows
    By m.mixon in forum C Programming
    Replies: 7
    Last Post: 06-19-2006, 08:27 PM
  2. Menu Item Caption - /a for right aligned Accelerator?
    By JasonD in forum Windows Programming
    Replies: 6
    Last Post: 06-25-2003, 11:14 AM
  3. Manipulating the Windows Clipboard
    By Johno in forum Windows Programming
    Replies: 2
    Last Post: 10-01-2002, 09:37 AM
  4. How come this only works in Windows nt/2000?
    By Unregistered in forum Windows Programming
    Replies: 1
    Last Post: 08-30-2002, 06:54 PM
  5. Windows Registry
    By Nor in forum Windows Programming
    Replies: 1
    Last Post: 02-15-2002, 03:19 AM

Tags for this Thread