Theos PowerBasic Museum 2017

Archive => Discussion - Legacy Software (PBWIN 9.0+/PBCC 5.0+) => Topic started by: Edwin Knoppert on January 24, 2009, 11:53:50 AM

Title: ShellDWebBrowserEvents2_BeforeNavigate2 and statics
Post by: Edwin Knoppert on January 24, 2009, 11:53:50 AM
I have a TLB version which uses static variables like:


Sub ShellDWebBrowserEvents2_BeforeNavigate2 (ByVal pCookie As Dword Ptr, ByRef pdispparams As DispParams)

'   ======================================================================================
'   Pointer variables to access the parameters
'   ======================================================================================
    Local pv As Variant Ptr : pv = pdispparams.VariantArgs
    Local pvapi As VariantApi Ptr : pvapi = pv
'   ======================================================================================

'   ======================================================================================
'   Parameters in DISPPARAMS are zero based and in reverse order
'   ======================================================================================
'   *** pDisp - VarType: %VT_DISPATCH <IDISPATCH> - Attributes: &H1 -  [in] ***
    Local pDisp AS Dword : pDisp = Variant#(@pv[6])
'   ======================================================================================
'   *** URL - VarType: VT_PTR - Resolved VarType: *%VT_VARIANT <VARIANT> - Attributes: &H1 -  [in] ***
    Static URL As Variant : URL = @pv[5]
'   To return a value, use: URL = <value> : @pvapi[5].vd.@pVariant = VarPtr(URL)
'   ======================================================================================
'   *** Flags - VarType: VT_PTR - Resolved VarType: *%VT_VARIANT <VARIANT> - Attributes: &H1 -  [in] ***
    Static Flags As Variant : Flags = @pv[4]
'   To return a value, use: Flags = <value> : @pvapi[4].vd.@pVariant = VarPtr(Flags)
'   ======================================================================================
'   *** TargetFrameName - VarType: VT_PTR - Resolved VarType: *%VT_VARIANT <VARIANT> - Attributes: &H1 -  [in] ***
    Static TargetFrameName As Variant : TargetFrameName = @pv[3]
'   To return a value, use: TargetFrameName = <value> : @pvapi[3].vd.@pVariant = VarPtr(TargetFrameName)
'   ======================================================================================
'   *** PostData - VarType: VT_PTR - Resolved VarType: *%VT_VARIANT <VARIANT> - Attributes: &H1 -  [in] ***
    Static PostData As Variant : PostData = @pv[2]
'   To return a value, use: PostData = <value> : @pvapi[2].vd.@pVariant = VarPtr(PostData)
'   ======================================================================================
'   *** Headers - VarType: VT_PTR - Resolved VarType: *%VT_VARIANT <VARIANT> - Attributes: &H1 -  [in] ***
    Static Headers As Variant : Headers = @pv[1]
'   To return a value, use: Headers = <value> : @pvapi[1].vd.@pVariant = VarPtr(Headers)
'   ======================================================================================
'   *** Cancel - VarType: VT_PTR - Resolved VarType: *%VT_BOOL <INTEGER> - Attributes: &H3 -  [in] [out] ***
    Local prmCancel AS Integer : prmCancel = Variant#(@pv[0])
'   To return a value, use: prmCancel = <value> : @pvapi[0].vd.@pboolVal = prmCancel
'   ======================================================================================


End Sub


Not sure if this call is execute in a thread, maybe not but i have two controls pointing to the same event handler.
Not sure if this conflicts.


Title: Re: ShellDWebBrowserEvents2_BeforeNavigate2 and statics
Post by: José Roca on January 24, 2009, 01:51:24 PM
 
I have no idea if the WebBrowser control uses threads or not. If in doubt, you can use use one copy of the class for each control or use the new PB event classes.
Title: Re: ShellDWebBrowserEvents2_BeforeNavigate2 and statics
Post by: Edwin Knoppert on January 24, 2009, 02:07:46 PM
Yes, but potentially i may go wrong (as always with statics).
I can imagne an IFrame with src='' will also call the event.

(The new pb event stuff may help but i have no way to implement these right now)