w_tanchuang.srw 4.9 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205
  1. $PBExportHeader$w_tanchuang.srw
  2. forward
  3. global type w_tanchuang from window
  4. end type
  5. type p_1 from picture within w_tanchuang
  6. end type
  7. type st_1 from statictext within w_tanchuang
  8. end type
  9. type st_rect from structure within w_tanchuang
  10. end type
  11. end forward
  12. type st_rect from structure
  13. long left
  14. long top
  15. long right
  16. long bottom
  17. end type
  18. global type w_tanchuang from window
  19. boolean visible = false
  20. integer width = 1038
  21. integer height = 272
  22. boolean titlebar = true
  23. string title = "通知"
  24. boolean controlmenu = true
  25. boolean minbox = true
  26. boolean maxbox = true
  27. boolean resizable = true
  28. long backcolor = 67108864
  29. string icon = "AppIcon!"
  30. event ue_move ( )
  31. p_1 p_1
  32. st_1 st_1
  33. end type
  34. global w_tanchuang w_tanchuang
  35. type prototypes
  36. FUNCTION ulong SetWindowPos(ulong hwnd,ulong hWndInsertAfter,ulong Ax,ulong Ay,ulong cx,ulong cy,ulong wFlags) LIBRARY "user32.dll"
  37. FUNCTION ulong FindWindow(string lpClassName,string lpWindowName) LIBRARY "user32.dll" ALIAS FOR "FindWindowA;Ansi"
  38. FUNCTION ulong GetWindowRect(ulong hwnd,ref st_RECT lpRect) LIBRARY "user32.dll" alias for "GetWindowRect;Ansi"
  39. FUNCTION ulong SetLayeredWindowAttributes(ulong hwnd,long crKey, char bAlpha, long dwflags) LIBRARY "user32.dll" alias for "SetLayeredWindowAttributes;Ansi"
  40. FUNCTION ulong GetWindowulong(ulong hwnd,ulong nIndex) LIBRARY "user32.dll" ALIAS FOR "GetWindowLongA"
  41. FUNCTION ulong SetWindowulong(ulong hwnd,ulong nIndex,ulong dwNewLong) LIBRARY "user32.dll" ALIAS FOR "SetWindowLongA"
  42. end prototypes
  43. type variables
  44. long instance_taskbar_x, instance_taskbar_y
  45. long ii_y, ii_height
  46. CONSTANT LONG HWND_TOPMOST = -1
  47. CONSTANT LONG LWA_COLORKEY = 1
  48. CONSTANT LONG LWA_ALPHA = 2
  49. CONSTANT LONG GWL_EXSTYLE = - 20
  50. CONSTANT LONG WS_EX_LAYERED = 524288
  51. end variables
  52. forward prototypes
  53. private function st_rect wf_get_taskbar_rect (ref long ax, ref long ay)
  54. end prototypes
  55. event ue_move();long w,h
  56. environment lenv
  57. if getenvironment(lenv) = -1 then return
  58. w = pixelstounits(lenv.screenwidth, xpixelstounits!)
  59. h = pixelstounits(lenv.screenheight,ypixelstounits!)
  60. ii_y = h - instance_taskbar_y - height
  61. this.move(w - width - instance_taskbar_x, h)
  62. this.visible = true
  63. setlayeredwindowattributes( handle(this), 0, char(180), 2)
  64. ii_height = h
  65. timer(0.2, this)
  66. end event
  67. private function st_rect wf_get_taskbar_rect (ref long ax, ref long ay);long lul_shell
  68. st_rect lst_rect
  69. int li_i,li_h
  70. lul_shell = findwindow("Shell_TrayWnd", "")
  71. environment len
  72. if getenvironment(len) = -1 then return lst_rect
  73. getwindowrect(lul_shell, lst_rect)
  74. if lst_rect.left <= 4 then li_i += 1 //靠左
  75. if lst_rect.bottom >= len.screenheight - 4 then li_i += 2 //靠下
  76. if lst_rect.right >= len.screenwidth - 4 then li_i += 4 //靠右
  77. if lst_rect.top <= 4 then li_i += 8 //靠上
  78. choose case li_i
  79. case 7//居下
  80. ax = 0
  81. ay = pixelstounits(len.screenheight - lst_rect.top, ypixelstounits!)
  82. case 14//居右
  83. ax = pixelstounits(len.screenwidth - lst_rect.left, xpixelstounits!)
  84. ay = 0
  85. case 13,11//居上,居左
  86. ax = 0
  87. ay = 0
  88. case 15 //全屏(任务栏不可能全屏显示)
  89. ax = len.screenwidth
  90. ay = len.screenheight
  91. end choose
  92. return lst_rect
  93. end function
  94. on w_tanchuang.create
  95. this.p_1=create p_1
  96. this.st_1=create st_1
  97. this.Control[]={this.p_1,&
  98. this.st_1}
  99. end on
  100. on w_tanchuang.destroy
  101. destroy(this.p_1)
  102. destroy(this.st_1)
  103. end on
  104. event open;setwindowpos(Handle(This), HWND_TOPMOST, 0, 0, 0, 0, 3)
  105. This.Visible = False
  106. wf_get_taskbar_rect( instance_taskbar_x, instance_taskbar_y)
  107. Long LL_RET
  108. LL_RET = getwindowulong( Handle(This), GWL_EXSTYLE)
  109. LL_RET += ws_Ex_layered
  110. SETWindowulong( Handle(This), GWL_EXSTYLE, LL_RET)
  111. Event ue_move()
  112. Long ll_count,i,ll_sum
  113. DateTime dt
  114. long ll_mailid[]
  115. ll_count = 0
  116. i=0
  117. dt = DateTime(Date(Today()),Time(0))
  118. DECLARE read_mailid CURSOR FOR
  119. select mailid from u_email_set where empid=:sys_empid;
  120. OPEN read_mailid;
  121. i++
  122. FETCH read_mailid Into :ll_mailid[i];
  123. DO WHILE sqlca.SQLCode = 0
  124. i++
  125. FETCH read_mailid Into :ll_mailid[i];
  126. LOOP
  127. CLOSE read_mailid;
  128. FOR i = 1 To UpperBound(ll_mailid) - 1
  129. SELECT count(*) Into :ll_count From u_email_msg Where opdate > :dt And status = '未读' and mailid=:ll_mailid[i] Using sys_email_sqlca;
  130. IF IsNull(ll_count) THEN ll_count=0
  131. ll_sum=ll_sum + ll_count
  132. next
  133. IF ll_sum = 0 Or IsNull(ll_sum) THEN
  134. Close(This)
  135. ELSE
  136. st_1.Text = "收到" + String(ll_sum) + "封邮件"
  137. END IF
  138. end event
  139. event timer;if ii_height >= ii_y + 50 then
  140. ii_height -= 50
  141. else
  142. ii_height = ii_y
  143. timer(0, this)
  144. end if
  145. this.move(x, ii_height)
  146. end event
  147. type p_1 from picture within w_tanchuang
  148. integer x = 5
  149. integer y = 44
  150. integer width = 101
  151. integer height = 72
  152. string picturename = "graphics\newsout.BMP"
  153. boolean focusrectangle = false
  154. end type
  155. type st_1 from statictext within w_tanchuang
  156. integer x = 142
  157. integer y = 36
  158. integer width = 750
  159. integer height = 92
  160. integer textsize = -12
  161. integer weight = 700
  162. fontcharset fontcharset = gb2312charset!
  163. fontpitch fontpitch = variable!
  164. string facename = "宋体"
  165. long textcolor = 134217857
  166. long backcolor = 67108864
  167. boolean focusrectangle = false
  168. end type