; ; ------------------------------------------------------------ ; ; PureBasic - MiniBrowser ; ; (c) 2003 - Fantaisie Software ; ; ------------------------------------------------------------ ; ; This program requiers the Microsoft freely distribuable ; ATL.dll shared library. ; ;modified for my help system ;instead of loading a web page, this loads the help system from memory ;and directly loads into the browser ;we monitor ini variables to keep current with other apps ;these are the Vars... ;LASTRTSTIME 0,2,999 (less than 111) ; 0 indicates this program has ended ; 2 notifies this program to use a custom help file ; 111 less than 111 notifies this program to update help ; 999 indicates this program has completed updates ;LASTRTSHELP is the context help to display on next update (#TOP) example ;LOADRTSHELP is the custome help file (*.html) to use for help ;when sending a message to this app, change LASTRTSTIME last, to trigger the app. ;HANDLE is the handle to the window IncludeFile "MyINI.pbi" Global RunPath.s=GetPathPart(ProgramFilename()) Global HelpFile.s="file:///"+RunPath+"RTSMaker.html" IniFile.s=RunPath+"RTSHelp.ini" PT.s=INI_ReadString( "Helper", "LASTRTSTIME", "50") If Val(PT)=2 ;INI_WriteString( "Helper", "LASTRTSTIME", "999") HelpFile=INI_ReadString( "Helper", "LOADRTSHELP",HelpFile) EndIf Procedure ResizeWebWindow() ResizeGadget(10, #PB_Ignore, #PB_Ignore, WindowWidth(0), WindowHeight(0)-52-MenuHeight()) ResizeGadget(4, #PB_Ignore, #PB_Ignore, WindowWidth(0)-185, #PB_Ignore) ResizeGadget(5, WindowWidth(0)-25, #PB_Ignore, #PB_Ignore, #PB_Ignore) ResizeGadget(6, #PB_Ignore, #PB_Ignore, WindowWidth(0), #PB_Ignore) EndProcedure PP.s=ProgramParameter() ;PP.s="#texture" If OpenWindow(0, 100, 200, 500, 300, "RTS Maker Help", #PB_Window_MinimizeGadget | #PB_Window_MaximizeGadget | #PB_Window_SizeGadget) If CreateMenu(0, WindowID(0)) MenuTitle("Help") MenuItem(0, "Contents") MenuItem(1, "Contact") MenuItem(2, "www.archonrpg.com") MenuItem(3, "About") MenuItem(4, "Exit") EndIf CreateStatusBar(0, WindowID(0)) StatusBarText(0, 0, "Real Time Strategy Maker Help", 0) CreateGadgetList(WindowID(0)) ButtonGadget(1, 0, 0, 50, 25, "Back") ButtonGadget(2, 50, 0, 50, 25, "Next") ButtonGadget(3, 100, 0, 50, 25, "Stop") StringGadget(4, 155, 5, 0, 20, "") ButtonGadget(5, 0, 0, 25, 25, "Go") Frame3DGadget(6, 0, 30, 0, 2, "", 2) ; Nice little separator If PP ;INI_WriteString( "Helper", "LASTRTSHELP", PP) If WebGadget(10, 0, 31, 0, 0, HelpFile+PP) = 0 : MessageRequester("Error", "ATL.dll not found", 0) : End : EndIf Else If WebGadget(10, 0, 31, 0, 0, HelpFile) = 0 : MessageRequester("Error", "ATL.dll not found", 0) : End : EndIf EndIf ;SetEnvironmentVariable("LASTRTSTIME", "999") INI_WriteString( "Helper", "LASTRTSTIME", "999") SetGadgetAttribute(10,#PB_Web_BlockPopups,#True) SetGadgetAttribute(10,#PB_Web_BlockPopupMenu,#True) StatusBarText(0, 0, "Loading Help "+GetFilePart(HelpFile), 0) AddKeyboardShortcut(0, #PB_Shortcut_Return, 5) ResizeWebWindow() INI_WriteString( "Helper", "HANDLE", Str(WindowID(0))) Repeat Event = WaitWindowEvent(1000) Select Event Case #PB_Event_Gadget Select EventGadget() Case 1 SetGadgetState(10, #PB_Web_Back) Case 2 SetGadgetState(10, #PB_Web_Forward) Case 3 SetGadgetState(10, #PB_Web_Stop) Case 5 SetGadgetText(10, GetGadgetText(4)) EndSelect Case #PB_Event_Menu ; We only have one shortcut Select EventMenu() Case 0 SetGadgetText(10,HelpFile+"#TOP") Case 1 SetGadgetText(10,HelpFile+"#contact") Case 2 SetGadgetText(10,"www.archonrpg.com") Case 3 msg.s="Created 17 May 2010 for RTS Maker"+Chr(10) msg=msg+"by Norman E. Perry" MessageRequester("RTS Maker Help",msg) Case 4 CloseWindow(0) Break Case 5 SetGadgetText(10, GetGadgetText(4)) EndSelect Case #PB_Event_SizeWindow ResizeWebWindow() EndSelect PT=INI_ReadString( "Helper", "LASTRTSTIME", "0") If Val(PT)<111 INI_WriteString( "Helper", "LASTRTSTIME", "999") PP=INI_ReadString( "Helper", "LASTRTSHELP", PP) SetGadgetText(10,HelpFile+PP) StatusBarText(0, 0, "LASTRTSHELP "+PP, 0) EndIf Until Event = #PB_Event_CloseWindow EndIf INI_WriteString( "Helper", "LASTRTSTIME", "000") INI_WriteString( "Helper", "HANDLE", "0") End