Hi Gokul
Yes, sorry for missing those out. I have included mine below. They are
different in some places. It won't make any difference to you at this stage,
but I would suggest changing them because it will make a difference if you
use the IOLECommandTarget interface in future. In particular, the 'longs'
translate to integers in .NET.
<code>
' OLECMD
<StructLayout(LayoutKind.Sequential)> _
Public Structure OLECMD
Public cmdID As Int32
Public cmdf As Int32
End Structure
' OLECMDTEXT
<StructLayout(LayoutKind.Sequential, CharSet:=CharSet.Unicode)> _
Public Class OLECMDTEXT
Public cmdtextf As OLECMDTEXTF
Public cwActual As Int32
Private cwBuf As Int32 = 256 'Make sure this is the same as SizeConst
below
<MarshalAs(UnmanagedType.ByValTStr, SizeConst:=256)> _
Public text As String
End Class
' IOleCommandTarget interface
<ComImport(), Guid("b722bccb-4e68-101b-a2bc-00aa00404770"), _
InterfaceType(ComInterfaceType.InterfaceIsIUnknown)> _
Public Interface IOleCommandTarget
Sub QueryStatus(ByRef pguidCmdGroup As Guid, ByVal cCmds As Int32, _
<InAttribute(), Out(), MarshalAs(UnmanagedType.LPArray,
SizeParamIndex:=1)> ByVal prgCmds() As OLECMD, <InAttribute(), Out()> ByVal
pCmdText As OLECMDTEXT)
Sub Exec(ByRef pguidCmdGroup As Guid, ByVal nCmdId As Int32, _
ByVal nCmdExecOpt As Int32, ByVal pvaIn As OLEVARIANT, ByVal pvaOut
As OLEVARIANT)
End Interface
</code>
Also, I would recommend putting a wait after every navigate. I call a
function WaitReady(), below
<code>
Private Sub WaitReady()
Do Until AxWebBrowser1.ReadyState =
SHDocVw.tagREADYSTATE.READYSTATE_COMPLETE
Application.DoEvents()
Loop
End Sub
</code>
You could probably dispense with the second navigate then.
The reason for the wait is that pages are loaded asynchronously. Therefore,
the first navigate returns immediately, even before the page has been
initialised. The second navigate then causes the first one to be cancelled,
and the second page gets loaded.
As a general rule, before doing anything else, always navigate to
about:blank and wait for complete. This ensures that the control is always
fully initialised before you proceed.
HTH
Charles
[quoted text, click to view] "gokul" <gokulrajad@yahoo.com> wrote in message
news:c1f374f7.0308072048.3d1d9f23@posting.google.com...
> The tweaks are:
>
> 1.
> These Interface(IOleCommandTarget) were missing and it gave an error
> during Compilation, so I added this code:
> <code>
> <StructLayout(LayoutKind.Sequential)> _
> Public Structure OLECMDTEXT
> Public cmdtextf As UInt32
> Public cwActual As UInt32
> Public cwBuf As UInt32
> Public rgwz As Char
> End Structure
>
> <StructLayout(LayoutKind.Sequential)> _
> Public Structure OLECMD
> Public cmdID As Long
> Public cmdf As UInt64
> End Structure
>
> ' Interop definition for IOleCommandTarget.
> <ComImport(), Guid("b722bccb-4e68-101b-a2bc-00aa00404770"), _
> InterfaceType(ComInterfaceType.InterfaceIsIUnknown)> _
> Public Interface IOleCommandTarget
> Sub QueryStatus(ByRef pguidCmdGroup As Guid, ByVal cCmds As
> UInt32, _
> <MarshalAs(UnmanagedType.LPArray, SizeParamIndex:=1)> ByVal
> prgCmds As OLECMD, _
> ByRef pCmdText As OLECMDTEXT)
>
> Sub Exec(ByRef pguidCmdGroup As Guid, ByVal nCmdId As Long, _
> ByVal nCmdExecOpt As Long, ByRef pvaIn As Object, _
> ByRef pvaOut As Object)
> End Interface
> </code>
>
> 2. During the first time the Noborder or FlatScroll.....none of the
> setting were taking place only we load it again it got
> implemented...so just triggered as follows:
> AxWebBrowser1.Navigate("about:blank")
> AxWebBrowser1.Navigate("http://www.google.com")
>
> So this tweak allowed to achieve the desired effect on the Control
> during load itself...........
> It works pretty fine now......
> Regards
> Gokul Raja.D