Sorry for double posting but I thnik it is important enough for this
WebGadget: Directly insert code and catch link clicks.
Does anyone in this thread know an answer for viewtopic.php?t=17700
Sorry for double posting but I thnik it is important enough for this
Sorry for double posting but I thnik it is important enough for this
Visit www.sceneproject.org
-
garretthylltun
- Enthusiast

- Posts: 346
- Joined: Wed Oct 26, 2005 2:46 am
- Contact:
I'm going to assume that this is MS Windows only since it's using DCOM,
right?
-Garrett
right?
-Garrett
'What you do not want done to yourself, do not do to others.' - Confucius (550 b.c. to 479 b.c.)
· Necroprogramming FTW! - "Wait.. Is necroprogramming legal?"
· http://www.freewarehome.com/ <-- Freeware listings since 1996
· Necroprogramming FTW! - "Wait.. Is necroprogramming legal?"
· http://www.freewarehome.com/ <-- Freeware listings since 1996
-
lexvictory
- Addict

- Posts: 1027
- Joined: Sun May 15, 2005 5:15 am
- Location: Australia
- Contact:
-
lexvictory
- Addict

- Posts: 1027
- Joined: Sun May 15, 2005 5:15 am
- Location: Australia
- Contact:
Can these interfaces (IHTML_xxxx) be updated natively in PB4.0 ?
As we can see in the WebGadgetExtras.pb there's a lot of thing to update...
Not urgent but i would be nice.
As we can see in the WebGadgetExtras.pb there's a lot of thing to update...
Not urgent but i would be nice.
No programming language is perfect. There is not even a single best language.
There are only languages well suited or perhaps poorly suited for particular purposes. Herbert Mayer
There are only languages well suited or perhaps poorly suited for particular purposes. Herbert Mayer
How can get all source code (include HEAD)
All Soucecode to File save with C
How do it become it if it translates into PureBasic?
Code: Select all
IHTMLDocument2 *HTMLDocument = NULL;
WCHAR wszShortcutFile[512];
LPDISPATCH lpdisp;
lpdisp = m_web0.GetDocument();
HTMLDocument = (IHTMLDocument2 *)lpdisp;
HRESULT hr4 = HTMLDocument->QueryInterface(IID_IPersistFile,(void **)&PersistFile);
MultiByteToWideChar(CP_ACP, 0, "C:\\test.html", -1,
wszShortcutFile, 512);
PersistFile->Save(wszShortcutFile,TRUE);
How do it become it if it translates into PureBasic?
Code: Select all
DataSection
IID_IPersistFile:
; 0000010b-0000-0000-C000-000000000046
Data.l $0000010B
Data.w $0000,$0000
Data.b $C0,$00,$00,$00,$00,$00,$00,$46
EndDataSection
Procedure WebGadget_Read(Gadget, tempfile.s)
Shared WebGadget_Document.IHTMLDocument2_FIXED
result = 0
If GetGadgetText(Gadget) = ""
SetGadgetText(Gadget, "about:blank")
EndIf
memoryurl.s=GetGadgetText(Gadget)
WebGadget_Document = 0
Browser.IWebBrowser2 = GetWindowLong_(GadgetID(Gadget), #GWL_USERDATA)
If Browser
If Browser\get_document(@DocumentDispatch.IDispatch) = #S_OK
If DocumentDispatch\QueryInterface(?IID_IPersistFile, @PersistFile.IPersistFile) = #S_OK
mem.s = Space(1000)
MultiByteToWideChar_(#CP_ACP, 0, tempfile, -1, mem, 1000)
hres = PersistFile\SAVE(@mem,#True)
result = 1
EndIf
DocumentDispatch\Release()
EndIf
Browser\Release()
EndIf
SetGadgetText(Gadget, memoryurl)
ProcedureReturn result
EndProcedure
Does anybody know how to handel JavaScript-Links ?
This is my try :
edit :
The 4. way
do not work also.
What i wont is to interact whith Javascript. A Form is only one Case for this.
This is my try :
Code: Select all
XIncludeFile "WebGadgetExtras.pb"
#WebGadget = 0
Procedure LinkCallback(Gadget, Link$, Text$, ID$, Class$)
Debug "Gadget: "+Str(Gadget)
Debug "Link: "+Link$
Debug "Text: "+Text$
Debug ""
ProcedureReturn 0 ; prevent link from executing
EndProcedure
If OpenWindow(0, 0, 0, 800, 600, #PB_Window_SystemMenu|#PB_Window_ScreenCentered, "WebGadget example")
If CreateGadgetList(WindowID())
WebGadget(#WebGadget, 0, 0, 800, 600, "")
If WebGadget_Open(#WebGadget, 0)
WebGadget_Write("<html>")
WebGadget_Write("<head>")
WebGadget_Write("<title>Text des Titels</title>")
WebGadget_Write("<script type='text/javascript'>")
WebGadget_Write("function Go() {")
WebGadget_Write(" var Vorname = document.Formular.Vorname.value;")
WebGadget_Write(" var test1 = '<a href=execute '+Vorname+' id=a123>x123</a>';")
WebGadget_Write(" var test2 = 'execute '+Vorname;")
WebGadget_Write(" this.a123.outerHTML = test1;")
WebGadget_Write(" alert(this.a123.outerHTML);")
; WebGadget_Write(" this.a123.click();")
; WebGadget_Write(" window.location.href = test2;")
WebGadget_Write("}")
WebGadget_Write("</script>")
WebGadget_Write("</head>")
WebGadget_Write("<body>")
WebGadget_Write("<a href='12' id='a123'>123</a><br>")
WebGadget_Write("<a href='456'>456</a><br><br>")
WebGadget_Write("<h1>Das hier können Sie absenden!</h1>")
WebGadget_Write("<form name='Formular' action='javascript:Go()'>")
WebGadget_Write("<table border='0' cellpadding='5' cellspacing='0' bgcolor='#E0E0E0'>")
WebGadget_Write(" <tr>")
WebGadget_Write(" <td align='right'>Vorname:</td>")
WebGadget_Write(" <td><input name='Vorname' type='text' size='30' maxlength='30'></td>")
WebGadget_Write(" </tr><tr>")
WebGadget_Write(" <td align='right'>Zuname:</td>")
WebGadget_Write(" <td><input name='Zuname' type='text' size='30' maxlength='40'></td>")
WebGadget_Write(" </tr><tr>")
WebGadget_Write(" <td align='right' valign='top'>Kommentar:</td>")
WebGadget_Write(" <td><textarea name='Text' rows='10' cols='50'></textarea></td>")
WebGadget_Write(" </tr><tr>")
WebGadget_Write(" <td align='right'>Formular:</td>")
WebGadget_Write(" <td>")
WebGadget_Write(" <input type='submit' value=' Absenden '>")
WebGadget_Write(" <input type='reset' value=' Abbrechen'>")
WebGadget_Write(" </td>")
WebGadget_Write(" </tr>")
WebGadget_Write("</table>")
WebGadget_Write("</form>")
WebGadget_Write("</body>")
WebGadget_Write("</html>")
WebGadget_Close()
EndIf
WebGadget_CatchLinks(#WebGadget, @LinkCallback())
Repeat
Until WaitWindowEvent() = #PB_Event_CloseWindow
EndIf
EndIf
The 4. way
Code: Select all
WebGadget_Write(" this.a123.innerHTML = test2;")
What i wont is to interact whith Javascript. A Form is only one Case for this.
See my post on interacting with JavaScript here:
http://www.purebasic.fr/english/viewtop ... 68&start=0
I plan to put all this code together into a library but right now i just do not have the time.
http://www.purebasic.fr/english/viewtop ... 68&start=0
I plan to put all this code together into a library but right now i just do not have the time.
quidquid Latine dictum sit altum videtur
+1real wrote:Is there anybody out there who converted the WebGadgetExtras.pb to PB 4???
I used it under v3.94 and wanted to take advantage of strings longer than 64KB in v4.0, but I can't compile the WebGadgetExtras.pb anymore.
PB 6.21, SpiderBasic 3.10, PureVision User

