Tech Off Thread

2 posts

Forum Read Only

This forum has been made read only by the site admins. No new threads or comments can be added.

HTAs and HTCs not playing well together.

Back to Forum: Tech Off
  • User profile image

    I've got an HTA that's chromeless (no non-client areas, no titlebar, no borders - just a rectangle of drawing space), and I want to make it move around the screen when the user drags my custom titlebar. Moving it isn't the problem, the problem arises when I attempt to encapsulate the moving logic into an HTC. I get 'Access is Denied' on the window.moveTo call.

    I can get at the event.X and event.Y (the behavior uses a public:event tag to handle moving in case you want to move something else) properties just fine, so that's not the cause.

    Anyone have any idea how to fix this, or am I stuck with copying the movement logic to every chromeless window?

    Here's the HTC:

    <public:component lightweight="true">
     <public:attach event="onmousedown" onevent="down()" />
     <public:attach event="onmouseup" onevent="up()" />
     <public:attach event="onmousemove" onevent="move()" />
     <public:event id="moveEvent" name="onmove" />
      var isDown = false;
      var downX;
      var downY;
      function down()
       isDown = true;
       downX = event.x;
       downY = event.y;
      function up()
       isDown = false;
      function move()
       if (isDown)
        var e;
        var toX = event.x - downX;
        var toY = event.y - downY;
        e = createEventObject();
        e.x = toX;
        e.y = toY;

    And the relevant bits of HTA:
       window.resizeTo(320, 240);
       function moveWindow()
        var toX = event.x;
        var toY = event.y;
        window.moveTo(toX, toY);
      <!-- The caption class is:
       behavior: url(http://localhost/pathTo/;
      <div class="caption" onmove="moveWindow()">

    Both of these files are located in the same folder, being served up by the IIS included in Windows XP Tablet.

  • User profile image

    Hi mate,

    I know much water has flowed under the bridges since you published this post... Expressionless

    but still, I'm having exactly the same issue as you had before. If you just could recall if you solved that problem or not?

    Waiting impassionately for you answer...

    Thanks in advance,

Conversation locked

This conversation has been locked by the site admins. No new comments can be made.