Integer-Wert in Registry speicher



  • Hallo,
    ich möchte gern einen Integer-Wert in der Registry speichern
    und als Integer-Wert wieder abfragen.
    Hab schon mit
    [cpp ]
    AfxGetApp()->WriteProfileString und
    m_iWERT=(AfxGetApp()->GetProfileInt
    [/cpp ]

    probiert, geht aber nicht.
    Hat jemand Ahnung ???

    HansDampf



  • Hi,

    wenn Du Dir die Befehle genau ansehen würdest, würde Dir auffallen, dass Du

    [cpp]
    AfxGetApp()->WriteProfileString
    [/cpp]

    zum Schreiben benutzt und

    m_iWERT=(AfxGetApp()->GetProfileInt
    

    zum Lesen verwendest. Fällt Dir was auf? Und überhaupt: Was klappt nicht? Was für Fehlermeldungen? Deine Beschreibung war etwas dürftig...

    Gruss

    yeti



  • Natürlich nehme ich beim Schreiben und Lesen das gleiche, sollte nur ein Beispiel sein.

    Wenn ich aber:

    int SEC;
    .
    .
    .
    AfxGetApp()->WriteProfileInt("Optionen", "APP", SEC);
    .
    .
    .
    SEC= AfxGetApp()->GetProfileInt("Optionen", "APP", "<defaultwert");
    .
    .
    .

    nehme kommt immer:
    C:\Dokumente und Einstellungen\Hans\Desktop\APP\APPDlg.cpp(308) : error C2664: 'GetProfileIntA' : Konvertierung des Parameters 3 von 'char [13]' in 'int' nicht moeglich.#
    Ich brauche die Ausgabe aber als int.

    Gruß
    Hans



  • HansDampf schrieb:

    int SEC;
    AfxGetApp()->WriteProfileInt("Optionen", "APP", SEC);

    SEC= AfxGetApp()->GetProfileInt("Optionen", "APP", "<defaultwert");
    Gruß
    Hans

    wieso übergibst du als 3. Parameter nen Sring?
    neu:

    int iDefault = 5;
    int iRes = AfxGetApp()->GetProfileInt("Optionen", "APP", iDefault);
    


  • OOOOHHHHHH, Mann Mann
    Danke SKY,
    das war das Problem,wegen dem SCH.... mach ich schon bald eine Woche rum.
    Jetzt geht es.

    Gruß
    HansDampf


Anmelden zum Antworten