Results 1 to 8 of 8

Thread: Qt 4 Registry regedit

Hybrid View

Previous Post Previous Post   Next Post Next Post
  1. #1
    Join Date
    Jan 2007
    Location
    Paris
    Posts
    459
    Thanks
    98
    Thanked 3 Times in 3 Posts
    Qt products
    Qt4 Qt5

    Default Re: Qt 4 Registry regedit

    Qt Code:
    1. QDesktopServices::openUrl(QUrl::fromLocalFile("ZeMessenger.reg"))
    To copy to clipboard, switch view to plain text mode 

    Doesn't work.

    I need to execute a regedit file with every instance of my app.

  2. #2
    Join Date
    Jan 2006
    Location
    Warsaw, Poland
    Posts
    33,368
    Thanks
    3
    Thanked 5,017 Times in 4,793 Posts
    Qt products
    Qt3 Qt4 Qt5 Qt/Embedded
    Platforms
    Unix/X11 Windows Android Maemo/MeeGo
    Wiki edits
    10

    Default Re: Qt 4 Registry regedit

    Use system() with regedit.exe or QProcess with regedit.exe or insert the information into the registry using QSettings. And try expressing your goals more clearly next time - I though you wanted to do something completely different.

  3. #3
    Join Date
    Jan 2007
    Location
    Paris
    Posts
    459
    Thanks
    98
    Thanked 3 Times in 3 Posts
    Qt products
    Qt4 Qt5

    Default Re: Qt 4 Registry regedit

    Sorry if I didin't sound clear.

    Qt Code:
    1. QString program = "C:\\Windows\\regedit.exe";
    2. QStringList arguments;
    3. arguments << "/S" << "ZeMessenger.reg";
    4.  
    5. QProcess myProcess;
    6. myProcess.start(program, arguments);
    7.  
    8. if (!myProcess.waitForStarted())
    9. {
    10. return false;
    11. }
    To copy to clipboard, switch view to plain text mode 

    That code returns false. I'm affraid I need administrator rights to do such a command. I guess the only alternative to add regs field silently is during the installation.

  4. #4
    Join Date
    Mar 2006
    Posts
    140
    Thanks
    8
    Thanked 4 Times in 3 Posts
    Qt products
    Qt4
    Platforms
    Unix/X11 Windows

    Default Re: Qt 4 Registry regedit

    For starters, you don't actually need to launch regedit as the association for .reg is to open regedit, although that won't fix your problem.

    If you can't run .reg files, then chances are you won't be able to modify the registry keys even with QSettings. If this is a work machine that's locked down, then request permission to get your job done, otherwise if it's a personal machine, add yourself to the Administrators group.

Similar Threads

  1. Qt instruments for working with registry?
    By XL in forum Qt Programming
    Replies: 1
    Last Post: 5th February 2008, 17:36
  2. reading from registry
    By phillip_Qt in forum Newbie
    Replies: 11
    Last Post: 26th October 2007, 06:49
  3. setting valeu through registry
    By sudhansu.kanungo in forum Qt Programming
    Replies: 2
    Last Post: 28th September 2007, 20:55
  4. Accessing Windows Registry
    By musaulker in forum Newbie
    Replies: 1
    Last Post: 29th March 2007, 00:32
  5. [QSettings] Why limiting to plain file or registry ?
    By lauranger in forum Qt Programming
    Replies: 8
    Last Post: 13th September 2006, 14:25

Bookmarks

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  
Qt is a trademark of The Qt Company.