Enhance your gmail notifier
Posted: Tue Jul 18, 2006 9:07 pm
[edit] Please check a few posts down for a much better version.
I wanted to write a replacement for the gmail notifier but I didn't have any luck. So I realized you can check the status of the notifier gmail provides and enhance it to be more visible. This isn't perfect by any means, and what I originally wanted to do was get the hDC of the notification icon and do some GetPixel_() on it, but I didn't have any luck with that either, so I'm reduced to counting blue pixels in the system tray. Pathetic, I know, but I'm hoping someone will suggest something better:
I wanted to write a replacement for the gmail notifier but I didn't have any luck. So I realized you can check the status of the notifier gmail provides and enhance it to be more visible. This isn't perfect by any means, and what I originally wanted to do was get the hDC of the notification icon and do some GetPixel_() on it, but I didn't have any luck with that either, so I'm reduced to counting blue pixels in the system tray. Pathetic, I know, but I'm hoping someone will suggest something better:
Code: Select all
;===============================================
; Program: Gmail Notifier Enhancer
; Date: July 18, 2006
; Author: netmaestro
; TargetOS: Windows 2000/XP
; Compiler: PureBasic 4.0
;===============================================
;
CreateImage(0,640,480,#PB_Image_DisplayFormat)
StartDrawing(ImageOutput(0))
b = RGB(0,0,160)
Box(0,0,640,400,b)
Box(30,30,580,340,#White)
Box(200,185,240,30,b)
LineXY(0,15, 200, 200, b)
LineXY(15,0, 215, 185, b)
FillArea(32,32,b,b)
LineXY(0,384,200,200,b)
LineXY(15,399,230,200,b)
FillArea(32,368,b,b)
LineXY(624,0,425,186,b)
LineXY(639,15,440,200,b)
FillArea(442,197,b,b)
LineXY(440,200,639,385,b)
LineXY(424,214,610,385,b)
FillArea(442,220,b,b)
StopDrawing()
Repeat
Delay(60000) ; Check every one minute
hTaskBar.l = FindWindow_("Shell_TrayWnd", #Null)
hSystemTray.l = FindWindowEx_(hTaskBar, 0, "TrayNotifyWnd", 0)
GetWindowRect_(hSystemTray, Tray.RECT)
dc=CreateDC_("DISPLAY",0,0,0)
yes = 0
no = 0
For i = Tray\left To Tray\right
For j = Tray\top To Tray\bottom
p=GetPixel_(dc,i,j)
If p = RGB(155,153,238) ; count the light blue px in systray
no+1
ElseIf p = RGB(0,0,205) ; count the dark blue px in systray
yes+1
EndIf
Next
Next
DeleteDC_(dc)
If yes > 55 And no < 55 ; new mail: dark px > 55, light px usually 0 (here)
win = OpenWindow(0,0,0,640,400,"",#PB_Window_BorderLess|#PB_Window_ScreenCentered)
SetWindowLong_(win, #GWL_EXSTYLE, GetWindowLong_(win, #GWL_EXSTYLE) | #WS_EX_LAYERED)
SetLayeredWindowAttributes_(win, 0, 128, 2)
StickyWindow(0,1)
CreateGadgetList(WindowID(0))
ImageGadget(0,0,0,640,400,ImageID(0))
cc=0
Repeat
EventID = WaitWindowEvent()
If eventid=#WM_MOUSEMOVE
cc+1
EndIf
Until cc > 10
CloseWindow(0)
EndIf
ForEver