Problem mit icon im systray
-
hi,
ich habe folgendes Problem:
mein Programm erstellt ein icon im systray. funktioniert alles wunderbar.
sobald ich aber die windows procedure um folgenden code erweiter:case WM_DRAWITEM: { LPDRAWITEMSTRUCT lpdiControl = (LPDRAWITEMSTRUCT)lParam; if(lpdiControl->CtlType == ODT_BUTTON){ HRGN hrgnButton1 = CreateRectRgn(0, 0, 0, 0); GetWindowRgn(lpdiControl->hwndItem, hrgnButton1); RECT rcClient; GetClientRect(lpdiControl->hwndItem, &rcClient); FillRect(lpdiControl->hDC, &lpdiControl->rcItem, GetSysColorBrush(COLOR_WINDOW)); if(lpdiControl->itemState & ODS_SELECTED){ rcClient.top += 1, rcClient.left += 1; HRGN hrgnButton2 = CreateEllipticRgnIndirect(&rcClient); FillRgn(lpdiControl->hDC, hrgnButton1, GetSysColorBrush(COLOR_BTNSHADOW)); FillRgn(lpdiControl->hDC, hrgnButton2, GetSysColorBrush(COLOR_BTNFACE)); DeleteObject(hrgnButton2); }else{ rcClient.bottom -= 1, rcClient.right -= 1; HRGN hrgnButton2 = CreateEllipticRgnIndirect(&rcClient); FillRgn(lpdiControl->hDC, hrgnButton1, GetSysColorBrush(COLOR_BTNSHADOW)); FillRgn(lpdiControl->hDC, hrgnButton2, GetSysColorBrush(COLOR_BTNFACE)); DeleteObject(hrgnButton2); } int nLen = (GetWindowTextLength(lpdiControl->hwndItem) + 1); char *szText = (char *)malloc(nLen); GetWindowText(lpdiControl->hwndItem, szText, nLen); SelectClipRgn(lpdiControl->hDC, hrgnButton1); DrawText(lpdiControl->hDC, szText, --nLen, &rcClient, (DT_SINGLELINE | DT_CENTER | DT_VCENTER)); SelectClipRgn(lpdiControl->hDC, NULL); DeleteObject(hrgnButton1); free(szText); } }meldet mir windows beim ausführen ein fehler und bricht das programm ab, sobald ich mit der maus über das icon fahre. woran liegt das???
mfg ghill
-
Du hast doch einen Debugger. An welcher Stelle kanllt es denn. Bist Du sicher, dass es in dieser Routine ist?
-
nach dem case-Label 'break' bzw. 'return' nicht vergessen

-
oh mann!
ich sollt mich glaub besser konzentrieren....^^
vielen dank, jetzt geht alles
mfg ghill