问题
I have a HTA that I want to block resizing to extremely small sizes (less than 170x70). I found a way in VBScript to do this by detecting if the window is to small and if it is resizing it automatically like this:
<script type="text/vbscript">
Sub Window_onResize
Dim w
Dim h
Dim p
w = Document.Body.OffsetWidth
h = Document.Body.OffsetHeight
p = false
If Document.Body.OffsetWidth < 170 Then
w = 170
p = true
End If
If Document.Body.OffsetHeight < 70 Then
h = 70
p = true
End If
If p Then
window.ResizeTo w,h
End If
End Sub
</script>
My problem is that apparently ResizeTo
counts the scroll bar and the title bar whereas OffsetWidth
and OffsetHeight
don't. I thought of solving this problem by detecting the title bar's height and the scroll bar's width. I've searched the web for how to do this and I haven't found anything. You can suggest a way of detecting the title bar's height and the scroll bar's width or another way of keeping the HTA from getting resized to extremesly small sizes.
来源:https://stackoverflow.com/questions/28114310/keeping-an-hta-from-resizing-to-extremely-small-sizes