$PBExportHeader$w_tanchuang.srw forward global type w_tanchuang from window end type type p_1 from picture within w_tanchuang end type type st_1 from statictext within w_tanchuang end type type st_rect from structure within w_tanchuang end type end forward type st_rect from structure long left long top long right long bottom end type global type w_tanchuang from window boolean visible = false integer width = 1038 integer height = 272 boolean titlebar = true string title = "通知" boolean controlmenu = true boolean minbox = true boolean maxbox = true boolean resizable = true long backcolor = 67108864 string icon = "AppIcon!" event ue_move ( ) p_1 p_1 st_1 st_1 end type global w_tanchuang w_tanchuang type prototypes FUNCTION ulong SetWindowPos(ulong hwnd,ulong hWndInsertAfter,ulong Ax,ulong Ay,ulong cx,ulong cy,ulong wFlags) LIBRARY "user32.dll" FUNCTION ulong FindWindow(string lpClassName,string lpWindowName) LIBRARY "user32.dll" ALIAS FOR "FindWindowA;Ansi" FUNCTION ulong GetWindowRect(ulong hwnd,ref st_RECT lpRect) LIBRARY "user32.dll" alias for "GetWindowRect;Ansi" FUNCTION ulong SetLayeredWindowAttributes(ulong hwnd,long crKey, char bAlpha, long dwflags) LIBRARY "user32.dll" alias for "SetLayeredWindowAttributes;Ansi" FUNCTION ulong GetWindowulong(ulong hwnd,ulong nIndex) LIBRARY "user32.dll" ALIAS FOR "GetWindowLongA" FUNCTION ulong SetWindowulong(ulong hwnd,ulong nIndex,ulong dwNewLong) LIBRARY "user32.dll" ALIAS FOR "SetWindowLongA" end prototypes type variables long instance_taskbar_x, instance_taskbar_y long ii_y, ii_height CONSTANT LONG HWND_TOPMOST = -1 CONSTANT LONG LWA_COLORKEY = 1 CONSTANT LONG LWA_ALPHA = 2 CONSTANT LONG GWL_EXSTYLE = - 20 CONSTANT LONG WS_EX_LAYERED = 524288 end variables forward prototypes private function st_rect wf_get_taskbar_rect (ref long ax, ref long ay) end prototypes event ue_move();long w,h environment lenv if getenvironment(lenv) = -1 then return w = pixelstounits(lenv.screenwidth, xpixelstounits!) h = pixelstounits(lenv.screenheight,ypixelstounits!) ii_y = h - instance_taskbar_y - height this.move(w - width - instance_taskbar_x, h) this.visible = true setlayeredwindowattributes( handle(this), 0, char(180), 2) ii_height = h timer(0.2, this) end event private function st_rect wf_get_taskbar_rect (ref long ax, ref long ay);long lul_shell st_rect lst_rect int li_i,li_h lul_shell = findwindow("Shell_TrayWnd", "") environment len if getenvironment(len) = -1 then return lst_rect getwindowrect(lul_shell, lst_rect) if lst_rect.left <= 4 then li_i += 1 //靠左 if lst_rect.bottom >= len.screenheight - 4 then li_i += 2 //靠下 if lst_rect.right >= len.screenwidth - 4 then li_i += 4 //靠右 if lst_rect.top <= 4 then li_i += 8 //靠上 choose case li_i case 7//居下 ax = 0 ay = pixelstounits(len.screenheight - lst_rect.top, ypixelstounits!) case 14//居右 ax = pixelstounits(len.screenwidth - lst_rect.left, xpixelstounits!) ay = 0 case 13,11//居上,居左 ax = 0 ay = 0 case 15 //全屏(任务栏不可能全屏显示) ax = len.screenwidth ay = len.screenheight end choose return lst_rect end function on w_tanchuang.create this.p_1=create p_1 this.st_1=create st_1 this.Control[]={this.p_1,& this.st_1} end on on w_tanchuang.destroy destroy(this.p_1) destroy(this.st_1) end on event open;setwindowpos(Handle(This), HWND_TOPMOST, 0, 0, 0, 0, 3) This.Visible = False wf_get_taskbar_rect( instance_taskbar_x, instance_taskbar_y) Long LL_RET LL_RET = getwindowulong( Handle(This), GWL_EXSTYLE) LL_RET += ws_Ex_layered SETWindowulong( Handle(This), GWL_EXSTYLE, LL_RET) Event ue_move() Long ll_count,i,ll_sum DateTime dt long ll_mailid[] ll_count = 0 i=0 dt = DateTime(Date(Today()),Time(0)) DECLARE read_mailid CURSOR FOR select mailid from u_email_set where empid=:sys_empid; OPEN read_mailid; i++ FETCH read_mailid Into :ll_mailid[i]; DO WHILE sqlca.SQLCode = 0 i++ FETCH read_mailid Into :ll_mailid[i]; LOOP CLOSE read_mailid; FOR i = 1 To UpperBound(ll_mailid) - 1 SELECT count(*) Into :ll_count From u_email_msg Where opdate > :dt And status = '未读' and mailid=:ll_mailid[i] Using sys_email_sqlca; IF IsNull(ll_count) THEN ll_count=0 ll_sum=ll_sum + ll_count next IF ll_sum = 0 Or IsNull(ll_sum) THEN Close(This) ELSE st_1.Text = "收到" + String(ll_sum) + "封邮件" END IF end event event timer;if ii_height >= ii_y + 50 then ii_height -= 50 else ii_height = ii_y timer(0, this) end if this.move(x, ii_height) end event type p_1 from picture within w_tanchuang integer x = 5 integer y = 44 integer width = 101 integer height = 72 string picturename = "graphics\newsout.BMP" boolean focusrectangle = false end type type st_1 from statictext within w_tanchuang integer x = 142 integer y = 36 integer width = 750 integer height = 92 integer textsize = -12 integer weight = 700 fontcharset fontcharset = gb2312charset! fontpitch fontpitch = variable! string facename = "宋体" long textcolor = 134217857 long backcolor = 67108864 boolean focusrectangle = false end type