Oculta Ventana Access
Otro metodo mas para ocultar la Ventana de Access
*** EL CODIGO ***
Option Compare Database
Option Explicit
'***************************************************************
'& &*
'& &*
'& &*
'& &*
'& Jefferson Jimenez (JJJT) &*
'& Cabimas - Venezuela &*
'& Julio - 2010 &*
'& &*
'& &*
'& &*
'& &*
'& &*
'***************************************************************
'La Estructura del API GetWindowRect
Private Type RECT
Left As Long
Top As Long
Right As Long
Bottom As Long
End Type
'Declaramos las APIs
Private Declare Function SetWindowLong Lib "user32" Alias "SetWindowLongA" ( _
ByVal hwnd As Long, _
ByVal nIndex As Long, _
ByVal dwNewLong As Long) As Long
Private Declare Function GetWindowRect Lib "user32" ( _
ByVal hwnd As Long, _
lpRect As RECT) As Long
Private Declare Function GetDesktopWindow Lib "user32" () As Long
Private Declare Function CreateRectRgn Lib "gdi32" ( _
ByVal X1 As Long, _
ByVal Y1 As Long, _
ByVal X2 As Long, _
ByVal y2 As Long) As Long
Private Declare Function SetWindowRgn Lib "user32" ( _
ByVal hwnd As Long, _
ByVal hRgn As Long, _
ByVal bRedraw As Boolean) As Long
'Las Constantes para el API SetWindowLong
Private Const GWL_EXSTYLE = (-20)
Private Const WS_EX_LAYERED = &H80000
Public Function OcultaVentanaAccess()
'Quien Oculta Access ?
'Esta funcion se la pasa el API SetWindowLong _
asignandole un nuevo Handle a la Ventana Madre de Access
Dim HwNdAccs, ReT, NewLong As Long
HwNdAccs = Application.hWndAccessApp 'Primero buscamos el Handle de Access
'Conociendo el Height del Monitor establezco el cuadro a Borrar
'Para esto debo conocer el Height del Monitor, que mas abajo lo busco
ReT = CreateRectRgn(0, 0, AltoMonitor, 0)
'Ahora rediseño la ventana con la API SetWindowRgn
NewLong = SetWindowRgn(HwNdAccs, ReT, -1)
'Conociendo el Nuevo Handle se lo paso a la ventana madre de Access
SetWindowLong HwNdAccs, GWL_EXSTYLE, NewLong Or WS_EX_LAYERED
End Function
Private Function AltoMonitor() As Long 'Busco el Height de la pantalla activa en Twips
Dim rec As RECT
Call GetWindowRect(GetDesktopWindow, rec)
AltoMonitor = CStr(rec.Right - rec.Left)
End Function