;############################################## ;Pruefen ob sich sich die Maus über einem Static-Control ;befindet, und dann darauf reagieren ;############################################## ;Andreas Miethe * Januar 2003 ;############################################## Global Static.l Global ReUsableBrush,a.l Procedure IsMouseOver(wnd) GetWindowRect_(wnd,re.RECT) GetCursorPos_(pt.POINT) Result = PtInRect_(re,pt\x,pt\y) ProcedureReturn Result EndProcedure Procedure SetColor(TxtColor,BkColor,wParam ,lParam ) Shared ReUsableBrush DeleteObject_(ReUsableBrush) ReUsableBrush = GetStockObject_(#HOLLOW_BRUSH) SetBkColor_(wParam,BkColor) SetTextColor_(wParam,TxtColor) SetBkMode_(wParam,#TRANSPARENT) Result = ReUsableBrush ProcedureReturn Result EndProcedure Procedure WindowCallback(WindowID, Message, wParam, lParam) Result = #PB_ProcessPureBasicEvents Select Message Case #WM_LBUTTONUP If IsMouseOver(Static) CreateFile(0,"~~1.url") WriteStringN("[InternetShortCut]") WriteStringN("URL=http://www.andreas-miethe.de") CloseFile(0) Shellexecute_(0,"open","~~1.url",0,0,#SW_ShowNormal) DeleteFile("~~1.url") EndIf Case #WM_MOUSEMOVE GetCursorPos_(pt.Point) GetWindowRect_(Static,re.Rect) If PtInRect_(re,pt\x,pt\y) a = 1 SetWindowtext_(Static,"www.ampsoft.de") SetCursor_(LoadCursor_(0,32649)) Else a = 0 SetWindowtext_(Static,"www.ampsoft.de") SetCursor_(LoadCursor_(0,#IDC_ARROW)) EndIf InvalidateRect_(WindowID(),0,0) Case #WM_CTLCOLORSTATIC If lParam = static If a Result = SetColor(RGB(0,0,255),RGB(255,255,255),wParam,lParam) Else Result = SetColor(RGB(0,0,0),RGB(255,255,255),wParam,lParam) EndIf EndIf EndSelect ProcedureReturn Result EndProcedure If OpenWindow(0, 10, 10, 640,180, #PB_Window_SystemMenu | #PB_Window_MinimizeGadget | #PB_Window_MaximizeGadget, "MouseOver") If CreateGadgetList(WindowID()) Static = TextGadget(0, 10,10,220,24,"") EndIf SetWindowCallback(@WindowCallback()) Sendmessage_(WindowID(),#WM_MOUSEMOVE,0,0) Repeat EventID.l = WaitWindowEvent() If EventID = #PB_Event_CloseWindow ; If the user has pressed on the close button Quit = 1 EndIf Until Quit = 1 EndIf End ; ExecutableFormat=Windows ; DisableDebugger ; EOF