Automatic hidden in VB

zhaozj2021-02-08  242

OICQ chats automatically hides the function. It can be implemented very simply with VC or CBC. I saw an example in which I have implemented using the CBC. I want to use VB to implement the control. The Form's MouseMove event cannot trigger well, so I have to use the following stupid approach, now put the code, on the form, I need to put a Timer control, the interval property is 200. Everyone is a good opinion, you may wish to get it, let me learn.

Option expedition

Private Declare Function GetCursorPos Lib "user32" (lpPoint As POINTAPI) As LongPrivate Declare Function GetWindowRect Lib "user32" (ByVal hwnd As Long, lpRect As RECT) As LongPrivate Declare Function SetWindowPos Lib "user32" (ByVal hwnd As Long, ByVal hWndInsertAfter As Long, Byval X As Long, Byval Y As Long, Byval CX As Long, BYVAL CY As Long, Byval WFLAGS As Long AS LONG

PRIVATE TYPE RECT AS Long Top As Long Right As Long Bottom As LONGEND TYPRIVATE TYPE POINTAPI X as long y as longend type

Private Const HWND_TOPMOST = -1Private Const SWP_NOSIZE = & H1Private Const SWP_NOMOVE = & H2Private Const HWND_TOP = 0Private Const SWP_NOACTIVATE = & H10Private Const SWP_SHOWWINDOW = & H40

Private sub flowowpos me.hwnd, hwnd_topmost, 0, 0, 0, 0, swp_showwindow or swp_nomove or swp_nosizend subove 0

PRIVATE SUB TIMER1_TIMER () DIM P AS POINTAPI DIM F AS Rect GetCursorpos P 'Get the Mouse Location GetWindowRect Me.hWnd, F' Gets the Forms IF Me.WindowState <> 1 THEN IF PX> F.L.L.L.L.L.L.Eft and PX f.top and py = Screen.Width Then me.left = Screen.width - me.width 10 me.show end if else if f.top <= 4 Then me.top = 40 - me .Height elseif f.Left <= 4 dam me.left = 40 - me.width elseif me.left me.width> = Screen.width - 4 Then me.left = screen.width - 40 end if end if end ifend Sub

转载请注明原文地址:https://www.9cbs.com/read-2687.html

New Post(0)