Ver Mensaje Individual
Antiguo 29-04-2009 , 15:09:45   #3
DAROGAS
Recien Registrado
No Tiene Avatar Configurado
Me Gusta
Estadisticas
Mensajes: 2
Me Gusta Recibidos: 0
Me Gustas Dados: 0
Ingreso: 28 abr 2009

Temas Nominados a TDM
Temas Nominados Temas Nominados 0
Nominated Temas Ganadores: 0
Reputacion Poder de Credibilidad: 0
Puntos: 10
DAROGAS el Usuariox esta entre el bien y el mal
  
Predeterminado Respuesta: Ayuda con Excel y las APIs de Windows

dim hwnd_Ventana as long

Private Declare Function GetForegroundWindow Lib "user32" () As Integer
Private Declare Function GetWindow Lib "user32" (ByVal hwnd As Long, ByVal wCmd As Long) As Long


if Titulo_Ventana="X" then ' llamo a esta funcion para obtener el nombre de la ventana y el hwnd
_ventana
end if

hwnd_Ventana = GetForegroundWindow()

If ESTADOVENTANA(hwnd_Ventana)<>3 THEN ' SI ES <> DE MAXIMIZADO

End if


Function Titulo_Ventana() As String
'Dim hwnd_Ventana As Long
Dim Length As Long

hwnd_Ventana = GetForegroundWindow()
Phandle = hwnd_Ventana
'Crea un Buffer para el caption del title bar
caption_ventana = Space$(1024)

' Retorna la cantidad de caracteres
Length = GetWindowText(hwnd_Ventana, caption_ventana, Len(caption_ventana))

' Obtiene solo el caption sin los espacios nulos de la cadena
caption_ventana = Left$(caption_ventana, Length)
Titulo_Ventana = caption_ventana
If caption_ventana <> Ventanaanterior Then
Ventanaanterior = caption_ventana
End If
End Function

Private Function ESTADOVENTANA(hwn As Long) As Byte
'Variable para usar la estructura WINDOWPLACEMENT
Dim T_WINDOWPLACEMENT As WINDOWPLACEMENT
Dim Ret As Long 'Valor de retorno de la función

'Para este ejemplo solo necesitamos enviarle el tamaño de la estructura
'en la variable Lenght
T_WINDOWPLACEMENT.Length = Len(T_WINDOWPLACEMENT)

'Llamamos a la función
Ret = GetWindowPlacement(hwn, T_WINDOWPLACEMENT)
' Form1.Cls
Select Case T_WINDOWPLACEMENT.showCmd

Case 1
'MsgBox "Form2 en estado Normal "
ESTADOVENTANA = 1
Case 2
' MsgBox "Form2 Minimizado "
ESTADOVENTANA = 2
Case 3
' MsgBox "Form2 Maximizado "
ESTADOVENTANA = 3
End Select
'Label3.Caption = T_WINDOWPLACEMENT.showCmd

End Function


espero te sirva

DAROGAS no está en línea   Responder Citando
 
Page generated in 0,04068 seconds with 11 queries