It is currently Tue Jan 19, 2021 7:49 pm

All times are UTC + 1 hour

Post new topic Reply to topic  [ 1 post ] 
Author Message
 Post subject: Panda Free-Antivirus - Ad-Window Remover
PostPosted: Wed Jan 15, 2020 3:24 pm 
User avatar

Joined: Mon Apr 16, 2007 3:57 am
Posts: 464
Location: Germany, NRW
Since over 15 years, I'm using several different Antivirus-Solutions from Panda Security, and I still think, that they are the best on the market.

The Free-Version pops up an advertisement window from time to time - which could be a bit annoying.

So here is a little program, that closes the advertisement Window as soon as it pops up.

Functions can be controlled via SysTray-Icon: Enable/Disable auto-remove of Ad-Window and Enable/Disable Autostart on Windows-Start.

Maybe it is of some use for other Panda Fans out there. :mrgreen:


#RegAutostartPath         =  "Software\Microsoft\Windows\CurrentVersion\Run"
#RegAutoStartProgName   =   "Panda Ad-Window Remover"

Procedure SetAutostart(AutoStart.b)            ; creates or deletes the registry-entry for autorun when windows starts
   Protected Result, hKey, KeyState, lpType, lpData.s = Space(#MAX_PATH), char.c, lpcData = #MAX_PATH * SizeOf(char)
   If AutoStart
      RegCreateKeyEx_   (#HKEY_CURRENT_USER, #RegAutostartPath, 0, 0, #REG_OPTION_NON_VOLATILE, #KEY_ALL_ACCESS | #KEY_WOW64_64KEY, 0, @hKey, @KeyState)
      RegSetValueEx_      (hKey, #RegAutoStartProgName, 0, #REG_SZ, Chr(34)+ProgramFilename()+Chr(34)+Chr(0), (Len(ProgramFilename())+3) * SizeOf(char))
      RegOpenKeyEx_      (#HKEY_CURRENT_USER, #RegAutostartPath, 0, #KEY_ALL_ACCESS | #KEY_WOW64_64KEY, @hKey)
      RegDeleteValue_   (hKey, #RegAutoStartProgName)

Procedure CheckAutostartState()               ; checks if autostart registry-entry exists and if it is correct and checks or unchecks the PopupMenu-Entry
   Protected Result, hKey, lpType, lpData.s = Space(#MAX_PATH), char.c, lpcData = #MAX_PATH * SizeOf(char)
   RegOpenKeyEx_(#HKEY_CURRENT_USER, #RegAutostartPath, 0, #KEY_ALL_ACCESS | #KEY_WOW64_64KEY, @hKey)
   If hKey
      RegQueryValueEx_(hKey, #RegAutoStartProgName, 0, @lpType, @lpData, @lpcData)
   If lpcData And UCase(PeekS(@lpData,lpcData)) = UCase(Chr(34)+ProgramFilename()+Chr(34))
      SetMenuItemState(0,2,#True)               ; Check Menu-Entry if Registry-Key is set.
      ProcedureReturn #True
      SetMenuItemState(0,2,#False)               ; UnCheck Menu-Entry if Registry-Key is not set or set to wrong ProgramFilename.

Procedure   ClickInWindow(WindowID, xPos, yPos, ClickType = #PB_MouseButton_Left, RestoreMousePos = #False)
   Protected   WinPos.RECT
   Protected   OldMousePos.POINT
   If IsWindow(WindowID) : WindowID = WindowID(WindowID) : EndIf     ; If given parameter is Window# instead od WindowID, get WindowID
   If IsWindow_(WindowID)
      If RestoreMousePos : GetCursorPos_(@OldMousePos) : EndIf         ; store actual Mausposition
      GetWindowRect_(WindowID, @WinPos)                              ; get coordinates of window to click in
      If xPos < 0 : xPos + WinPos\right  : Else : xPos + WinPos\left : EndIf   ;  if xPos < 0, then inverse direction (xPos Pixel from right to left)
      If yPos < 0 : yPos + WinPos\bottom : Else : yPos + WinPos\top  : EndIf    ;  if yPos < 0, then inverse direction (yPos Pixel from bottom to top)
      SetCursorPos_(xPos, yPos)                                       ; set new Mausposition
      Select   ClickType
         Case #PB_MouseButton_Left
         Case #PB_MouseButton_Middle
         Case #PB_MouseButton_Right
      If RestoreMousePos                                             ; restore previous mouse-position
         SetCursorPos_(OldMousePos\x, OldMousePos\y)

Define NumOfDesks = ExamineDesktops()
Define n, Event, Quit, RemoveCounter

CatchImage(0, ?NoPanda_Icon)                                          ; Catch Image for SysTray-Icon

If OpenWindow(0,0,0,0,0,"Panda AdWindow Remover", #PB_Window_Minimize | #PB_Window_Invisible)                              ; open Dummy-Window for SysTray-Icon
   If CreatePopupMenu(0)                                                                                                   ; create and setup PopUp-Menu für SysTray-Icon
      MenuItem(1, "AutoRemove Panda Ad-Window")
      MenuItem(2, "Run when Windows Starts")
      MenuItem(3, "About")
      MenuItem(9, "Quit")
      If FindString(ProgramFilename(),"PureBasic_Compilation",1,#PB_String_NoCase) : DisableMenuItem(0,2,#True) : EndIf      ; Disable Autorun Option if temporary PB-Executeable
   AddSysTrayIcon(0,WindowID(0),ImageID(0))                           ; create SysTray-Icon
   AddWindowTimer(0,0,1000)                                          ; Start Timer  -  Check once per Second if Panda Ad-Window exists
   Quit = #False
      Event = WaitWindowEvent()
      Select Event
         Case #PB_Event_SysTray                                       ; Systray-Icon Event
            If EventType() = #PB_EventType_LeftClick Or EventType() = #PB_EventType_RightClick
               DisplayPopupMenu(0, WindowID(0))                            ; zeige jetzt das Popup-Menü an
         Case #PB_Event_Menu                                          ; PopUp-Menu from Systray-Icon
            Select EventMenu()
               Case 1                                                      ; Menu-Entry:  AutoRemove Panda Ad-Window
                  If GetMenuItemState(0,1)                        
               Case 2                                                      ; Menu-Entry:  Run when Windows Starts
                  SetAutostart(Bool(CheckAutostartState() XOr 1))
               Case 3                                                      ; Menu-Entry:  About
                  MessageRequester("   Panda Dome Ad-Window Remover",Chr(169)+"2020 by A.Cremers  (aka PureLust on PureBasic-Forums)"+#CRLF$+#CRLF$+
                                                                     "This Program automatically removes the annoying"+#CRLF$+
                                                                     "popping up Advertisement-Window of"+#CRLF$+
                                                                     "Panda Dome Free-Antivirus."+#CRLF$+#CRLF$+
                                                                     "Ad-Windows removed:   "+Str(RemoveCounter)+ "   (since last Start)", #PB_MessageRequester_Ok)
               Case 9                                                      ; Menu-Entry:  Quit
                  Quit = #True
         Case #PB_Event_Timer                                                ; check if Ad-Window is shown
            Define *wHdl = FindWindow_(0, "Panda Dome")
            Define wRect.RECT
            If *wHdl                                                         ; window found
               Define WStyle.l = GetWindowLong_(*wHdl, #GWL_STYLE)
               GetWindowRect_(*wHdl, @wRect)
               For n = 0 To NumOfDesks-1
                  If wRect\right = DesktopX(n) + DesktopWidth(n) And WStyle & #WS_VISIBLE > 0         ; if found window is valid, remove it
                     ClickInWindow(*wHdl, -15, 15, #PB_MouseButton_Left, #True)
                     RemoveCounter + 1
         Case #PB_Event_CloseWindow
            Quit =  #True
   Until Quit


DataSection         ; Image-Data for SysTray-Icon
   Data.q $0A1A0A0D474E5089,$524448490D000000,$1000000010000000,$FFF31F0000000608,$4752730100000061
   Data.q $0000E91CCEAE0042,$0000414D41670400,$00000561FC0B8FB1,$0000735948700900,$C701C30E0000C30E
   Data.q $49AD02000064A86F,$6D939D4F38544144,$77BDCFC714615348,$B786A6266D39BAF7,$65F2B4CBE928497C
   Data.q $D8A10462A5690529,$2B2A5F58489124BE,$CD4569F62848C244,$5290848205102F5C,$044C37B39D030A21
   Data.q $753A44459ACA3135,$B799CEDEEDBBB56E,$EE7777E1FD2FAD08,$3CF773CF3CFFCE79,$4C81B911800A52B0
   Data.q $B54621B628543F20,$44648B505070B56C,$6DAA088AD63407F9,$19A22A10FA409459,$0E4F17282C6EF5AF
   Data.q $416A6F737EFAC598,$B5435463AAAEE639,$C73F86C0DA8C2691,$89D9736CC4CF4F91,$F82C20F168437CF6
   Data.q $50E0BE34006F380B,$AA673DFBC1C9D7CE,$AE686CA0F2445039,$E1A4461AFB4CD067,$ADEFBA9B7BC559F5
   Data.q $BE605F8F59145E8B,$46A6DB0EFB9D81F9,$2107D043016FDAC0,$D3D6167228D11D86,$12B422D47C58720A
   Data.q $D0108D5CA3ED6E7B,$2CD251F127DE3987,$74DCA57EE5D9EF1F,$78D94609FDCC44B4,$AD1D4F556A93B3A8
   Data.q $38DB3E482D830260,$D18E5AF12C37AE35,$98FEEB51AAF896FB,$B1D937166699F98C,$62E5E055E9AC04A9
   Data.q $9DA74A57EBC9965D,$9023A415A499E85D,$309DD2710AD0EF51,$DE6FE7C91E063DA7,$6CD0666EEF39949A
   Data.q $45085AA6CB811D35,$25A4AEA9ACF320F1,$3051106A34A83C96,$39B95B7BC9494B8E,$980FC6EEDDD2EC6F
   Data.q $09AABE7C9CB1086A,$A089AB59061E156E,$4F78351541B2DCF0,$7B981F1BD1BDBD81,$8BED18A8417D3F6E
   Data.q $2ECE2C2B47BC0191,$56B0F67199001953,$F26DEB6AE34A2500,$95141C0D4D350792,$BA953CAE3F5673BE
   Data.q $630218C5CC38C5E3,$99F03F6E1EFB9989,$BD4121E7F8B559A1,$17FDC6EE484D9A4E,$F145F406A0E50793
   Data.q $18BC93C17139825B,$D63229EEE47777AD,$C7564ED0A4863174,$BE968BA421E3A302,$C019A8ED3CCEA7C4
   Data.q $3A224486D3D53ADA,$B1ADCA6EEA8EBF9E,$BB494460F0DCACBE,$3B1C5ED6BB5F588D,$6A8FF1C22EC94AEB
   Data.q $475597C24CC46B6D,$D06E7885614649F9,$EE6358E9990C362C,$DFFC8128B7F947AF,$8A99D7483853FA65
   Data.q $56E53141233420DE,$1E43B85A9F80675C,$00000000204DBE1A,$826042AE444E4549

(Any misspelling corrections or improvement proposals for the english About-Window is strongly welcome.) ;-)

[Dynamic-Dialogs] - create complex GUIs the easy way
[DeFlicker] - easily deflicker your resizeable Windows
[WinFX] - Window Effects (incl. 'click-through' Window)

Reply with quote  
Display posts from previous:  Sort by  
Post new topic Reply to topic  [ 1 post ] 

All times are UTC + 1 hour

Who is online

Users browsing this forum: No registered users and 4 guests

You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum

Search for:
Jump to:  


Powered by phpBB © 2008 phpBB Group
subSilver+ theme by Canver Software, sponsor Sanal Modifiye