开发者

How to debug IE9 HTA?

Has anyone got开发者_JAVA百科ten a debugger attached to mshta.exe after installing IE9? (64bit or WOW64)


If you have Visual Studio, go to Tools -> Attach to Process and attach to the MSHTA.EXE process. Then pick Script as the target to debug.


I'm on a Vista x64, so I have to contend with the 32bit/64bit barrier.

HTA

  • c:\windows\system32\mshta.exe (mshta32)
  • c:\windows\syswow64\mshta.exe (mshta64)

Launching

  • "mshta32 foo.hta" may use mshta32 or mshta64 depending on what is associated with HTA
  • the same goes if "mshta64 foo.hta" is used
  • "cmd /C start foo.hta" would have the same affect.

Debugger

  • MS Script Editor (from Office XP/2003) for JS debugging in IE/HTA

Normally I would use the debugger keyword to initiate the launching of the debugger, however with IE9, it doesn't seem to do that anymore. I must launch the debugger first, attach to the mshta.exe process manually (only supports 32bit). Then everything appears to work fine!

EDIT:

With coworkers, different machine have exhibited different behaviors:

  • debugger keyword works fine
  • Connecting to MSHTA.EXE from the debugger doesn't work

I haven't yet found a silver bullet.


Try using 'Stop' statement. This should raise the debugger dialog


I had the same problem. Finally pieced together how to debug using Visual Studio from two sources

  1. Turn on script debugging through Internet Explorer, as described here and here
  2. Start up Visual Studio. Click on Debug -> Attach to Process
  3. Run the .hta file and select the running process from the Attach to Process dialog
0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜