Registry Setvalue doesn't always work!
CodeGuru Home VC++ / MFC / C++ .NET / C# Visual Basic VB Forums Developer.com
Results 1 to 6 of 6

Thread: Registry Setvalue doesn't always work!

Hybrid View

  1. #1
    Join Date
    Sep 2012
    Posts
    16

    Question Registry Setvalue doesn't always work!

    Registry.Setvalue won't work on my managed c++ program...

    I don't think you need code examples... cause my code is compiling.

    At runtime, I have no errors and the value in the registry is not updating...

    Why? And how can I solve this?

  2. #2
    Join Date
    Jun 2010
    Location
    Germany
    Posts
    2,585

    Re: Registry Setvalue doesn't always work!

    Quote Originally Posted by FenixEden View Post
    I don't think you need code examples...
    Perhaps a code snippet isn't exactly required, but these bits of information could be really interesting:
    • the registry path you're attempting to write to
    • the Windows version you run your program under
    • whether the user account you run it under is admin or not

    That's because it could be a problem of insufficient permissions.

    From your description it sounds like you're not getting an exception thrown, but it could be informative to step over the critical instruction in the debugger and observe the debugger output window. In case there's an exception getting thrown somewhere under the hood, but then caught before it bubbles up to your own code, the debugger would display that as a first chance exception in the output window (at least with default settings), and that could be useful information for diagnosing the problem.
    Last edited by Eri523; October 20th, 2012 at 07:21 AM.
    I was thrown out of college for cheating on the metaphysics exam; I looked into the soul of the boy sitting next to me.

    This is a snakeskin jacket! And for me it's a symbol of my individuality, and my belief... in personal freedom.

  3. #3
    Join Date
    Sep 2012
    Posts
    16

    Re: Registry Setvalue doesn't always work!

    the registry path is :
    hkeylocalmachine --> software -> microsoft --> windows nt -->winlogon --> shell
    I'm on windows 7

    I run under admin acount.

    I have no execption, neither first time exceptions...

    As it is induced in the title...
    Someimes it works, and sometimes not.
    We always know if it did work because when it does, computer lags for a second or so.

    Any clue?
    If you don't have any, please at least tell me so...

    I can change the value manually...
    But I don't want my customers (cause i wanna sell that) to seek into the registry editor...

    ====
    EDIT
    I have first chances exceptions, but they are at execution, not when I click my change shell button.
    Last edited by FenixEden; October 20th, 2012 at 07:55 PM. Reason: TYPO correcting

  4. #4
    Join Date
    Jun 2010
    Location
    Germany
    Posts
    2,585

    Re: Registry Setvalue doesn't always work!

    Quote Originally Posted by FenixEden View Post
    the registry path is :
    hkeylocalmachine --> software -> microsoft --> windows nt -->winlogon --> shell
    I'm on windows 7
    On my XP Pro SP3 I only have the key HKLM\SOFTWARE\Microsoft\Windows NT\CurrentVersion\Winlogon, with "Shell" being a value of type REG_SZ in there, and on that key only admins and the SYSTEM account have write permission. Could it be that your "sometimes not" simply is when the user running the program doesn't have admin privileges?

    I don't have access to a Win7 to check right now, but maybe others can tell you more.
    I was thrown out of college for cheating on the metaphysics exam; I looked into the soul of the boy sitting next to me.

    This is a snakeskin jacket! And for me it's a symbol of my individuality, and my belief... in personal freedom.

  5. #5
    Join Date
    Sep 2012
    Posts
    16

    Resolved Solution Accepted

    THANKS!
    You saved my life.

    I had to add a flag in Inno Setup Compiler so that my executable after installs have the full permissions.
    After that done, it works great.

    Now, my new shell will can switch itself to Windows!

    Thanks! ))))

  6. #6
    Join Date
    Sep 2012
    Posts
    16

    Re: Solution Accepted

    Now I will ask you in a new thread if you know how to do network connections in Managed C++.

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  


Windows Mobile Development Center


Click Here to Expand Forum to Full Width

This is a CodeGuru survey question.


Featured


HTML5 Development Center