tutorials.de Buch-Aktion 05/2012
ERLEDIGT
NEIN
ANTWORTEN
0
ZUGRIFFE
204
EMPFEHLEN
  • An Twitter übertragen
  • An Facebook übertragen
AUF DIESES THEMA
ANTWORTEN
  1. #1
    BlackPsycho BlackPsycho ist offline Mitglied
    Registriert seit
    May 2007
    Beiträge
    18
    Hallo ich hab das problem das mein tooltip den ich erstelle nicht an meinem mauszeiger sich mitbewegt sondern einfach hängen bleibt und anscheinend die schleife nicht mehr weiter läuft.

    kann mir wer dabei helfen?

    wenn wer ne idee hat dann immer her damit

    danke

    Code :
    1
    2
    3
    4
    5
    6
    7
    8
    9
    10
    11
    12
    13
    14
    15
    16
    17
    18
    19
    20
    21
    22
    23
    24
    25
    26
    27
    28
    29
    30
    31
    32
    33
    34
    35
    36
    37
    38
    39
    40
    41
    42
    43
    44
    45
    46
    47
    48
    49
    50
    51
    52
    53
    54
    55
    56
    57
    58
    59
    60
    61
    62
    63
    64
    65
    66
    67
    68
    69
    70
    71
    72
    73
    74
    75
    76
    77
    78
    79
    80
    81
    82
    83
    84
    85
    86
    87
    88
    89
    90
    91
    92
    93
    94
    95
    96
    97
    98
    99
    100
    101
    102
    103
    104
    105
    106
    107
    108
    109
    110
    111
    112
    113
    114
    115
    116
    117
    118
    119
    120
    121
    122
    123
    124
    125
    126
    127
    128
    129
    130
    131
    132
    133
    134
    135
    136
    137
    138
    139
    140
    141
    142
    143
    144
    145
    146
    147
    148
    149
    150
    151
    152
    153
    154
    155
    156
    157
    158
    159
    160
    161
    162
    163
    164
    165
    166
    167
    168
    169
    170
    171
    172
    
    // ImageSearchDLL.cpp : Defines the entry point for the DLL application.
    //
     
     
    #include <afx.h>
    #include "stdafx.h"
    #include <windows.h>
    #include "util.h"
    #include <stdio.h>
    #include <stdlib.h>
    #include <iostream>
    #include <string>
    #include <array>
    #include <GdiPlus.h>
    #include "AutoIt3.h"
     
    using namespace std;
     
    /*
    #ifdef _MANAGED
    #pragma managed(push, off)
    #endif
     
    BOOL APIENTRY DllMain( HMODULE hModule,
                           DWORD  ul_reason_for_call,
                           LPVOID lpReserved
                         )
    {
        return TRUE;
    }
     
    #ifdef _MANAGED
    #pragma managed(pop)
    #endif
    */
    struct __HBUBBLE {
        HWND hwnd;
        TOOLINFO ti;        
    };
     
    typedef __HBUBBLE* HBUBBLE;
     
    DWORD BubbleWindow_Create(HBUBBLE& hBubble, LPCTSTR pszText, LPCTSTR pszTitle, 
        WORD x, WORD y, WORD nMaxWidth)
    {
        DWORD dwRet = NO_ERROR;
        hBubble = new __HBUBBLE;
        hBubble->hwnd = CreateWindowEx(WS_EX_TOPMOST, TOOLTIPS_CLASS, 
            NULL, TTS_ALWAYSTIP | TTS_BALLOON | WS_POPUP,
            0, 0, 0, 0, 
            NULL, NULL, GetModuleHandle(0), hBubble);
        if(NULL != hBubble->hwnd)
        {
            ::ZeroMemory(&hBubble->ti, sizeof(TOOLINFO));
            hBubble->ti.cbSize = sizeof(TOOLINFO);
    #if (_WIN32_WINNT >= 0x0501)
            hBubble->ti.cbSize -= sizeof(void*);
    #endif
            hBubble->ti.uFlags = TTF_TRACK | TTF_ABSOLUTE;
            hBubble->ti.lpszText = const_cast<LPTSTR>(pszText);
     
            SendMessage(hBubble->hwnd, TTM_ADDTOOL, 0, (LPARAM)&hBubble->ti);
            SendMessage(hBubble->hwnd, TTM_SETMAXTIPWIDTH, 0, nMaxWidth);
            SendMessage(hBubble->hwnd, TTM_SETTITLE, TTI_INFO, (LPARAM)pszTitle);
            SendMessage(hBubble->hwnd, TTM_TRACKACTIVATE, TRUE, (LPARAM)&hBubble->ti);
            SendMessage(hBubble->hwnd, TTM_TRACKPOSITION, 0, MAKELPARAM(x, y));
        }
        else
        {
            dwRet = ::GetLastError();
        }
        return dwRet;
    }
     
    CPoint pt; 
    HDC hDC;
     
    int *umspeichern(char *x, int *anz)
    {
        int *ret;
        int i, j;
        j = strlen(x); *anz = 0;
        for (i = 0; i < j; i++)
        {
            if (x[i] == '|') (*anz)++;
        }
        if (j > 0) (*anz)++;
        ret = (int *) malloc(sizeof(int) * (*anz));
        if (ret == NULL) return NULL;
        j = 0;
        for (i = 0; i < *anz; i++)
        {
            ret[i] = 0;
            while (x[j] != '|' && x[j] != '\0')
            {
                ret[i] = ret[i] * 10 + (x[j] - '0');
                j++;
            }
            j++;
        }
        return ret;
    }
     
     
     
    void BildSuchen()
    {
        bool hit;
        int* array;
        int anz;
     
        GetCursorPos(&pt);
     
        char *answer="";
        answer = ImageSearch(0,0,1280,1024,"C:\\pic.bmp");
     
        // gibt das zurück: gefunden? 1 oder 0, x, y, img_w, img_h
        array = umspeichern(answer, &anz);
        
        //Rectangle(hDC, array[1], array[2], array[1]+array[3], array[2]+array[4]);
        
        RECT rechteck;
     
        rechteck.left = array[1];
        rechteck.top = array[2];
        rechteck.right = array[1]+array[3];
        rechteck.bottom = array[2]+array[4];
     
        hit = PtInRect(&rechteck, pt);
        
        
     
        if(hit == true)
        {
            // tooltip erstellen
            /*
            AU3_ToolTip(L"test",pt.x, pt.y);*/
            HBUBBLE hBubble = NULL;
            LPCTSTR pszText = _T("Test");
            LPCTSTR pszTitle = NULL;
            DWORD dwRet = BubbleWindow_Create(hBubble, pszText, pszTitle, pt.x, pt.y, sizeof(pszText));
            
            cout <<"1 \n";
        }
        else
        {
            // tooltip löschen
            //AU3_ToolTip(L"",pt.x, pt.y);
            cout <<"0 \n";
        }
        
        
        
        free(array);
    }
     
    void _tmain()
    {
        while(1)
        {
     
            BildSuchen();
     
            cout << "mouseX: "<<pt.x<<" mouseY: "<<pt.y<<"\n";
     
        }   
            
        
        getchar();
        return;
        
    }

    danke
    Geändert von BlackPsycho (26.07.11 um 19:22 Uhr)
     

Ähnliche Themen

  1. Inaktiver JButtonmit ToolTip ohne Rahmen und Hintergrund
    Von Jellysheep im Forum Swing, Java2D/3D, SWT, JFace
    Antworten: 4
    Letzter Beitrag: 14.02.10, 19:11
  2. Antworten: 0
    Letzter Beitrag: 10.08.08, 12:26
  3. Antworten: 1
    Letzter Beitrag: 05.06.08, 13:35
  4. ToolTip mit Mouse_Hover aber ohne Steuerelement
    Von Thurstan im Forum .NET Windows Forms
    Antworten: 8
    Letzter Beitrag: 20.05.08, 18:53
  5. Fenster ohne Rahmen ?
    Von antec im Forum HTML & XHTML
    Antworten: 3
    Letzter Beitrag: 26.02.04, 11:01