Results 1 to 2 of 2

Thread: How can I read \Device\serial0 value with QSettings in windows registry ?

  1. #1
    Join Date
    Jul 2008
    Posts
    2
    Qt products
    Qt4
    Platforms
    Unix/X11 Windows

    Default How can I read \Device\serial0 value with QSettings in windows registry ?

    Hi, I want to read in the windows registry the value of the key "\Device\Serial0" located in:
    HKEY_LOCAL_MACHINE\\HARDWARE\\DEVICEMAP\\SERIALCOM M

    The problem is QSetting seems to convert all my "\" to "/".

    So when I do:

    QSettings settings("HKEY_LOCAL_MACHINE\\HARDWARE\\DEVICEMAP\ \SERIALCOMM", QSettings::NativeFormat);

    then

    QString result = settings.value("\\Device\\Serial0").toString();

    it actually looks for a value located in:
    HKEY_LOCAL_MACHINE\\HARDWARE\\DEVICEMAP\\SERIALCOM M\\Device\\Serial0

    Of course there is no value in this location since "\\Device\\Serial0" is not a path but the name of the key.

    Typically, the value of the key called "\\Device\\Serial0" is COM1

    How can I read this value ?

    Thank you

  2. #2
    Join Date
    Jul 2008
    Posts
    2
    Qt products
    Qt4
    Platforms
    Unix/X11 Windows

    Default Re: How can I read \Device\serial0 value with QSettings in windows registry ?

    I reply to myself:

    Qsettings documentation says it is not possible to read or write keys with backslashes:

    http://doc.trolltech.com/4.3/qsettings.html

    "Note that the backslash character is, as mentioned, used by QSettings to separate subkeys. As a result, you cannot read or write windows registry entries that contain slashes or backslashes; you should use a native windows API if you need to do so."

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
  •  
Digia, Qt and their respective logos are trademarks of Digia Plc in Finland and/or other countries worldwide.