Thread Rating:
  • 0 Vote(s) - 0 Average
  • 1
  • 2
  • 3
  • 4
  • 5
Invoking JavaScript in a SHDocVw.WebBrowser from QM?
#3
If the dialog box is already open - can I make the call to JavaScript?
Code:
Copy      Help
int w1=win("RadFusionRDialog" "#32770")

int c=child("" "Internet Explorer_Server" w1 0x0 "accName=http://emiswd0vm1/RadFusionR/RadFusionRClient.aspx") ;; 'http://localhost:63351/RadF...'

SHDocVw.WebBrowser wb._getcontrol(id(3 w1))
str location = wb.LocationURL
out F"Browser location {location}"

MSHTML.IHTMLDocument2 d=wb.Document
MSHTML.IHTMLWindow2 parentWindow = d.parentWindow

parentWindow.execScript("blah(''BLAH'');" "JavaScript")
,

When I run this I get the following in the console:
Quote:Browser location http://emiswd0vm1/RadFusionR/RadFusionRClient.aspx
Error (RT) in RadFusionSendMsg: Exception 0xC0000005. Access violation. Cannot read memory at 0x144. In MSHTML.dll at 0x62E4C6F1 (0x62E00000+0x4C6F1). ?
From this all I know is that it's finding the window and that it can access the wb.Location (and return the correct value) - but it throws an exception when evaluating "d.parentWindow".

I know that if run this inside context of the dialog that I can make these calls (and that the JavaScript works as expected).

What I want (eventually) is for this window to run hidden and use the calls to JavaScript to use the SignalR protocol for communicating with other peers on the network. I can't do this in C# because SignalR requires .NET 4.0 - but if I use HTML/JavaScript as an intermediary it will work. I want the window to persist and be able to handle callbacks from SignalR (works very well) and I want to be able to send messages in the JavaScript (which would replace the 'blah()' function above).

Thanks!


Messages In This Thread

Forum Jump:


Users browsing this thread: 1 Guest(s)