Jump to content

ActiveX COMponents different behaviour ?


ptrex
 Share

Recommended Posts

Since I compiled my Firewall Log Analizer script with the lastest beta versions (saying 3.1.1.103 and 106),

I see a different behaviour of the COM objects.

(See script, IE Object should be showing on the second tab, but initially is showing on the first ?)

When the script was compiled with version 3.1.1.8x beta, this script was showing the IE objectl on the second tab of the tab control, when starting.

ONLY THE GUI related Script part is included !

;Main GUI
;---------
$Gui = GuiCreate("Firewall Log Analyzer for XP v1.2", 975, 571,(@DesktopWidth-797)/2, (@DesktopHeight-571)/2 , _ 
$WS_OVERLAPPEDWINDOW + $WS_VISIBLE + $WS_CLIPSIBLINGS)

$Helpmenu = GUICtrlCreateMenu ("?")
$Helpitem = GUICtrlCreateMenuitem ("Help",$Helpmenu)
$Infoitem = GUICtrlCreateMenuitem ("Info",$Helpmenu)

$Tab=GUICtrlCreateTab (8,30, 962,520)
GUICtrlSetResizing ($Tab,$GUI_DOCKAUTO)

;Tab1
$Tab1=GUICtrlCreateTabitem ("LogData")
$ListView = GUICtrlCreateListView("date|time|action| protocol| src-ip| dst-ip| src-port| dst-port| size| tcpflags|tcpsyn| tcpack| tcpwin| icmptype" _
, 10, 60, 957, 483,-1,$LVS_EX_HEADERDRAGDROP+$LVS_EX_FULLROWSELECT);Drag&Drop Columns
GUICtrlSetResizing ($Listview,$GUI_DOCKAUTO)
GUICtrlSetState($ListView,$GUI_FOCUS)
GUICtrlSetimage($ListView, "xpsp2res.dll",73);Set Icons for records
_GUICtrlListViewSetColumnWidth ($listview, 0,90);Set Column with

$Tab1combo1=GUICtrlCreateCombo ("# Lines", 10,6,60,40)
GUICtrlSetData(-1,"100|150|300|500|1000|2000|3000|4000", "100") ;Set default 100
GUICtrlCreateLabel("Select # of lines",80,10)

$Tab1combo2=GUICtrlCreateCombo ("Auto Refresh  ", 200,6,100)
GUICtrlSetData(-1,"1|5|10|20|30")                               ;Set default none

$Refresh = GuiCtrlCreateButton("Refresh", 852, 6, 90, 30)
GUICtrlSetTip($Refresh,"Use this button to manually refresh the data")

$Button_ON = GUICtrlCreateButton ("FW Status ", 380,5,40,40, $BS_ICON);Check status of FW & set Icon & Label
GUICtrlSetTip($button_ON,"Use this button to manually refresh the status") 
Enabled()                                                           

$Whois = GuiCtrlCreateButton("Whois", 650, 6, 90, 30)
GUICtrlSetTip($Whois,"Select an item in the list, and then use click the WHOIS button")

$Status= GUICtrlCreateLabel("Your firewall is " & $Label_ON ,440,10,$SS_SUNKEN);Create Label with variable FW status data

$Refresh_label= GUICtrlCreateLabel("Seconds",320,10,$SS_SUNKEN)

;Tab2
$Tab2=GUICtrlCreateTabitem ( "Whois ")
$oIE = ObjCreate("Shell.Explorer.2")                            ;Include Embedded IE Object
$GUIActiveX = GUICtrlCreateObj  ($oIE,  10, 60 , 952 , 486)
GUICtrlSetStyle ( $GUIActiveX,  $WS_VISIBLE )                   ;Show IE Object on tab2
GUICtrlSetResizing ($GUIActiveX,$GUI_DOCKAUTO)
$oIE.navigate("http://www.ripe.net")

;Tab3
$Tab3=GUICtrlCreateTabitem ( "Firewall Config ")

$Listbox1 = GUICtrlCreateList("", 10, 70, 930, 225)
GUICtrlSetResizing ($Listview,$GUI_DOCKAUTO)
GUICtrlCreateLabel("Applications allowed : ",15,55)
GUICtrlSetColor(-1,0xff0000)                                    ;Set Red color
GUICtrlSetFont (-1,7.5, 100, 4, $font)                          ;Set Font
Open_apps()

$Listbox2 = GUICtrlCreateList("", 10, 300, 930, 225)
GUICtrlSetResizing ($Listview,$GUI_DOCKAUTO)
GUICtrlCreateLabel("Open Ports : ",15,285)
GUICtrlSetColor(-1,0xff0000)
GUICtrlSetFont (-1,7.5, 100, 4, $font)
Open_ports()

$Link = GuiCtrlCreateLabel("Click here for more info : Ports Database", 120, 285, 290, 12)
GUICtrlSetColor ( -1, 0x0000ff)                                 ;Set Blue color
GUICtrlSetFont (-1, 7.5 , 100 , 4 )                             ;Set Font
GUICtrlSetCursor ( -1, 0 )                                      ;Activate Hyperlink function
GetBrowser()

;Error checking : Test OS = XP/SP2 
;----------------------------------
If $OS <> "Win_XP"  Then
    MsgBox (0, "Your OS is not XP : ", $OS, 3)
    ElseIf  $SP <> "Service Pack 2"  Then
    MsgBox (0, "Your OS is not on SP2 : ", $SP, 3)
Else                                
$filename = "C:\WINDOWS\pfirewall.log"                          ;Open the file and read data
EndIf

_LockAndWait()
Getdata()
_ResetLockWait()    

;GUI handling
;------------
GuiSetState()

Dim $B_DESCENDING[_GUICtrlListViewGetSubItemsCount ($listview)] ;Used by Sort Click Header

While 1
    $msg = GuiGetMsg()
    Select
    Case $msg = $GUI_EVENT_CLOSE
        ExitLoop
    Case $msg = $Tab1combo1                                         ;Read Combo Data
        GUICtrlRead($Tab1combo1)
         Status()
    Case $msg = $Tab1combo2 
        Do
         AutoRefresh()                                          ;Run Auto Refresh per Second
         sleep ($Combo2Item * 1000)
         DeleteList()
         Getdata()
         Status()
        Until $Combo2Item = 0 Or $msg = $GUI_EVENT_CLOSE
    Case $msg = $Button_ON                                      ;Read Firewall ON_OFF Status
         Status()
    Case $msg = $Whois
         ReadLine()
         Status()
     Case $msg = $Listview                                      ;Sort the list by the column header clicking
         _LockAndWait()
        _GUICtrlListViewSort($listview, $B_DESCENDING, GUICtrlGetState($Listview))
        _ResetLockWait()
         Status()
    Case $msg= $Link                                            ;Active Hyperlink
        run($HTTP,"",@SW_MAXIMIZE)      
    Case $msg = $infoitem
        Info()
        Msgbox(0,"Info",$Info)
    Case $msg = $Helpitem
        Help()
        Msgbox(0,"Help",$Help)
    Case else
        If $msg = $Refresh Then
        DeleteList()
        _LockAndWait()
        Getdata()
        _ResetLockWait()
        Status()    
        EndIf
    EndSelect
WEnd
Exit

Now when running the same script with the latest beta, the IE object is shown on the FIRST TAB.

Only when clicking the SECOND TAB in the GUI, and back the FIRST TAB, than it is shown correctly

(This means it stays on the SECOND TAB).

Does anyone know what has changed over time that the behaviour is different these days ?

Is this now by design or is there a change in funtionality ?

Thanks

Link to comment
Share on other sites

Hello Ptrex,

I remembered a similar topic at: http://www.autoitscript.com/forum/index.php?showtopic=14346

Didn't you wrote that example script?

I tested that script with 3.1.1.105/106: no problems. (I only added a line GUICtrlSetState($tab0 ,$GUI_SHOW) to show the first tab as default trying to simulate your problem).

Then I checked your new script...and rechecked again.. aren't you missing a line GUICtrlCreateTabitem ("") to END the tab definition ?? Because, when I remove the 'end tab definition' from the old example script I get exactly the same behaviour you describe with your current script.

-Sven

Link to comment
Share on other sites

@SvenP

Thanks for noticing the missing statement GUICtrlCreateTabitem ("")

I have been working on the script using different versions of AutoIT Beta for 3.1.1.8x to 3.1.1.9x.

Never was there this behauvior, because of the missing end statement ??

Anyhow I added the end statement end the behaviour is back to normal.

Glad to have you around again :lmao:

Thanks for the help (Bedankt)

Link to comment
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now
 Share

  • Recently Browsing   0 members

    • No registered users viewing this page.
×
×
  • Create New...