• Welcome to Tux Reports: Where Penguins Fly. We hope you find the topics varied, interesting, and worthy of your time. Please become a member and join in the discussions.

HTA problem with IE8

W

WCHull

Flightless Bird
We discovered an issue with some inbedded VBScript code inside an HTA written by a developer that is no longer with us. The code work in IE6 but error out on the set objMsgArea statement indicating that the object requires 'objMenuFrame' which should have been set in the previous line of code. If I put in an 'On Error Resume Next" statement in that sub the HTA appears to work correctly however I don't like putting a band-aid on something like this. Does anyone have any solution for this? Here's the code:

sub AppStatusDisplay(strMsgIn, bolAddToStatusLogIn)
strCalledFromFunction = strFunctionName
strFunctionName = "ADA-CommonFunctions:AppStatusDisplay"
if bolAddToStatusLogIn then
AppStatus strMsgIn
end if
strAppMessage = strMsgIn
set objParent = self.parent
if varType(objParent) = vbObject then
set objMenuFrame = self.parent.document.getElementById("ifrMenuFrame")
set objMsgArea = objMenuFrame.contentWindow.document.getElementById("divScriptMessage")
else
set objMsgArea = divStatus
end if
objMsgArea.Innertext = strMsgIn
call ExecCommand("")
strFunctionName = strCalledFromFunction
end sub


---
frmsrcurl: http://msgroups.net/microsoft.public.internetexplorer.general/
 
P

PA Bear [MS MVP]

Flightless Bird
Looks like you may be hiring a new Developer.

Developer-specific resources include:

MSDN IE Development Forum (post such questions here instead)
http://social.msdn.microsoft.com/Forums/en-US/iewebdevelopment/threads

Tip: When posting in Developer forums, always include a link to your web
site or test pages in your first post.

IE Developer Center
http://msdn.microsoft.com/en-us/ie/default.aspx

Learn IE8
http://msdn.microsoft.com/en-us/ie/aa740473.aspx

HTML and DHTML Overviews and Tutorials
http://msdn.microsoft.com/en-us/library/ms537623.aspx and

Cascading Style Sheets (CSS)
http://msdn2.microsoft.com/en-us/ie/aa740476.aspx

Expression Web SuperPreview for Internet Explorer (free, stand-alone visual
debugging tool for IE6, IE7, and IE8)
http://www.microsoft.com/downloads/...FamilyID=8e6ac106-525d-45d0-84db-dccff3fae677

Expression Web SuperPreview Release Notes
http://www.microsoft.com/expression/products/Web_SuperPreviewReleaseNotes.aspx

Validators:
http://validator.w3.org/
http://jigsaw.w3.org/css-validator/


WCHull wrote:
> We discovered an issue with some inbedded VBScript code inside an HTA
> written by a developer that is no longer with us. The code work in IE6
> but
> error out on the set objMsgArea statement indicating that the object
> requires 'objMenuFrame' which should have been set in the previous line of
> code. If I put in an 'On Error Resume Next" statement in that sub the HTA
> appears to work correctly however I don't like putting a band-aid on
> something like this. Does anyone have any solution for this? Here's the
> code:
>
> sub AppStatusDisplay(strMsgIn, bolAddToStatusLogIn)
> strCalledFromFunction = strFunctionName
> strFunctionName = "ADA-CommonFunctions:AppStatusDisplay"
> if bolAddToStatusLogIn then
> AppStatus strMsgIn
> end if
> strAppMessage = strMsgIn
> set objParent = self.parent
> if varType(objParent) = vbObject then
> set objMenuFrame =
> self.parent.document.getElementById("ifrMenuFrame")
> set objMsgArea =
> objMenuFrame.contentWindow.document.getElementById("divScriptMessage")
> else set objMsgArea = divStatus
> end if
> objMsgArea.Innertext = strMsgIn
> call ExecCommand("")
> strFunctionName = strCalledFromFunction
> end sub
>
>
> ---
> frmsrcurl: http://msgroups.net/microsoft.public.internetexplorer.general/
 
D

Dan

Flightless Bird
The error would suggest that objMenuFrame is not being assigned to an
IFRAME. This is probably down to cross frame security improvements in IE8
preventing this from working, and because you're not checking that
objMenuFrame has the appropriate properties before attempting to use them
you are getting the error. On Error Resume Next won't make this work, it'll
just simply skip that line and any others following that error - so the
divScriptMessage element won't be set to the strMsgIn value.

If you add code to print the value of the error number and description after
the "set objMsgArea = ..." line, what are the values displayed? This will
give you a clue to the source of the problem.

contentWindow is an old IE specific reference, have you tried
contentDocument? This a DOM reference so will be supported by IE8, but not
necessarily by earlier versions.

Where are the HTA files being loaded? If in the My Computer zone then you
will need to add a "mark of the web", as IE8 restricts access via scripting
and contentWindow/contentDocument are amongst the properties that have had
security restrictions applied, but it should work if the file is loaded from
the Internet zone.

And why are you calling ExecCommand with an empty string?

Dan

"WCHull" <user@msgroups.net/> wrote in message
news:-O4hjxtwDLHA.420@TK2MSFTNGP02.phx.gbl...
> We discovered an issue with some inbedded VBScript code inside an HTA
> written by a developer that is no longer with us. The code work in IE6
> but error out on the set objMsgArea statement indicating that the object
> requires 'objMenuFrame' which should have been set in the previous line of
> code. If I put in an 'On Error Resume Next" statement in that sub the HTA
> appears to work correctly however I don't like putting a band-aid on
> something like this. Does anyone have any solution for this? Here's the
> code:
>
> sub AppStatusDisplay(strMsgIn, bolAddToStatusLogIn)
> strCalledFromFunction = strFunctionName
> strFunctionName = "ADA-CommonFunctions:AppStatusDisplay"
> if bolAddToStatusLogIn then
> AppStatus strMsgIn
> end if
> strAppMessage = strMsgIn
> set objParent = self.parent
> if varType(objParent) = vbObject then
> set objMenuFrame =
> self.parent.document.getElementById("ifrMenuFrame")
> set objMsgArea =
> objMenuFrame.contentWindow.document.getElementById("divScriptMessage")
> else
> set objMsgArea = divStatus
> end if
> objMsgArea.Innertext = strMsgIn
> call ExecCommand("")
> strFunctionName = strCalledFromFunction
> end sub
>
>
> ---
> frmsrcurl: http://msgroups.net/microsoft.public.internetexplorer.general/
 
W

WCHull

Flightless Bird
Thanks for the reply.

I know this doesn't really solve the problem referenced in the origional post however the sub has been re-written to be as follow:

sub AppStatusDisplay(strMsgIn, bolAddToStatusLogIn)
strCalledFromFunction = strFunctionName
strFunctionName = "ADA-CommonFunctions:AppStatusDisplay"
if bolAddToStatusLogIn then
AppStatus strMsgIn
end if
strAppMessage = strMsgIn
set objMsgArea = divStatus
objMsgArea.Innertext = strMsgIn
call ExecCommand("")
strFunctionName = strCalledFromFunction
end sub

We determined that the original sub had some "extraneous code" in this subroutine that was not really needed by any of the HTA's that used that routine thus is was easier just to remove the code that was causing the error.

---
frmsrcurl: http://msgroups.net/microsoft.public.internetexplorer.general/HTA-problem-with-IE8
 
Top