; ; ------------------------------------------------------------ ; ; 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... ;LASTTIME 0,999 (less than 111) ; 0 indicates this program has ended ; 111 less than 111 notifies this program to update help ; 666 set to 666 to notify program to exit ; 999 indicates this program has completed updates ;LASTHELP is the context help to display on next update (#TOP) example ;when sending a message to this app, change LASTTIME last, to trigger the app. ;HANDLE is the handle to the window Global RunPath.s=GetPathPart(ProgramFilename()) Global IniFile.s=RunPath+"HelperApp.ini" OpenPreferences(IniFile) Global HelpFile.s=ReadPreferenceString("HelpFile","NoHelp") If HelpFile="NoHelp" MessageRequester("HelperApp","No Helpfile specified",#MB_ICONSTOP) End EndIf HelpFile="file:///"+RunPath+HelpFile Global Caption.s=ReadPreferenceString("Title","Helper App") PP.s=ReadPreferenceString( "LASTHELP", PP) 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 If OpenWindow(0, 100, 200, 500, 300, Caption, #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, Caption+" 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 WritePreferenceString("LASTTIME", "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() WritePreferenceString( "HANDLE", Str(WindowID(0))) ClosePreferences() 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="Modified 17 October 2010"+Chr(10) msg=msg+"by Norman E. Perry"+Chr(10) msg=msg+"based on RTS Maker Help" MessageRequester(Caption,msg) Case 4 CloseWindow(0) Break Case 5 SetGadgetText(10, GetGadgetText(4)) EndSelect Case #PB_Event_SizeWindow ResizeWebWindow() EndSelect OpenPreferences(IniFile) PT.s=ReadPreferenceString( "LASTTIME", "0") If Val(PT)<111 WritePreferenceString( "LASTTIME", "999") PP=ReadPreferenceString( "LASTHELP", PP) SetGadgetText(10,HelpFile+PP) StatusBarText(0, 0, "LASTHELP "+PP, 0) ElseIf Val(PT)=666 Break 1 EndIf ClosePreferences() Until Event = #PB_Event_CloseWindow EndIf WritePreferenceString( "LASTTIME", "000") WritePreferenceString( "LASTHELP", "") WritePreferenceString( "HANDLE", "0") ClosePreferences() End