; minibrowser.pb ; ------------------------------------------------------------ ; This is a minimalistic browser for admin purposes. ; It was derived from: MiniBrowser, (c) Fantaisie Software ; LICENSE : GPL ; AUTHOR : Michael H.G. Schmidt ; EMAIL : michael@schmidt2.de ; DATE : 20230214 ; ------------------------------------------------------------ ; Global StartPage$ = "http://Bing.de" Procedure ResizeWebWindow() ResizeGadget(10, #PB_Ignore, #PB_Ignore, WindowWidth(0), WindowHeight(0)-20) ResizeGadget(4, #PB_Ignore, #PB_Ignore, WindowWidth(0)-200, #PB_Ignore) ResizeGadget(5, WindowWidth(0)-30, #PB_Ignore, #PB_Ignore, #PB_Ignore) ResizeGadget(6, #PB_Ignore, #PB_Ignore, WindowWidth(0), #PB_Ignore) EndProcedure Procedure JavaScriptErrorMessages(WebGadget,MyState) Protected MyWebGadget.IWebBrowser2 MyWebGadget=GetWindowLongPtr_(GadgetID(Webgadget), #GWL_USERDATA) MyWebGadget\put_Silent(MyState) EndProcedure If OpenWindow(0, 100, 200, 800, 600, "MiniBrowser", #PB_Window_MinimizeGadget | #PB_Window_MaximizeGadget | #PB_Window_SizeGadget) LoadFont(1,"Courier",10, #PB_Font_Bold) SetGadgetFont(#PB_Default, FontID(1)) ButtonGadget(1, 0, 3, 60, 25, "Insecure") SetGadgetFont(#PB_Default, #PB_Default) ButtonGadget(2, 60, 3, 50, 25, "Back") ButtonGadget(3, 110, 3, 50, 25, "Stop") StringGadget(4, 165, 5, 0, 20, StartPage$) ButtonGadget(5, 0, 3, 25, 25, "Go") FrameGadget(6, 0, 30, 0, 2, "", 2) ; Nice little separator WebGadget(10, 1, 37, 1278, 732, StartPage$) AddKeyboardShortcut(0, #PB_Shortcut_Return, 0) JavaScriptErrorMessages(10,1) ; Turn off Java Script Error Messages ; Use bindevent() to have a realtime window resize BindEvent(#PB_Event_SizeWindow, @ResizeWebWindow()) ResizeWebWindow() ; Adjust the gadget to the current window size Repeat Event = WaitWindowEvent() Select Event Case #PB_Event_Gadget Select EventGadget() Case 1 JavaScriptErrorMessages(10,#False) SetGadgetState(10, #PB_Web_Refresh) Case 2 SetGadgetState(10, #PB_Web_Back) Case 3 SetGadgetState(10, #PB_Web_Stop) Case 5 JavaScriptErrorMessages(10,#True) SetGadgetText(10, GetGadgetText(4)) EndSelect Case #PB_Event_Menu ; We only have one shortcut JavaScriptErrorMessages(10,#True) SetGadgetText(10, GetGadgetText(4)) EndSelect Until Event = #PB_Event_CloseWindow EndIf ; IDE Options = PureBasic 5.73 LTS (Windows - x64) ; CursorPosition = 12 ; FirstLine = 1 ; Folding = - ; EnableXP ; Executable = ..\tools\minibrowser.exe ; CompileSourceDirectory