Wie kann ich dieser Funktion in meinem Code implementieren??



  • Hallo,

    ich muss eine Funktion von dritt - Anbieter benutzen.
    Die Funktion will eine Struktur bzw. einer Zeiger auf diese Struktur als Parameter haben.
    Ich wuerde gerne wissen, wie ich dieser Funktion in meinem Code implementieren kann??
    Wie kann ich die Struktur - Variablen etwas zuweisen, wenn PISISBACKLIGHT nur einer Zeiger ist???

    Vielen Dank im Voraus 😉

    Ich habe mit folgender Methode probiert:

    bool
    ItronixControl::setBacklight()
    {
    PISISBACKLIGHT light;

    light->TimeoutVal = 0;
    light->DisplayType = 1;

    if(lcdSetBacklight(light))
    return true;
    else
    return false;
    }

    Die Funktionsbeschreibung aus der Dokumentation:

    lcdGetBacklight, lcdSetBacklight Description

    These functions are used to read and change the backlight level and timeout settings.

    ISISAPI BOOL APIENTRY lcdGetBacklight(PISISBACKLIGHT pBackLight);
    ISISAPI BOOL APIENTRY lcdSetBacklight (PISISBACKLIGHT pBackLight);

    pBackLight Points to an ISISBACKLIGHT structure
    Remarks

    When using these functions, bits 6 and 7 of Byte 1 and bits 7, 3 and 0 of Byte 2 should
    always be ignored since they are used by the DLL to flag certain conditions to the micro
    controller.

    When changing the Backlight State, bits 5 and 4 of Byte 2 should also be ignored.
    On a colour fex21 the backlight is never truly off. Consequently the bit 6 of Byte 2 should
    be ignored, whilst the brightness control bits can be ignored for monochrome units.

    Return Value
    If the function call is successful, the function returns TRUE. Otherwise it returns FALSE
    and the content of any parameters will remain unchanged.

    Die Strukturbeschreibung:

    /* This structure is used to read and change the current status */
    /* of the backlight and its timeout settings */
    /* See also: lcdGetBacklight(), lcdSetBacklight() */

    typedef struct tagISISBACKLIGHT
    {
    /* The first two fields represent the auto dim timeout status */
    /* TimeoutVal is 0 if timeouts are disabled else this value is */
    /* gives the duration of inactivity, after which the backlight */
    /* will auto-dim, in 30s intervals */
    /* If Timeout Mode is 1 auto-dim will occur after TimeoutVal */
    /* whether or not there is any activity. If it is 2 auto-dim */
    /* will occur only if the unit is inactive, pen or keyboard */
    /* activity will reset the timeout counter. If it is 3, the */
    /* auto-dim behaves as for 2, but any activity after timeout */
    /* will relight the backlight and reset the timeout counter. */

    WORD TimeoutVal:4; /* Initial timeout in 30s periods /
    WORD TimeoutMode:2; /
    Reset and resume mode for T/O */
    WORD Reserved3:2;

    /* The remaining fields describe the current backlight status */
    /* The Level field is only valid if DisplayType is not 0 (mono) */

    WORD Reserved0:1;
    WORD Level:2; /* Intensity (0-3) /
    WORD Reserved1:1;
    WORD DisplayType:2; /
    0=mono, 1=Colour, 2=T/R colour /
    WORD LiteState:1; /
    Backlight on flag /
    WORD Reserved2:1;
    WORD KeyBrdTime:2; /
    Keyboard backlight timeout /
    WORD KeyBrdMode:2; /
    Keyboard backlight timeout mode /
    WORD KeyBrdValue:4; /
    Keyboard backlight timeout value /
    WORD KeyBrdState:2; /
    Keyboard backlight state */
    WORD Reserved4:6;

    } ISISBACKLIGHT, *PISISBACKLIGHT;



    1. Schau dir den Adressoperator & an.
    2. Finde heraus, was der Begriff allozieren bedeutet
    3. Macht es dir was aus, deine C++-Fragen nicht im C-Forum zu stellen?


  • Hallo Bashar,

    das werde ich in Zukunft tun 😉
    Ich Danke Dir für Deinen Tipp 😉

    Viele Gruesse Reza 🙂





  • @Reza:
    Deklarier einfach eine ISISBACKLIGHT light; struktur. Dann kannst du die Werte ganz normal sezen:

    light.TimeoutVal = 0;
    light.DisplayType = 1;
    
    if(lcdSetBacklight(&light))
    ...
    

    @Bashar:
    Seine Frage basiert nicht auf C++ Code (Er schreibt C++ Code, ist klar).
    Die Funktionen, um die es geht, sind C-Funktionen und er hatte ein Problem wegen einer Struktur.



  • Gary: Ist kein Grund. Nur weil die Sprachmittel, mit denen er Probleme hat, *auch* in C vorhanden sind, ist das noch lange keine C-Frage.



  • Hallo Leute,

    ich habe das Gefühl, dass Ihr manchmal aufeinander los geht!!
    Es soll Harmonie herrschen 😉
    Es ist egal, ob C oder C++. Die Sprache C++ basiert sowieso aus C.

    Ich finde euch und dieses Forum echt super 😉

    Ich wünsche euch weiterhin viel Spaß.

    Viele Grüße Reza 🙂



  • Original erstellt von Bashar:
    Gary: Ist kein Grund. Nur weil die Sprachmittel, mit denen er Probleme hat, *auch* in C vorhanden sind, ist das noch lange keine C-Frage.

    Du hast bereits vormals festgestellt, daß das C-Forum für C++-Anfängerfragen verwendet wird und das C++-Forum für stl-Sachen und template-Gehacke.
    Bestehst Du drauf, daß es anders sein soll?



  • volkard: Selbstverständlich. Sonst hätt ich diesen Mißstand ja nicht anprangern müssen, sondern mich damit still und leise einverstanden erklärt. Ich bestehe darauf, dass C++-Fragen im C++-Forum gepostet werden. Schon allein, damit den Leuten hier keine C-Antworten gegeben werden, mit denen sie eigentlich nichts anfangen können.


Anmelden zum Antworten