Compile an HTA as a CHM?
I wish.
One of the nice things about CHMs is that they can "wrap up" a number of HTML pages that belong together as one entity. Of course you get other things like search capabilities, a sort of predefined tree-navigation pane, etc.
Nothing really keeps you from using script or ActiveX or java applets in there too though.
What I guess I don't know is how relaxed the scripting security model is for CHMs. I've never tried using them as anything but Help files so I've never gotten too wild about trying to do things like file or database I/O, executing external programs, communicating with servers, etc. This stuff is routine in HTAs of course.
In many cases my HTAs use auxilary HTM files and load them into IFRAME objects within the .HTA itself. This is where I'd like the idea of bundling in the other bits such as image files, those aux HTMs, and even CABs for components. Even an icon associated with an HTA is an external ICO file because there isn't any place to bundle it in.
One way to glob everything except the main HTA file itself together is to create a resource file containing all of those VBs, JSs, JPGs, and HTMs, etc. Then the HTA could get to those using IE's built in RES:// protocol.
I've never found a nice resource editor that made me happy though. The VB IDE resource editor is too targeted to VB programs to be helpful and I've been too lazy to look into doing this all manually the way a C/C++ programmer does it. That way you'd have only an HTA, an ICO, and a RES file - a little neater than my usual HTA plus a folder containing all the other individual resource files the application uses.
CHMs though hmm? You might have something there.