Codejock Forums Homepage
Forum Home Forum Home > Codejock Products > ActiveX COM > Skin Framework
  New Posts New Posts RSS Feed - SOLVED: VB6 WebBrowser Not Skinned
  FAQ FAQ  Forum Search   Events   Register Register  Login Login

SOLVED: VB6 WebBrowser Not Skinned

 Post Reply Post Reply
Author
Message
JasonG View Drop Down
Groupie
Groupie


Joined: 07 July 2008
Status: Offline
Points: 76
Post Options Post Options   Thanks (0) Thanks(0)   Quote JasonG Quote  Post ReplyReply Direct Link To This Post Topic: SOLVED: VB6 WebBrowser Not Skinned
    Posted: 28 July 2008 at 11:08am
I am using the Skinning Framework in a VB6 Application, and all the controls are being skinned properly, but the webbrowser control's vertical (and i assume horizontal, though I am not using it) scrollbar is not getting skinned at all. The colors seem to be getting applied, but the graphical aspect of it is not....


Is this normal? Please advise.

Thanks.



Product: Xtreme SuitePro (ActiveX) 12.0.1
Platform: Windows Vista/XP
Language: Visual Basic 6.0 SP6
Back to Top
Oleg View Drop Down
Admin Group
Admin Group


Joined: 21 May 2003
Location: United States
Status: Offline
Points: 11234
Post Options Post Options   Thanks (0) Thanks(0)   Quote Oleg Quote  Post ReplyReply Direct Link To This Post Posted: 29 July 2008 at 2:12am

Hi,

IE doesn't use standard ScrolllBar but draws it in own code. We can't change it.
Oleg, Support Team
CODEJOCK SOFTWARE SOLUTIONS
Back to Top
JasonG View Drop Down
Groupie
Groupie


Joined: 07 July 2008
Status: Offline
Points: 76
Post Options Post Options   Thanks (0) Thanks(0)   Quote JasonG Quote  Post ReplyReply Direct Link To This Post Posted: 29 July 2008 at 8:42am
Perhaps I can get around that and create my own scrollbar that scrolls the document ... I will post if i come up with a good solution.

Product: Xtreme SuitePro (ActiveX) 12.0.1
Platform: Windows Vista/XP
Language: Visual Basic 6.0 SP6
Back to Top
JasonG View Drop Down
Groupie
Groupie


Joined: 07 July 2008
Status: Offline
Points: 76
Post Options Post Options   Thanks (0) Thanks(0)   Quote JasonG Quote  Post ReplyReply Direct Link To This Post Posted: 29 July 2008 at 10:57am
Ok.. i got it... here is a little code I put in my HTML document... The Javascript Function put the values of the Window Height, and the TotalHeight of the document (actually, the DIV that contains the content) into a hidden field like this:

docHeight|winHeight


function getDocumentHeight()
{
    temp=navigator.appVersion.split('MSIE');
    ieVer=parseInt(temp[1]);
    var t=(ieVer == 6)?document.documentElement.clientHeight:document.body.clientHeight;
    var s = document.getElementById("mainTable").offsetHeight;
    document.getElementById('docHeight').value = s + '|' + t;
}
-->
</script>
</HEAD>
<BODY>
    <div name="mainTable" id="mainTable" class=reg>

        #Body#

        <input type="hidden" name="docHeight" value=0>
        <BR><BR>
    </div>
</BODY>


The, from the VB side... HTML is my webBrowser and sbHTML is the associated scrollbar.

Once your Document is finished loading, call the following code.

Private Sub LoadPage (DocumentHTMLCode as string)
  Dim DOC As IHTMLDocument
  Set DOC = HTML.Document

  DOC.Open "text/html", "replace"
  DOC.Write
DocumentHTMLCode
  DOC.Close
 
  'HIDE WebBrowser SCROLLBAR!
  HTML.Document.body.Scroll = "no"

    'Wait for document to load
  Do While HTML.Busy
    DoEvents
  Loop

  'Retrieve/Set ScrollBar Properties
  Call SetScrollbar
End Sub

Sub SetScrollbar()
  'Retrieve docHeight and winHeight
  Call HTML.Document.parentWindow.execScript("getDocumentHeight();", "JavaScript")
 
  Dim Data() As String
  Data = Split(HTML.Document.All("docHeight").Value, "|")
 
  'Set Document Height
  hDoc = val(Data(0))

  'Set Window Height
  hWin = val(Data(1))
 
  If hDoc < hWin Then
    'Document Fits in Current Window, Hide Scrollbar
    sbHTML.Visible = False
  Else
    'Document May need scrolling, set min/max
    sbHTML.Visible = True
    sbHTML.Min = 1
    sbHTML.Max = (hDoc - hWin) / 10
    sbHTML.Value = sbHTML.Min
  End If

End Sub


Private Sub sbHTML_Change()
  HTML.Document.body.scrollTop = sbHTML.Value * 10
End Sub

Product: Xtreme SuitePro (ActiveX) 12.0.1
Platform: Windows Vista/XP
Language: Visual Basic 6.0 SP6
Back to Top
JasonG View Drop Down
Groupie
Groupie


Joined: 07 July 2008
Status: Offline
Points: 76
Post Options Post Options   Thanks (0) Thanks(0)   Quote JasonG Quote  Post ReplyReply Direct Link To This Post Posted: 29 July 2008 at 11:18am
This code was added to make the mousewheel work.

in frmMain:

Private Sub HTML_GotFocus()
  WheelHook frmMain
End Sub

Private Sub HTML_LostFocus()
  WheelUnHook
End Sub

Private Sub Form_Activate()
  If sbHTML.Visible Then WheelHook frmMain
End Sub

Private Sub Form_Deactivate()
  WheelUnHook
End Sub



in a Module:

Private Declare Function CallWindowProc Lib "user32.dll" Alias "CallWindowProcA" ( _
ByVal lpPrevWndFunc As Long, _
ByVal hWnd As Long, _
ByVal Msg As Long, _
ByVal Wparam As Long, _
ByVal Lparam As Long) As Long

Private Declare Function SetWindowLong Lib "user32.dll" Alias "SetWindowLongA" ( _
ByVal hWnd As Long, _
ByVal nIndex As Long, _
ByVal dwNewLong As Long) As Long

Public Const MK_CONTROL = &H8
Public Const MK_LBUTTON = &H1
Public Const MK_RBUTTON = &H2
Public Const MK_MBUTTON = &H10
Public Const MK_SHIFT = &H4
Private Const GWL_WNDPROC = -4
Private Const WM_MOUSEWHEEL = &H20A

Dim LocalHwnd As Long
Dim LocalPrevWndProc As Long
Dim MyForm As Form

Private Function WindowProc(ByVal Lwnd As Long, ByVal Lmsg As Long, ByVal Wparam As Long, ByVal Lparam As Long) As Long

    Dim MouseKeys As Long
    Dim Rotation As Long
    Dim Xpos As Long
    Dim Ypos As Long

    If Lmsg = WM_MOUSEWHEEL Then
        MouseKeys = Wparam And 65535
        Rotation = Wparam / 65536
        Xpos = Lparam And 65535
        Ypos = Lparam / 65536
        MyForm.MouseWheel MouseKeys, Rotation, Xpos, Ypos
    End If
    WindowProc = CallWindowProc(LocalPrevWndProc, Lwnd, Lmsg, Wparam, Lparam)
End Function

Public Sub WheelHook(PassedForm As Form)

    On Error Resume Next

    Set MyForm = PassedForm
    LocalHwnd = PassedForm.hWnd
    LocalPrevWndProc = SetWindowLong(LocalHwnd, GWL_WNDPROC, AddressOf WindowProc)
End Sub


Public Sub WheelUnHook()
    Dim WorkFlag As Long

    On Error Resume Next
    WorkFlag = SetWindowLong(LocalHwnd, GWL_WNDPROC, LocalPrevWndProc)
    Set MyForm = Nothing
End Sub

Product: Xtreme SuitePro (ActiveX) 12.0.1
Platform: Windows Vista/XP
Language: Visual Basic 6.0 SP6
Back to Top
Aaron View Drop Down
Senior Member
Senior Member
Avatar

Joined: 29 January 2008
Status: Offline
Points: 2192
Post Options Post Options   Thanks (0) Thanks(0)   Quote Aaron Quote  Post ReplyReply Direct Link To This Post Posted: 29 July 2008 at 11:59am
Jason,
 
Can you create a demo and upload it in the sample subform? This would be nice for everyone who wants to know
 
Thanks
Product: Xtreme SuitePro (ActiveX) version 15.0.2
Platform: Windows XP (32bit) - SP 2
Language: Visual Basic 6.0

Zero replies is not an option....
Back to Top
JasonG View Drop Down
Groupie
Groupie


Joined: 07 July 2008
Status: Offline
Points: 76
Post Options Post Options   Thanks (0) Thanks(0)   Quote JasonG Quote  Post ReplyReply Direct Link To This Post Posted: 29 July 2008 at 1:10pm
got the sample... where can I post it?
Product: Xtreme SuitePro (ActiveX) 12.0.1
Platform: Windows Vista/XP
Language: Visual Basic 6.0 SP6
Back to Top
Aaron View Drop Down
Senior Member
Senior Member
Avatar

Joined: 29 January 2008
Status: Offline
Points: 2192
Post Options Post Options   Thanks (0) Thanks(0)   Quote Aaron Quote  Post ReplyReply Direct Link To This Post Posted: 29 July 2008 at 1:16pm
Originally posted by JasonG JasonG wrote:

got the sample... where can I post it?
 
Hi,
 
 
Product: Xtreme SuitePro (ActiveX) version 15.0.2
Platform: Windows XP (32bit) - SP 2
Language: Visual Basic 6.0

Zero replies is not an option....
Back to Top
JasonG View Drop Down
Groupie
Groupie


Joined: 07 July 2008
Status: Offline
Points: 76
Post Options Post Options   Thanks (0) Thanks(0)   Quote JasonG Quote  Post ReplyReply Direct Link To This Post Posted: 29 July 2008 at 1:22pm
All set... PS - I have a few outstanding questions in the forums, should I elevate to the support team you think?
Product: Xtreme SuitePro (ActiveX) 12.0.1
Platform: Windows Vista/XP
Language: Visual Basic 6.0 SP6
Back to Top
JasonG View Drop Down
Groupie
Groupie


Joined: 07 July 2008
Status: Offline
Points: 76
Post Options Post Options   Thanks (0) Thanks(0)   Quote JasonG Quote  Post ReplyReply Direct Link To This Post Posted: 29 July 2008 at 1:51pm
Also, does anyone know how to skin a vertically oriented  toolbar?

I opened my MsStyles file in a resource hacker and see the horizontal toolbar background is stored as (NAME)_TOOLBARBACKGROUND_BMP.bmp. Is there a name for a veritcal toolbar background?

Product: Xtreme SuitePro (ActiveX) 12.0.1
Platform: Windows Vista/XP
Language: Visual Basic 6.0 SP6
Back to Top
 Post Reply Post Reply
  Share Topic   

Forum Jump Forum Permissions View Drop Down

Forum Software by Web Wiz Forums® version 12.04
Copyright ©2001-2021 Web Wiz Ltd.

This page was generated in 0.219 seconds.