You can not select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
150 lines
7.4 KiB
150 lines
7.4 KiB
EnableExplicit
|
|
|
|
Global PBEx_WebGadget
|
|
|
|
CompilerIf #PB_Compiler_Processor = #PB_Processor_x86
|
|
PBEx_WebGadget = OpenLibrary(#PB_Any, "PB.Ex_WebGadget_x86.dll")
|
|
CompilerElseIf #PB_Compiler_Processor = #PB_Processor_x64
|
|
PBEx_WebGadget = OpenLibrary(#PB_Any, "PB.Ex_WebGadget_x64.dll")
|
|
CompilerEndIf
|
|
|
|
If PBEx_WebGadget
|
|
Prototype WebGadgetEx(ID, X, Y, Width, Height, URL.p-Unicode, ParentWindowID, ErrorOutput)
|
|
Global WebGadgetEx.WebGadgetEx = GetFunction(PBEx_WebGadget, "WebGadgetEx")
|
|
Prototype SetWebGadgetExText(ID, URL.p-Unicode, ErrorOutput)
|
|
Global SetWebGadgetExText.SetWebGadgetExText = GetFunction(PBEx_WebGadget, "SetWebGadgetExText")
|
|
Prototype GetWebGadgetExText(ID, Output, ErrorOutput)
|
|
Global GetWebGadgetExText.GetWebGadgetExText = GetFunction(PBEx_WebGadget, "GetWebGadgetExText")
|
|
Prototype SetWebGadgetExState(ID, State, ErrorOutput)
|
|
Global SetWebGadgetExState.SetWebGadgetExState = GetFunction(PBEx_WebGadget, "SetWebGadgetExState")
|
|
Prototype SetWebGadgetExItemText(ID, Entry, Text.p-Unicode, ErrorOutput)
|
|
Global SetWebGadgetExItemText.SetWebGadgetExItemText = GetFunction(PBEx_WebGadget, "SetWebGadgetExItemText")
|
|
Prototype GetWebGadgetExItemText(ID, Entry, Output, ErrorOutput)
|
|
Global GetWebGadgetExItemText.GetWebGadgetExItemText = GetFunction(PBEx_WebGadget, "GetWebGadgetExItemText")
|
|
Prototype FreeWebGadgetEx(ID, ErrorOutput)
|
|
Global FreeWebGadgetEx.FreeWebGadgetEx = GetFunction(PBEx_WebGadget, "FreeWebGadgetEx")
|
|
Prototype IsWebGadgetEx(ID, ErrorOutput)
|
|
Global IsWebGadgetEx.IsWebGadgetEx = GetFunction(PBEx_WebGadget, "IsWebGadgetEx")
|
|
Prototype WebGadgetExWidth(ID, ErrorOutput)
|
|
Global WebGadgetExWidth.WebGadgetExWidth = GetFunction(PBEx_WebGadget, "WebGadgetExWidth")
|
|
Prototype WebGadgetExHeight(ID, ErrorOutput)
|
|
Global WebGadgetExHeight.WebGadgetExHeight = GetFunction(PBEx_WebGadget, "WebGadgetExHeight")
|
|
Prototype WebGadgetExX(ID, ErrorOutput)
|
|
Global WebGadgetExX.WebGadgetExX = GetFunction(PBEx_WebGadget, "WebGadgetExX")
|
|
Prototype WebGadgetExY(ID, ErrorOutput)
|
|
Global WebGadgetExY.WebGadgetExY = GetFunction(PBEx_WebGadget, "WebGadgetExY")
|
|
Prototype WebGadgetExID(ID, ErrorOutput)
|
|
Global WebGadgetExID.WebGadgetExID = GetFunction(PBEx_WebGadget, "WebGadgetExID")
|
|
Prototype HideWebGadgetEx(ID, State, ErrorOutput)
|
|
Global HideWebGadgetEx.HideWebGadgetEx = GetFunction(PBEx_WebGadget, "HideWebGadgetEx")
|
|
Prototype ResizeWebGadgetEx(ID, X, Y, Width, Height, ErrorOutput)
|
|
Global ResizeWebGadgetEx.ResizeWebGadgetEx = GetFunction(PBEx_WebGadget, "ResizeWebGadgetEx")
|
|
Prototype HideWebGadgetExDevTools(ID, State, ErrorOutput)
|
|
Global HideWebGadgetExDevTools.HideWebGadgetExDevTools = GetFunction(PBEx_WebGadget, "HideWebGadgetExDevTools")
|
|
Prototype ExecuteWebGadgetExJavaScript(ID, Code.p-Unicode, Output, ErrorOutput)
|
|
Global ExecuteWebGadgetExJavaScript.ExecuteWebGadgetExJavaScript = GetFunction(PBEx_WebGadget, "ExecuteWebGadgetExJavaScript")
|
|
Prototype BindWebGadgetExJavaScript(ID, PBProcedureName.p-Unicode, PBProcedureHandle, PID, ErrorOutput)
|
|
Global BindWebGadgetExJavaScript.BindWebGadgetExJavaScript = GetFunction(PBEx_WebGadget, "BindWebGadgetExJavaScript")
|
|
Prototype GetWebGadgetExAttribute(ID, Attribute, ErrorOutput)
|
|
Global GetWebGadgetExAttribute.GetWebGadgetExAttribute = GetFunction(PBEx_WebGadget, "GetWebGadgetExAttribute")
|
|
Prototype EnableRemoteDebugger(Port, ErrorOutput)
|
|
Global EnableRemoteDebugger.EnableRemoteDebugger = GetFunction(PBEx_WebGadget, "EnableRemoteDebugger")
|
|
|
|
EndIf
|
|
|
|
Define Output$ = Space(1000000)
|
|
Define ErrorOutput$ = ""
|
|
Define IsDevTools = #True
|
|
|
|
Procedure MyJSCallback(aaa)
|
|
Debug "This procedure was executed from Javascript: " + PeekS(aaa)
|
|
EndProcedure
|
|
|
|
If OpenWindow(0, 0, 0, 1100, 768, "Window", #PB_Window_SystemMenu | #PB_Window_ScreenCentered)
|
|
WebGadgetEx(1, 0, 20, 1100, 748, "http://www.rsbasic.de", WindowID(0), @ErrorOutput$)
|
|
ButtonGadget(2, 0, 0, 50, 20, "Back", 0)
|
|
ButtonGadget(3, 50, 0, 50, 20, "Forward", 0)
|
|
ButtonGadget(4, 100, 0, 50, 20, "Reload", 0)
|
|
ButtonGadget(5, 150, 0, 50, 20, "Stop", 0)
|
|
ButtonGadget(6, 200, 0, 50, 20, "Google", 0)
|
|
ButtonGadget(7, 250, 0, 70, 20, "Own HTML", 0)
|
|
ButtonGadget(8, 320, 0, 70, 20, "Get HTML", 0)
|
|
ButtonGadget(10, 390, 0, 70, 20, "Get URL", 0)
|
|
ButtonGadget(11, 460, 0, 100, 20, "Get size && position", 0)
|
|
ButtonGadget(12, 560, 0, 50, 20, "Get ID", 0)
|
|
ButtonGadget(13, 610, 0, 50, 20, "Hide", 0)
|
|
ButtonGadget(14, 660, 0, 50, 20, "Show", 0)
|
|
ButtonGadget(15, 710, 0, 50, 20, "Size", 0)
|
|
ButtonGadget(16, 760, 0, 100, 20, "Show/Hide DevT.", 0)
|
|
ButtonGadget(17, 860, 0, 70, 20, "Execute JS", 0)
|
|
ButtonGadget(18, 930, 0, 50, 20, "BindProc", 0)
|
|
ButtonGadget(19, 980, 0, 50, 20, "CallProc", 0)
|
|
ButtonGadget(20, 1030, 0, 50, 20, "IsBusy?", 0)
|
|
|
|
Repeat
|
|
Select WaitWindowEvent()
|
|
Case #PB_Event_Gadget
|
|
Select EventGadget()
|
|
Case 2
|
|
SetWebGadgetExState(1, #PB_Web_Back, @ErrorOutput$)
|
|
Case 3
|
|
SetWebGadgetExState(1, #PB_Web_Forward, @ErrorOutput$)
|
|
Case 4
|
|
SetWebGadgetExState(1, #PB_Web_Refresh, @ErrorOutput$)
|
|
Case 5
|
|
SetWebGadgetExState(1, #PB_Web_Stop, @ErrorOutput$)
|
|
Case 6
|
|
SetWebGadgetExText(1, "http://www.google.de", @ErrorOutput$)
|
|
Case 7
|
|
SetWebGadgetExItemText(1, #PB_Web_HtmlCode, "<html><head></head><body><h1>Hello PureBasic Friends!</h1></body></html>", @ErrorOutput$)
|
|
Case 8
|
|
GetWebGadgetExItemText(1, #PB_Web_HtmlCode, @Output$, @ErrorOutput$)
|
|
Debug Output$
|
|
Case 10
|
|
GetWebGadgetExText(1, @Output$, @ErrorOutput$)
|
|
Debug Output$
|
|
Case 11
|
|
Debug WebGadgetExWidth(1, @ErrorOutput$)
|
|
Debug WebGadgetExHeight(1, @ErrorOutput$)
|
|
Debug WebGadgetExX(1, @ErrorOutput$)
|
|
Debug WebGadgetExY(1, @ErrorOutput$)
|
|
Case 12
|
|
Debug WebGadgetExID(1, @ErrorOutput$)
|
|
Case 13
|
|
HideWebGadgetEx(1, 1, @ErrorOutput$)
|
|
Case 14
|
|
HideWebGadgetEx(1, 0, @ErrorOutput$)
|
|
Case 15
|
|
ResizeWebGadgetEx(1, 100, 50, 200, 400, @ErrorOutput$)
|
|
Case 16
|
|
IsDevTools ! #True
|
|
HideWebGadgetExDevTools(1, IsDevTools, @ErrorOutput$)
|
|
Case 17
|
|
ExecuteWebGadgetExJavaScript(1, "document.body.style.backgroundColor = " + Chr(34) + "#ff0000" + Chr(34), @Output$, @ErrorOutput$)
|
|
ExecuteWebGadgetExJavaScript(1, "document.body.offsetHeight;", @Output$, @ErrorOutput$)
|
|
Debug Output$
|
|
;If you want to run modal dialogs like Alert(), please set the parameter "Output" to 0.
|
|
ExecuteWebGadgetExJavaScript(1, "alert('Hello');", 0, @ErrorOutput$)
|
|
Case 18
|
|
BindWebGadgetExJavaScript(1, "MyJSCallback", @MyJSCallback(), GetCurrentProcessId_(), @ErrorOutput$)
|
|
Case 19
|
|
ExecuteWebGadgetExJavaScript(1, "(async function() { await CefSharp.BindObjectAsync('PBProcedure'); PBProcedure.call('MyJSCallback', 'Hello PureBasic'); })();", @Output$, @ErrorOutput$)
|
|
Case 20
|
|
Debug GetWebGadgetExAttribute(1, #PB_Web_Busy, @ErrorOutput$)
|
|
EndSelect
|
|
Case #PB_Event_CloseWindow
|
|
CloseLibrary(PBEx_WebGadget)
|
|
End
|
|
EndSelect
|
|
ForEver
|
|
EndIf
|
|
; IDE Options = PureBasic 5.60 (Windows - x64)
|
|
; CursorPosition = 97
|
|
; FirstLine = 80
|
|
; Folding = -
|
|
; EnableXP
|
|
; EnableUser
|
|
; Executable = PB.Ex_MSSQL.exe
|
|
; CompileSourceDirectory
|
|
; EnableCompileCount = 417
|
|
; EnableBuildCount = 7
|