Access - Posicionar ventana Access

 
Vista:

Posicionar ventana Access

Publicado por jesus (60 intervenciones) el 25/02/2005 08:57:52
Hola amigos, me gustaría saber cúal es el método para posicionar la ventana de Access en unas coordenadas determinadas de la pantalla y darle un tamaño concreto. Supongo que será alguno relativo al objeto Access, Screen, Application o DoCmd pero no consigo dar con él.
Muchas gracias por su colaboración.
Valora esta pregunta
Me gusta: Está pregunta es útil y esta claraNo me gusta: Está pregunta no esta clara o no es útil
0
Responder
sin imagen de perfil

RE:Posicionar ventana Access

Publicado por jose acilu (61 intervenciones) el 26/02/2005 12:15:32
Esta funcion esta escrita para access 2.0 pero te puede orientar facilmente

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
Function situarabajo (ByVal nombreformulario As String) As Integer
    'MODIFICADA PARA SITUAR EN LA PARTE Inferior POR JOSE ACILU.
    ' -----------------------------------------------------------------------
    Const POPUP = "OFormPopup"
    Dim WindowHandle As Integer, DesktopHandle As Integer
    Dim Buffer As String * 255
    Dim CLASSNAME As String, FormRectangle As rectangulo, DesktopRectangle As rectangulo
    Dim ReturnValue As Integer, FormHeight As Integer, FormWidth As Integer
    Dim DesktopWidth As Integer, DesktopHeight As Integer
    Dim x As Integer, y As Integer
 
    ReturnValue = 0
 
    On Error Resume Next
    If nombreformulario = "" Then
        WindowHandle = Screen.ActiveForm.hWnd
    Else
        WindowHandle = Forms(nombreformulario).hWnd
    End If
 
    If Err Then
    Else
        DesktopHandle = GetParent(WindowHandle)
        ReturnValue = GetClassName(WindowHandle, Buffer, Len(Buffer))
        CLASSNAME = Left$(Buffer, ReturnValue)
        GetWindowRect WindowHandle, FormRectangle
        If CLASSNAME = POPUP Then
            GetWindowRect DesktopHandle, DesktopRectangle
        Else
            ReturnValue = GetClientRect(DesktopHandle, DesktopRectangle)
        End If
 
        FormWidth = FormRectangle.Right - FormRectangle.Left
        FormHeight = FormRectangle.Bottom - FormRectangle.Top
        DesktopWidth = DesktopRectangle.Right - DesktopRectangle.Left
        DesktopHeight = DesktopRectangle.Bottom - DesktopRectangle.Top
 
        If CLASSNAME = POPUP Then
            x = DesktopRectangle.Left + (DesktopWidth - FormWidth) \ 2
 
             y = DesktopRectangle.Top + (DesktopHeight - FormHeight)
 
        Else
           x = (DesktopWidth - FormWidth) \ 2
           y = (DesktopHeight - FormHeight)
 
 
        End If
 
        ReturnValue = MoveWindow(WindowHandle, x, y, FormWidth, FormHeight, True)
    End If
Valora esta respuesta
Me gusta: Está respuesta es útil y esta claraNo me gusta: Está respuesta no esta clara o no es útil
0
Comentar

RE:Posicionar ventana Access

Publicado por 2pl (105 intervenciones) el 27/02/2005 20:03:25
Algo más facil , incluye en un modulo lo siguiente:
Declare Function glrMoveWindows Lib "user32" Alias "MoveWindow" (ByVal hwnd As Long, ByVal X As Long, ByVal Y As Long, ByVal nWindth As Long, ByVal nHeight As Long, ByVal bRepair As Long) As Long
Public posicionformulario As String ' para cargar la funcion en cada formulario en el evento Al Abrir
y luego utiliza la funcion como te indico
margenizquierdo=170
margen superior =75
ancho=700
alto=400
posicionformulario = glrMoveWindows(Me.hwnd, margenizquierdo, margensuperior,ancho,alto, True)
Valora esta respuesta
Me gusta: Está respuesta es útil y esta claraNo me gusta: Está respuesta no esta clara o no es útil
0
Comentar

Muchas gracias

Publicado por jesus (60 intervenciones) el 28/02/2005 08:59:02
Muchas gracias a todos por vuestra ayuda. Ya encontré una API que posiciona una ventana en la pantalla que es muy parecida a la de 2pl. La declaración es:

1
2
3
4
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
Valora esta respuesta
Me gusta: Está respuesta es útil y esta claraNo me gusta: Está respuesta no esta clara o no es útil
0
Comentar