S
steveg
I am working on a a web page using VS 2003 and the ASP.NET Mobile Controls
and which will be viewed only on Pocket Internet Explorer 2003 (on an O2 XDA
IIi).
The page has an ActiveX object in it that I have written with VC++ embedded
V4 and I am trying to access this control from JScript.
If I write a plain .htm page, I can access the ActiveX control from the
forms onSubmit attribute (example below). This works fine.
However, if I try to access the ActiveX control from script that is *not* in
the forms onSubmit attribute, the object is Undefined.
The problem is that I cannot use the forms onSubmit attribute in a Mobile
Control page.
I want to to one of following things (most preferable first)...
1) Find out how to reference the ActiveX control from normal script
2) Find a hack that allows me to render and then use the forms onSubmit
attribute to access the control and then kludge this into the other
jscript on the page so that I can postback having accessed the control.
3) Anything else to make it work...
I include a plain htm page below that shows both the working and non working
situations. The page as shown works. If however the line commented with
'works' is commented out and the following line (commented with 'fails') is
commented in the script fails. I know this is not the Mobile Controls page
but if I can get the failing page to work, I can transfer that logic to the
Mobile Controls page
The test pages are on
www.p2cl.co.uk/ppct/skgood.htm (works)
www.p2cl.co.uk/ppct/skbad.htm (does not work)
The ActiveX is available if required as
www.p2cl.co.uk/ppct/armv4sketch.ocx (for arm)
www.p2cl.co.uk/ppct/emsketch.ocx (for emulator) (works but this problem
not tested on emulator)
TIA
------------------------ example --------------------------
<HTML>
<HEAD>
<TITLE>SketcCtl Test</TITLE>
<script language="JavaScript">
<!-- Hide script
function send_Signature( obj_Parm_Image_Data )
{
var theform = document.forms["testForm"];
// use just *one* of the following 2 lines. using first works, using
second fails
// using this next line works (activex referenced in onSubmit)
theform.SIGDATA.value = obj_Parm_Image_Data ; // works
// using this next line fails (with "SketcCtl is Undefined")
// theform.SIGDATA.value = SketcCtl.ImageDataAsString() ; // fails
theform.submit();
}
// End hiding -->
</script>
</HEAD>
<body bgcolor="#66ffff">
<p>Sign in the box below...</p>
<form action="http://www.p2cl.co.uk/ppct/echo.asp"
id="testForm"
method="post"
onSubmit="javascript:send_Signature( SketcCtl.ImageDataAsString() )
;return false;" >
<OBJECT ID="SketcCtl" CLASSID="CLSID:CBF9C2BE-E8CB-11D0-AFAE-00600811D2B6"
height="90"
width="260"
VIEWASTEXT >
Sketch not supported.
</OBJECT>
<input name="submitBTN" id="submitBTN" type="submit" >
<input type="hidden" name="SIGDATA" id="SIGDATA" value="" />
</form>
</BODY>
</HTML>
and which will be viewed only on Pocket Internet Explorer 2003 (on an O2 XDA
IIi).
The page has an ActiveX object in it that I have written with VC++ embedded
V4 and I am trying to access this control from JScript.
If I write a plain .htm page, I can access the ActiveX control from the
forms onSubmit attribute (example below). This works fine.
However, if I try to access the ActiveX control from script that is *not* in
the forms onSubmit attribute, the object is Undefined.
The problem is that I cannot use the forms onSubmit attribute in a Mobile
Control page.
I want to to one of following things (most preferable first)...
1) Find out how to reference the ActiveX control from normal script
2) Find a hack that allows me to render and then use the forms onSubmit
attribute to access the control and then kludge this into the other
jscript on the page so that I can postback having accessed the control.
3) Anything else to make it work...
I include a plain htm page below that shows both the working and non working
situations. The page as shown works. If however the line commented with
'works' is commented out and the following line (commented with 'fails') is
commented in the script fails. I know this is not the Mobile Controls page
but if I can get the failing page to work, I can transfer that logic to the
Mobile Controls page
The test pages are on
www.p2cl.co.uk/ppct/skgood.htm (works)
www.p2cl.co.uk/ppct/skbad.htm (does not work)
The ActiveX is available if required as
www.p2cl.co.uk/ppct/armv4sketch.ocx (for arm)
www.p2cl.co.uk/ppct/emsketch.ocx (for emulator) (works but this problem
not tested on emulator)
TIA
------------------------ example --------------------------
<HTML>
<HEAD>
<TITLE>SketcCtl Test</TITLE>
<script language="JavaScript">
<!-- Hide script
function send_Signature( obj_Parm_Image_Data )
{
var theform = document.forms["testForm"];
// use just *one* of the following 2 lines. using first works, using
second fails
// using this next line works (activex referenced in onSubmit)
theform.SIGDATA.value = obj_Parm_Image_Data ; // works
// using this next line fails (with "SketcCtl is Undefined")
// theform.SIGDATA.value = SketcCtl.ImageDataAsString() ; // fails
theform.submit();
}
// End hiding -->
</script>
</HEAD>
<body bgcolor="#66ffff">
<p>Sign in the box below...</p>
<form action="http://www.p2cl.co.uk/ppct/echo.asp"
id="testForm"
method="post"
onSubmit="javascript:send_Signature( SketcCtl.ImageDataAsString() )
;return false;" >
<OBJECT ID="SketcCtl" CLASSID="CLSID:CBF9C2BE-E8CB-11D0-AFAE-00600811D2B6"
height="90"
width="260"
VIEWASTEXT >
Sketch not supported.
</OBJECT>
<input name="submitBTN" id="submitBTN" type="submit" >
<input type="hidden" name="SIGDATA" id="SIGDATA" value="" />
</form>
</BODY>
</HTML>