Speechbubble von Windows (Balloon Tips)



  • Dieser Thread wurde von Moderator/in junix aus dem Forum Borland C++ Builder (VCL/CLX) in das Forum WinAPI verschoben.

    Im Zweifelsfall bitte auch folgende Hinweise beachten:
    C/C++ Forum :: FAQ - Sonstiges :: Wohin mit meiner Frage?

    Dieses Posting wurde automatisch erzeugt.



  • MSDN: EM_SHOWBALLOONTIP Message

    Syntax

    To send this message, call the SendMessage function as follows.

    lResult = SendMessage( // returns LRESULT in lResult
    (HWND) hWndControl, // handle to destination control
    (UINT) EM_SHOWBALLOONTIP, // message ID
    (WPARAM) wParam, // = 0; not used, must be zero
    (LPARAM) lParam // = (LPARAM) (PEDITBALLOONTIP) lParam;
    );

    Parameters

    wParam
    Not used; must be zero.
    lParam
    Pointer to an EDITBALLOONTIP structure that contains information about the balloon tip to display.

    Return Value

    If the message succeeds, it returns TRUE. Otherwise it returns FALSE.

    MSDN: EDITBALLOONTIP Structure

    Syntax

    typedef struct tagEDITBALLOONTIP {
    DWORD cbStruct;
    LPCWSTR pszTitle;
    LPCWSTR pszText;
    INT ttiIcon;
    } EDITBALLOONTIP, *PEDITBALLOONTIP;

    Members

    cbStruct
    DWORD that contains the size, in bytes, of the structure.
    pszTitle
    Pointer to a Unicode string that contains the title of the balloon tip.
    pszText
    Pointer to a Unicode string that contains the balloon tip text.
    ttiIcon
    Value of type INT that specifies the type of icon to associate with the balloon tip. This member can be one of the following values.

    TTI_ERROR
    Use the error icon.
    TTI_INFO
    Use the information icon.
    TTI_NONE
    Use no icon.
    TTI_WARNING
    Use the warning icon.

    Ich glaube das sind die beiden richtigen Funktionen.
    Wie man EM_SHOWBALLOONTIP benutz weiß ich glaub ich.

    SendMessage(TrayIcon1->Handle,EM_SHOWBALLOONTIP,0,MeinEDITBALLOONTIP);
    

    Nur wie benutze ich EDITBALLOONTIP richtig?



  • Diabolo schrieb:

    Nur wie benutze ich EDITBALLOONTIP richtig?

    Öhm, wenn du noch nicht mal eine Struktur füllen kannst, solltest du dich lieber erstmal mit C/C++-Kenntnissen ausstatten.



  • WebFritzi, hast wahrscheinlich recht.
    Würd' mich mit dir anlegen, aber da du schon viele Probleme sinnvoll gelöst hast und der BCB Faq auch mit Lösungen von dir gefüllt ist, lass ich das.



  • Diabolo schrieb:

    WebFritzi, hast wahrscheinlich recht.
    Würd' mich mit dir anlegen, aber da du schon viele Probleme sinnvoll gelöst hast und der BCB Faq auch mit Lösungen von dir gefüllt ist, lass ich das.

    *lol* Mach ruhig. Hab ich kein Problem mit. 🙂

    Ne, also dir ist schon klar, dass du die Struktur füllen und dann per SendMessage schicken musst, oder?



  • EDITBALLOONTIP ebt;
     ebt.cbStruct = sizeof( ebt );
     ebt.pszText = L"Sprechblase";
     ebt.pszTitle = L"Ich bin eine Sprechblase";
     ebt.ttiIcon = TTI_INFO;
    ShowBalloonTip(TrayIcon1->Handle,ebt);
    

    So jetzt hab ich nochmal n bisschen nachgedacht und den Tag ausgefüllt.
    Mein Problem is:

    [C++ Error] App.cpp(35): E2451 Undefined symbol 'EDITBALLOONTIP'
    [C++ Error] App.cpp(40): E2268 Call to undefined function 'ShowBalloonTip'

    Und das obwohl ich Commctrl.h geincluded habe



  • ShowBalloonTip gibt es nicht. Du musst schon die Message EM_SHOWBALLOONTIP benutzen.
    Außerdem hast du ein veraltetes SDK, in dem diese Message wohl noch nicht definiert ist. Die Struktur musst du dir also selber definieren. Und für die Message brauchst du die Konstante. Wär ja super, wenn dir das hier mal jemand raussuchen würde. Ich habe leider auch kein neues SDK, so dass ich das nicht kann.



  • Muss ich mir die SDK von Microsoft runterladen (bitte nich)



  • Ich lade mir gerade die neue Core SDK von MS runter. Hoffentlich klappts danach!



  • Haha, ich kann ja doch nachschauen, habe ich bemerkt. Also, der Reihe nach:

    typedef struct _tagEDITBALLOONTIP
    {
        DWORD   cbStruct;
        LPCWSTR pszTitle;
        LPCWSTR pszText;
        INT     ttiIcon; // From TTI_*
    } EDITBALLOONTIP, *PEDITBALLOONTIP;
    
    #define	EM_SHOWBALLOONTIP   (ECM_FIRST + 3)		// Show a balloon tip associated to the edit control
    

    So steht's in der CommCtrl.h. So, jetzt müssen wir nur noch wissen, wofür ECM_FIRST steht. Nachgeschaut:

    #define ECM_FIRST               0x1500      // Edit control messages
    

    Mehr brauchst du nicht. 🙂



  • Diabolo schrieb:

    Ich lade mir gerade die neue Core SDK von MS runter. Hoffentlich klappts danach!

    Nein, danach wird es nicht klappen. Nimm mein oberes Posting.



  • Erstmal danke für deine Mühe. mmh ich sehe das in der Datei. aber was genau hilft mir das?

    So wie ich das jetzt angeordnet habe sagt der Debugger folgendes:
    [C++ Error] App.cpp(51): E2314 Call of nonfunction
    weil
    #define EM_SHOWBALLOONTIP (ECM_FIRST + 3)
    EM_SHOWBALLOONTIP zwar definiert, aber das irgendwie nicht als Funktion kennzeichnet



  • Hä? Du sollst das einfach übernehmen. Copy-Paste. Klaro?



  • Hab eben was total falsch gemacht. Aber trotzdem hab ich jetzt noch fehler:

    typedef struct _tagEDITBALLOONTIP
    {
        DWORD   cbStruct;
        LPCWSTR pszTitle;
        LPCWSTR pszText;
        INT     ttiIcon; // From TTI_*
    } EDITBALLOONTIP, *PEDITBALLOONTIP;
    #define ECM_FIRST               0x1500      // Edit control messages
    #define EM_SHOWBALLOONTIP (ECM_FIRST + 3)        // Show a balloon tip associated to the edit control
    
    void __fastcall TForm1::Button1Click(TObject *Sender)
    {
    AnsiString Title = "Bubble";
    EDITBALLOONTIP ebt;
     ebt.cbStruct = sizeof(ebt);
     ebt.pszText = L"The text contents of the edit balloon tip";
     ebt.pszTitle = L"The title text";
     ebt.ttiIcon = TTI_INFO;
    SendMessage(TrayIcon1->Handle,EM_SHOWBALLOONTIP,0, ebt);
    
    }
    

    Fehler:

    [C++ Error] App.cpp(51): E2034 Cannot convert '_tagEDITBALLOONTIP' to 'long'
    [C++ Error] App.cpp(51): E2342 Type mismatch in parameter 'lParam' (wanted 'long', got '_tagEDITBALLOONTIP')

    Kann verstehen wenn de mich inzwischen für blöd hälst



  • Ja, ich habe den Eindruck, dass mein erster Eindruck ein richtiger Eindruck war. Schau nochmal in die MSDN, was da bei der Erklärung von lParam steht.



  • Das lese ich mir schon die ganze Zeit durch:
    Pointer to an EDITBALLOONTIP

    Ich weiß nur nich wie zum Teufel ich einen Pointer dafür liefere



  • int a = 2;
    int* pa = &a;

    Alles klar???



  • Hallo,

    eine Ausführliche Anweisung wie man ToolTips erstellt verändert
    findest du hier

    http://www.derentwickler.de/itr/online_artikel/psecom,id,534,nodeid,56.html

    zwar in Delphi aber leicht nachvollziehbar.



  • [deleted]



  • Wieso hast du das jetzt gelöscht?
    Ich habe gerade gemerkt, dass es von Anfang an Blödsinn war, denn EM_SHOW... ist eine Message an ein Edit-Control. Schau dir nochmal die MSDN an. Insbesondere hier: http://msdn.microsoft.com/library/default.asp?url=/library/en-us/shellcc/platform/commctls/tooltip/usingtooltips.asp


Anmelden zum Antworten