SOLVED: VB6 WebBrowser Not Skinned
Printed From: Codejock Forums
Category: Codejock Products
Forum Name: Skin Framework
Forum Description: Topics Related to Codejock Skin Framework
URL: http://forum.codejock.com/forum_posts.asp?TID=11616
Printed Date: 27 September 2024 at 6:30pm Software Version: Web Wiz Forums 12.04 - http://www.webwizforums.com
Topic: SOLVED: VB6 WebBrowser Not Skinned
Posted By: JasonG
Subject: SOLVED: VB6 WebBrowser Not Skinned
Date 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
|
Replies:
Posted By: Oleg
Date 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
|
Posted By: JasonG
Date 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
|
Posted By: JasonG
Date 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
|
Posted By: JasonG
Date 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
|
Posted By: Aaron
Date 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....
|
Posted By: JasonG
Date 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
|
Posted By: Aaron
Date Posted: 29 July 2008 at 1:16pm
JasonG wrote:
got the sample... where can I post it? |
Hi,
In here : https://forum.codejock.com/forum_topics.asp?FID=160 - https://forum.codejock.com/forum_topics.asp?FID=160
------------- 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....
|
Posted By: JasonG
Date 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
|
Posted By: JasonG
Date 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
|
|