有个用form2.Show (1)方法显示的窗口,想实现鼠标在窗口外点击(窗口标题栏闪动)时自动实现Unload Me,请问怎么实现
解决方案 »
- 恢复被最小化的整个应用程序
- 怎么把文本添加到某个文本文件的后面
- 在sql server中运行正常的代码,为什么在用Oracel 9i的时候,却出现不支持addnew()的问题??
- 小弟做报警信息系统的问题?
- 问一个关于文件读写操作的问题
- 怎样在设计的时候使用Tabstrip控件,向每个页里面加入其它控件??vb6.0
- 学习VB的前途==?
- 有什么方法可以不让它溢出??
- adorecordset的二次打开的问题
- 关于single类型数据的一点疑问,恳请指教!
- setup factory 6 打包时的问题
- VB怎样利用API函数模拟一个含有文件字段的网页表单的提交?即API函数怎么post二进制数据?
'This Project needs
'- two timers, interval=100
'- a button'in general section
Private Type POINTAPI
x As Long
y As Long
End TypePrivate Declare Function GetActiveWindow Lib "user32" () As Long
Private Declare Function GetWindowDC Lib "user32" (ByVal hwnd As Long) As Long
Private Declare Function Ellipse Lib "gdi32" (ByVal hdc As Long, ByVal X1 As Long, ByVal Y1 As Long, ByVal X2 As Long, ByVal Y2 As Long) As LongPrivate Declare Function TextOut Lib "gdi32" Alias "TextOutA" (ByVal hdc As Long, ByVal x As Long, ByVal y As Long, ByVal lpString As String, ByVal nCount As Long) As Long
Private Declare Function GetCursorPos Lib "user32" (lpPoint As POINTAPI) As Long
Private Sub Form_Load()
Timer1.Interval = 100
Timer1.Enabled = True
Timer2.Interval = 100
Timer2.Enabled = True
Command1.Caption = "Draw Text"
End Sub
'This will draw an Ellipse on the active window
Sub Timer1_Timer()
Dim Position As POINTAPI
'Get the cursor position
GetCursorPos Position
'Draw the Ellipse on the Screen's DC
Ellipse GetWindowDC(0), Position.x - 5, Position.y - 5, Position.x + 5, Position.y + 5
End Sub
Sub Command1_Click()
Dim intCount As Integer, strString As String
strString = "Cool, text on screen !"
For intCount = 0 To 30
'Draw the text on the screen
TextOut GetWindowDC(0), intCount * 20, intCount * 20, strString, Len(strString)
Next intCount
End Sub
Private Sub Timer2_Timer()
'Draw the text to the active window
TextOut GetWindowDC(GetActiveWindow), 50, 50, "This is a form", 14
End Sub
Private Declare Function GetCursorPos Lib "user32" (lpPoint As POINTAPI) As Long
Private Declare Function GetWindowRect Lib "user32" (ByVal hwnd As Long, lpRect As RECT) As Long
Private Type RECT
Left As Long
Top As Long
Right As Long
Bottom As Long
End Type
Private Type POINTAPI
X As Long
Y As Long
End Type
Dim p As POINTAPI, r As RECT
Private Sub Timer1_Timer()
a = GetAsyncKeyState(1)
If a <> -32767 Then Exit Sub
GetCursorPos p
GetWindowRect hwnd, r
If p.X < r.Left Or p.Y < r.Top Or p.X > r.Right Or p.Y > r.Bottom Then Unload Me
End Sub