-
Feb 11th, 2018, 10:16 PM
#1
HTA as HTML UI for VB6 code
Last edited by dilettante; Feb 12th, 2018 at 07:45 AM.
Reason: reposted with some junk removed
-
Feb 11th, 2018, 10:21 PM
#2
Re: HTA as HTML UI for VB6 code
P.S.
The diagram above has not been updated to show the .CSS and .ICO files I added last but they also get copied into the Resources subfolder.
Your CSS can be inline within the .HTA and the .ICO is an optional feature.
-
Feb 11th, 2018, 10:25 PM
#3
Re: HTA as HTML UI for VB6 code
Er... the demo just reads in a UTF-8 text file of Unicode CSV data and prints it with some goofy graphics effects for printers that support them.
-
Feb 12th, 2018, 11:06 AM
#4
Re: HTA as HTML UI for VB6 code
Hi dilettante, I've tested it on Win10, it can print the content of Utf8.txt into PDF, but I still need to go deeper to learn what it can be used for. Thank you for providing us with a different solution.
-
Feb 12th, 2018, 10:50 PM
#5
Fanatic Member
Re: HTA as HTML UI for VB6 code
Originally Posted by dilettante
This is probably more of a stunt than something there is a need for. But it shows one of the ways that VB6 code can be "behind" an HTML/CSS front end.
The provided stylesheet basically duplicates the look of a plain old VB6 Form. However you could tweak the CSS and add more HTML to have garish colors, gauche behaviors, spinning flaming logos, and popup ads galore.
Here is UPrinterDemo.hta itself:
Code:
<html>
<head>
<hta:application
id=HTA
applicationName="UPrinter Demo"
icon="Resources/UPrinterDemo.ico"
singleInstance=no
border=thin
borderStyle=raised
sysMenu=yes
maximizeButton=no
minimizeButton=no
contextMenu=no
showInTaskBar=yes
scroll=no
scrollFlat=no
navigable=no
selection=no
windowState=normal
version=1.0>
<title>UPrinter Demo</title>
<link rel=stylesheet href="Resources/UPrinterDemo.css">
<script language="vbscript">
Option Explicit
Private UPrinterDemo
Private Sub window_onload()
'These need to be assigned to match the layout that the
'stylesheet defines:
Const WIDTH = 320
Const HEIGHT = 241
With window
.resizeTo WIDTH, HEIGHT
.moveTo (screen.availWidth - WIDTH ) \ 2, _
(screen.availHeight - HEIGHT ) \ 2
End With
With CreateObject("Microsoft.Windows.ActCtx")
.Manifest = "Resources\UPrinterDemo.manifest"
Set UPrinterDemo = .CreateObject("UPrinterDemo.Demo")
End With
With UPrinterDemo
Set .Document = document
.Initialize
End With
End Sub
</script>
</head>
<body>
<div id=Label1>Choose a printer</div>
<!-- Note: select element with size > 1 means "not a dropdown" -->
<select id=lstPrinters size=2></select>
<button id=cmdPrint disabled>Print</button>
<div id=lblStatus class=StatusBar>Ready</div>
</body>
</html>
That's pretty much it. All of the heavy lifting happens in UPrinterDemo.dll's Demo class which is clean burning, eco-friendly, high performance, VB6 native machine code!
Requirements
No megalithic "framework" libraries required. Fully registration-free XCopy deployment.
This is supposed to work as far back as Windows XP, however I am uncertain whether XP SP3 is required and it probably works on XP SP2 but I have doubts about XP SP1 or before.
Only tested on Windows 10 1709.
The required DLLAsm 2.1 utility is included in VB6 source code form so you'll have to compile that first. Please see the ReadMe.txt file.
if used xp3 may error
Error: ActiveX component can not create object: 'Microsoft.Windows.ActCtx'
win7 ok
-
Feb 13th, 2018, 01:00 AM
#6
Re: HTA as HTML UI for VB6 code
Funny, MSDN says it is supported on WinXP.
-
Jun 12th, 2018, 03:03 PM
#7
Junior Member
Re: HTA as HTML UI for VB6 code
Info: HTA's underly "lower" security limitations (in terms of createobject) in comparison with the regular IE Browser.
But this likewise the big con - Within enterprise environments HTA's are often blocked via GPO's.
This affects likewise Windows Script Components (.WSC) which are more of less "open" activeX 'scripts'/'components'.
-
Jun 13th, 2018, 09:02 AM
#8
Re: HTA as HTML UI for VB6 code
yeah no ActCtx on XP.
I've actually used your ActCtx demo and replaced the reg-free methods with Trick's reg-free methods to manually load COM DLL Objects on XP.
-
Jun 14th, 2018, 06:42 AM
#9
Re: HTA as HTML UI for VB6 code
Registration-Free Activation of COM Components: A Walkthrough
An alternative to the direct activation context API, but available only on Windows Server 2003, is the Microsoft.Windows.ActCtx object.
Didn't release it too.
cheers,
</wqw>
Posting Permissions
- You may not post new threads
- You may not post replies
- You may not post attachments
- You may not edit your posts
-
Forum Rules
|
Click Here to Expand Forum to Full Width
|