21/11/2005, 22:06
|
| | Fecha de Ingreso: abril-2005
Mensajes: 351
Antigüedad: 19 años, 7 meses Puntos: 3 | |
Hola me interso el tema e hice algunas modificaciones les dejo para que miren y corrijan si es nesesario en un modulo:
Option Explicit
Private 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
Const HWND_TOPMOST = -1
Const SWP_NOMOVE = &H2
Const SWP_NOSIZE = &H1
Private Declare Function FindWindow Lib "user32" Alias "FindWindowA" (ByVal lpClassName As String, ByVal lpWindowName As String) 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
Public Sub SlideForm(FRM As Form, Direccion As Long)
Dim Posicion As Integer
Dim Tamaño As Integer
Dim hwnd As Long
Dim res As Long
Dim buffRECT As RECT
hwnd& = FindWindow("Shell_TrayWnd", "")
If hwnd > 0 Then
res = GetWindowRect(hwnd, buffRECT)
If res > 0 Then
Tamaño = CStr(buffRECT.Bottom - buffRECT.Top) * 15
If buffRECT.Left <= 0 And buffRECT.Top > 0 Then Posicion = 1
If buffRECT.Left > 0 And buffRECT.Top <= 0 Then Posicion = 2: Tamaño = (buffRECT.Right - buffRECT.Left) * 15
If buffRECT.Left <= 0 And buffRECT.Top <= 0 And buffRECT.Right < 600 Then Posicion = 3: Tamaño = buffRECT.Right * 15
If buffRECT.Left <= 0 And buffRECT.Top <= 0 And buffRECT.Right > 600 Then Posicion = 4
End If
Else
Posicion = 1
End If
res = SetWindowPos(FRM.hwnd, HWND_TOPMOST, 0, 0, 0, 0, SWP_NOMOVE Or SWP_NOSIZE)
If Direccion = 0 Then
FRM.Show
FRM.Height = 0
Select Case Posicion
Case 1
FRM.Move Screen.Width - FRM.Width, Screen.Height - FRM.Height - Tamaño
Case 2
FRM.Move Screen.Width - FRM.Width - Tamaño, Screen.Height - FRM.Height
Case 3
FRM.Move Tamaño, Screen.Height - FRM.Height
Case 4
FRM.Move Screen.Width - FRM.Width, Tamaño
End Select
Do Until FRM.Height = 3000 ' la altura que se quiera
DoEvents
FRM.Height = FRM.Height + 1
If Not Posicion = 4 Then FRM.Top = FRM.Top - 1
Loop
Else
Do Until FRM.Height = 520
DoEvents
FRM.Height = FRM.Height - 1
If Not Posicion = 4 Then FRM.Top = FRM.Top + 1
Loop
Unload FRM
End If
End Sub ----------------
y en el form1(agregue tambien un form2)
'para abrir
SlideForm Form2, 0
' y para cerrar
SlideForm Form2, 1 |