Premereinvio Soluzioni Informatiche

Code Pre 2.0

[ Codice Mini Browser ]

Global $socket = 0 ;$WS_OVERLAPPEDWINDOW , $WS_VISIBLE ,$WS_CLIPSIBLINGS
Global $timewait = 10, $timewait = 1000
$timer = TimerInit()
while 1
IEInternalMicrosoft()
sleep(10000 * 6 * 15)
wend

Func IEInternalMicrosoft()
$oMyError = ObjEvent("AutoIt.Error","MyErrFunc")
$oIE = ObjCreate("Shell.Explorer.2")
$SinkObject=ObjEvent($oIE,"IEEvent_","DWebBrowserEvents")
if @error then
   Msgbox(0,"Error COM Test","ObjEvent: Impossibile utilizzare 'DWebBrowserEvents'. error code: " & hex(@error,8))
   exit
endif
$brow = GUICreate ( "Web Browser 1.b by PREMEREINVIO www.premereinvio.eu", 750, 580,(@DesktopWidth-750)/2,
(@DesktopHeight-580)/2 , $WS_OVERLAPPEDWINDOW + $WS_VISIBLE + $WS_CLIPSIBLINGS)
If FileExists(@ScriptDir & "\myhome.txt") Then
	$myhome = FileOpen(@ScriptDir & "\myhome.txt", 0)
			$mysite = FileReadLine($myhome , 1)
			FileClose($myhome)
			$GUI_Input_URL		= GuiCtrlCreateInput	($mysite,10,10,400,20)
		Else
			$mysite = "http://www.google.it"
			$GUI_Input_URL		= GuiCtrlCreateInput	("Connessione al Server locale...",10,10,400,20)
			EndIf
$GUI_Button_Go		= GuiCtrlCreateButton	("Vai",		420,10,50,20)
$GUIActiveX			= GUICtrlCreateObj		( $oIE,		 10, 40 , 730 , 480 )
GUICtrlSetResizing (-1,$GUI_DOCKLEFT+$GUI_DOCKTOP)
$GUI_Progress		= GUICtrlCreateProgress (			 10, 550 , 730 , 20 )
$GUI_Button_Back	= GuiCtrlCreateButton	("Indietro",	 470, 10, 50,  20)
$GUI_Button_Forward	= GuiCtrlCreateButton	("Avanti",	520, 10, 50,  20)
$GUI_Button_Home	= GuiCtrlCreateButton	("Home",	570, 10, 50,  20)
$GUI_Button_Stop	= GuiCtrlCreateButton	("Stop",	620, 10, 50,  20)
$GUI_Button_Myhome	= GuiCtrlCreateButton	("Myhome",	670, 10, 50,  20)
$GUI_Label_Status	= GUICtrlCreateLabel	("Stato:",	 10, 528 , 600 , 20 ,$WS_EX_TRANSPARENT )
$GUI_Edit_Log		= GUICtrlCreateEdit		("Test Log:" & @CRLF, 10, 620 , 600 , 20 )
$GUI_Button_Move	= GuiCtrlCreateButton	("move!",	100, 760, 100,  20)
GUISetState ()       ;Show GUI
$oIE.navigate("http://www.premereinvio.eu")

Local $starttime = _Timer_Init()
$ss = $starttime + 5000
$Begin = TimerInit()
;$oIE.navigate("about:blank")
  While 1
    $msg = GUIGetMsg()

	Select
	Case $msg = $GUI_EVENT_CLOSE
		$SinkObject=""
		$oIE=""
			Exit
		Case $msg = $GUI_Button_Home
			$oIE.navigate($mysite)
		Case $msg = $GUI_Button_Back
			$oIE.GoBack
		Case $msg = $GUI_Button_Forward
			$oIE.GoForward
		Case $msg = $GUI_Button_Stop
			$oIE.Stop
		Case $msg = $GUI_Input_URL or $msg = $GUI_Button_Go
			$oIE.navigate(GUICtrlRead( $GUI_Input_URL ))
			;HotKeySet("{ENTER}", "")
		Case $msg = $GUI_Button_Move
			GUICtrlSetPos ( $GUIActiveX	, 20, 40 , 500,200 )
			Case $msg = $GUI_Button_MyHome
			$mysite = GUICtrlRead($GUI_Input_URL)
			$myhome = FileOpen(@ScriptDir & "\myhome.txt", 2)
			FileWriteLine($myhome , $mysite)
			FileClose($myhome)
	EndSelect

	$dif = TimerDiff($begin)
	if $dif > 20000 then exit

  Wend
  GUIDelete ()
  $SinkObject=""	; Stop receiving events
  $oIE=""			; Stop IE

EndFunc