Newsgroups : Borland : borland.public.delphi.internet.winsock : 2007 Dec : How to output a string from an ActiveForm application to a web page?
| Subject: | How to output a string from an ActiveForm application to a web page? |
| Posted by: | "Ma Xiaoming" (maxiaoming100..@hotmail.com) |
| Date: | Mon, 17 Dec 2007 20:04:07 |
Dear ladies and gentlemen,
I created an ActiveForm project with Delphi 6, the name of the ActiveX is
ActiveX5 and the name of the project is ActiveX5Proj1. In the project
unit -- ActiveX5Proj1, I added the following code:
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
library ActiveX5Proj1;
uses
ComServ,
ActiveX5Proj1_TLB in 'ActiveX5Proj1_TLB.pas',
ActiveX5Impl1 in 'ActiveX5Impl1.pas' {ActiveX5: TActiveForm} {ActiveX5:
CoClass};
{$E ocx}
function SayHello: PChar; stdcall;
begin
Result := PChar('Hello');
end;
exports
DllGetClassObject,
DllCanUnloadNow,
DllRegisterServer,
DllUnregisterServer,
SayHello;
{$R *.TLB}
{$R *.RES}
begin
end.
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
Now, I want to output the Hello string to a component which was in a web
page, the name of the page is index.htm, and it's content is the following:
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
<html>
<head>
<title>ActiveX Test</title>
<script type="text/javascript">
function OutInfo() {
span1.innerHTML=ActiveX5.SayHello;
}
</script>
</head>
<body style="text-align:center; background-color: Highlight;
font-size:12px;">
<object
id="ActiveX5"
classid="clsid:34AA62B2-22D5-4491-9345-6B33FC874F15"
codebase="file:///F:/OurPrograms/DelphiProjects/ActiveX5/Test/ActiveX5Proj1.ocx#version=1,0,0,0"
width=864
height=598
align=center
hspace=0
vspace=0
style="font-size:12px;">
<param name="ImagePath" value="nophoto.gif" />
</object>
<br />
<input type="button" value="Show the ActiveX string"
onclick="OutInfo()"/>
<br />
<span id="span1"></span>
</body>
</html>
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
But the span1 couldn't show the string from the ActiveX program. Why?
What's wrong?
Help me, please. Thank you very much.
Best regards.
Xiaoming