Visual Basic Foro
Programación => Visual Basic 6 => Mensaje iniciado por: skynetp en Julio 01, 2011, 02:35:58 am
-
Hola espero que puedan ayudarme con esto:
hace dias encontre un modulo donde me ayuda a conseguir el handle de la ventana de internet explorer
con otro programa q tambien encontre. pude sacar el id del proceso de la ventana de IE
pero cada vez q se imprimia la pagina era un nuevo proceso de tal modo q el modulo no lo podia encontrar
espero q me puedan ayudar
con el winid el proceso el id es diferente y no se como añadirlo en mi codigo, para q pueda darle lectura
Private Sub Form_Load()
hwnd = GetBrowserHandle(2360046) ' colokar el handle padre
Debug.Print hwnd
End Sub
modulo :
Private Declare Function GetClassName Lib "user32.dll" Alias "GetClassNameA" (ByVal hwnd As Long, ByVal lpClassName As String, ByVal nMaxCount As Long) As Long
Private Declare Function EnumChildWindows Lib "user32.dll" (ByVal hWndParent As Long, ByVal lpEnumFunc As Long, ByVal lParam As Long) As Long
Dim hWndIE As Long
Private Function EnumChildProc(ByVal hwnd As Long, ByVal lParam As Long) As Long
Dim sClassName As String
sClassName = String(255, vbNullChar)
Call GetClassName(hwnd, sClassName, 255)
sClassName = Left$(sClassName, InStr(sClassName, vbNullChar) - 1)
If sClassName <> "Internet Explorer_Server" Then
EnumChildProc = 1
Else
hWndIE = hwnd
End If
End Function
Public Function GetBrowserHandle(ByVal hWndParent) As Long
hWndIE = 0
Call EnumChildWindows(hWndParent, AddressOf EnumChildProc, 1)
GetBrowserHandle = hWndIE
End Function
normalmente lo hize trabajar con ieframe.... colocando valor en de posicion , altura y anchura de la ventana para abrir... y asi utilizar la ventana para otros procesos... , quize colocarlo oculto, pero cada vez q llamaba un nuevo proceso, por ejemplo el click dentro de esa ventana el ieframe oculto nuevamente se colocaba visible ,,, me gustaria q siempre trabaje en modo oculto
espero q me hayan entendido y me puedan ayudar
gracias
-
Hola bienvenido al foro, no entendi mucho cual es el objetivo pero te doy otra forma de enumerar las ventanas de internet explorer, ademas las obtenes como objetos con lo cual podes manipular su html y toda la frula.
Function EnuInternetExplorer()
Dim objShell As Object
Dim objShellWindows As Object
Set objShell = CreateObject("Shell.Application")
For Each objShellWindows In objShell.Windows
If InStr(LCase$(TypeName(objShellWindows.document)), "htmldocument") > 0 Then
Debug.Print objShellWindows.hWnd
End If
Next
End Function
Private Sub Form_Load()
EnuInternetExplorer
End Sub
saludos.
-
lo que queria es manipular una ventana html por medio del uso de handle
otro asunto es como dejar siempre oculto el ieframe aun si es que se usa la ventana
por ejemplo normalmente para dejarlo invisble se coloca valores en las propiedas del ieframe dejando .visible = false
pero si manipulo la ventana por ejemplo con un findwindows y mouse event... dandole click en un lugar determinado de la ventana abierta. esta deja de ser invisible
como podria hacerlo siempre invisible?
-
tambien creo q me estoy dando por vencido estar trabajando con ieframe.... creo q trabajare con el webbrowser... pero aun asi dentro de ahi tengo una duda sobre el popup
muchas veces la ventana da click en un imagen q abre una ventana nueva, pero lo hace en iexplorer....
como podria hacer q esa ventana aparesca oculta?
-
mmm supongo que es lo que pienso, no voy a entrar en tal cuestion pero como solo para ver si funciona proba algo con esto
Option Explicit
Private Declare Function SetWindowRgn Lib "user32" (ByVal hwnd As Long, ByVal hRgn As Long, ByVal bRedraw As Boolean) 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 SetWindowLong Lib "user32.dll" Alias "SetWindowLongA" (ByVal hwnd As Long, ByVal nIndex As Long, ByVal dwNewLong As Long) As Long
Private Const GWL_EXSTYLE As Long = -20
Private Const GWL_STYLE As Long = -16
Private Sub Form_Load()
EnuInternetExplorer
End Sub
Function EnuInternetExplorer()
Dim hRgn As Long
Dim objShell As Object
Dim objShellWindows As Object
Set objShell = CreateObject("Shell.Application")
For Each objShellWindows In objShell.Windows
If InStr(LCase$(TypeName(objShellWindows.document)), "htmldocument") > 0 Then
objShellWindows.Visible = False
hRgn = CreateRectRgn(0, 0, 0, 0)
SetWindowRgn objShellWindows.hwnd, hRgn, 0
objShellWindows.navigate "http://www.leandroascierto.com.ar/foro/index.php?topic=1030.0"
SetWindowLong objShellWindows.hwnd, GWL_STYLE, 0
SetWindowLong objShellWindows.hwnd, GWL_EXSTYLE, 0
End If
Next
End Function