Strange behaviour of IE Webgadget

Windows specific forum
AchimVL
New User
New User
Posts: 4
Joined: Tue Jun 23, 2015 1:03 pm

Strange behaviour of IE Webgadget

Post by AchimVL »

I open a webpage in an IE-webgadget and click a link. Works well, but however whenever this link is something which opens a phone application (<a href="sip:12345">) it starts the application, everything works correct, but it (the IE-gadget) seems to wait for a response, an answer, what phone-application doesn't give. Meanwhile the whole program is blocked, frozen to ice.
IE, started normaly, out off a webgadget, doesn't show this behaviour.

Now it starts to become very strange, 'cause:
One time I write this code:


OpenWindow(0, 100, 100, 680, 520, "My Program", #PB_Window_MaximizeGadget | #PB_Window_MinimizeGadget)
WebGadget(5, 290, 30, 370, 460, "http://www.mywebpage.tld/sip/whitepages.html") ; WebPage with phone links
Quit = 0

Repeat
WEvent = WindowEvent()
Select WEvent
Case #PB_Event_CloseWindow
Quit = 1

EndSelect
Delay(20)
Until Quit = 1
End


it doesn't show this behaviour, the other time, in another codeblock it shows. Now you can imagine, there is an error in the other code, but it isn't. Even, if I delete the other code, error remains.
I even can't recognize any relationship or difference to UNICODE or ASCII compiling of code, too. I tried everything possible, I can't see any fact for explination of this phenomen.

Now, my questions:
1) Does anyone knows, how to tell the IE within this gadget to stop this?
2) Who can suggest, what reason can be?

Thx,

Achim
--------------------------
PureBasic 5.31 x86 / AMD Athlon 64 X2 2,3 GHz, 2GByte / Win Vista SPack 2 / 32-Bit
juror
Enthusiast
Enthusiast
Posts: 232
Joined: Mon Jul 09, 2007 4:47 pm
Location: Courthouse

Re: Strange behaviour of IE Webgadget

Post by juror »

WebGadgets can be tricky to employ correctly, but without some code which demonstrates a problem/issue, most of us are merely guessing as to what might be going on.
AchimVL
New User
New User
Posts: 4
Joined: Tue Jun 23, 2015 1:03 pm

Re: Strange behaviour of IE Webgadget

Post by AchimVL »

??? - I posted code!
This is it:


OpenWindow(0, 100, 100, 680, 520, "My Program", #PB_Window_MaximizeGadget | #PB_Window_MinimizeGadget)
WebGadget(5, 290, 30, 370, 460, "http://www.mywebpage.tld/sip/whitepages.html") ; WebPage with phone links
Quit = 0

Repeat
WEvent = WindowEvent()
Select WEvent
Case #PB_Event_CloseWindow
Quit = 1

EndSelect
Delay(20)
Until Quit = 1
End


And once again: I write it, it works. I write it another time - it doesn't (100% the same code). I copy first one to a new, empty project, it doesn't work.
I played with compiler mode (Unicode - not Unicode), standalone-exe pp.
This strange behaviour remains ...! I don't see any cause and can't recognize a relationship between what I do (program) and reaction of webgadget.


Achim
AchimVL
New User
New User
Posts: 4
Joined: Tue Jun 23, 2015 1:03 pm

Re: Strange behaviour of IE Webgadget

Post by AchimVL »

By the side:
It doesn't make any troubles, if I send webgadget the command directly via "SetGadgetText":

PhoneNumber$ = "0049302270"
OpenWindow(0, 100, 100, 680, 520, "My Program", #PB_Window_MaximizeGadget | #PB_Window_MinimizeGadget)
WebGadget(5, 290, 30, 370, 460, "http://www.mywebpage.tld/sip/whitepages.html") ; WebPage with phone links
Quit = 0

Repeat
WEvent = WindowEvent()
Select WEvent
Case #PB_Event_CloseWindow
Quit = 1


Case #PB_Event_Gadget
Select EventGadget()
case 5
SetGadgetText(5, "sip:"+PhoneNumber$)
EndSelect



EndSelect

Delay(20)
Until Quit = 1
End



But at all, even IE itself doesn't work satisfactorily, IE-WebGadget-combination seems to be a disaster ... :(
Isn't there any posibility at all to combine this Gadget with another rendering-engine or in another way, that works more better?


Achim
Julian
Enthusiast
Enthusiast
Posts: 276
Joined: Tue May 24, 2011 1:36 pm

Re: Strange behaviour of IE Webgadget

Post by Julian »

It sounds like its an issue with your SIP software plugin.

Are you able to execute the "make a call" portion of your SIP software from command line? ie. call.exe 123456 ?

If so, you could use the following to intercept the navigation to your own web based SIP plugin and start the call yourself. This is an example using a similar method from Skype.

Code: Select all

Procedure NavigationCallback(Gadget, Url$) 
  Debug Url$
    If Left(Url$,5)= "skype" 
      ;MessageRequester("", "Open SIP exe and cancel Skype call")
      RunProgram("skype.exe","cut up Url$ and place the number here")
      ProcedureReturn #False ; this will cancel the regular nav so the SIP plugin wont start up
    Else 
      ProcedureReturn #True 
    EndIf 
  EndProcedure 
  
  If OpenWindow(0, 0, 0, 600, 300, "WebGadget", #PB_Window_SystemMenu | #PB_Window_ScreenCentered) 
    WebGadget(0, 10, 10, 580, 280, "example.htm") 
    SetGadgetAttribute(0, #PB_Web_NavigationCallback, @NavigationCallback())
    Repeat 
    Until WaitWindowEvent() = #PB_Event_CloseWindow 
  EndIf
example.htm

Code: Select all

<a href="skype:TestMcTesterton?call">CALL ME</a>
AchimVL
New User
New User
Posts: 4
Joined: Tue Jun 23, 2015 1:03 pm

Re: Strange behaviour of IE Webgadget

Post by AchimVL »

Hi Julian,

sometime I can't see the forest because of all the trees. Yes, it's a good idea to solve problem in this way. Works good and offers even other possibilities. Now I can even insert a control if so called premium numbers are dialed! :wink:

By the way, correct parameters for X-Lite are:
PhoneApplication$ = "C:\Program Files\CounterPath\X-Lite\x-lite.exe"
RunProgram(PhoneApplication$,"-dial=sip:"+PhoneNumber$,"")

So it looks like this:
Procedure NavigationCallback(gad, Url$)
If Left(Url$,4)= "sip:" or Left(Url$,4)= "tel:"
PhoneNumber$ = Trim(Trim(Trim(Mid(Url$,5)),"("),")")
; Trim() - normally it's obsolet, but you never can know why it's good placed here ...
Ergebnis = RunProgram(PhoneApplication$,
"-dial=sip:"+PhoneNumber$,"")
ProcedureReturn #False
Else
ProcedureReturn #True
EndIf
EndProcedure



Cause of this problem is: IE stops and waits for response of phone-application (what this never will give). IE pulls down whole application when it is busy or blocked. But this behaviour IE offers only within WebGadget, as I could monitor. So, original there must be a way to depress this. Very annoying becomes this circumstance when you've loaded a page with a great content. You can't control page view by scrollbars anymore. Not in an acceptable way. It seems that IE has to run encapsualted in an own environment, like a thread. But this I couldn't work out until yet with pb tools, only. So I'll hold out for an inspiration ... :)

And once again: Thanks Julian!


Achim
Julian
Enthusiast
Enthusiast
Posts: 276
Joined: Tue May 24, 2011 1:36 pm

Re: Strange behaviour of IE Webgadget

Post by Julian »

According the help files, "WebGadget uses the Internet Explorer 4.0+ ActiveX object on Windows", I doubt that x-lite tests on IE4 so it could be one of a whole host of issues.

I'm glad you have got something working to get around the problem.
Post Reply