PageRenderTime 22ms CodeModel.GetById 2ms app.highlight 15ms RepoModel.GetById 2ms app.codeStats 0ms

/Visual Studio 2008/HTMLEmbedActiveX/MFCActiveX.html

#
HTML | 54 lines | 51 code | 3 blank | 0 comment | 0 complexity | e587fb04c1a7f18d234c42ae0fbfc118 MD5 | raw file
 1<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
 2<html xmlns="http://www.w3.org/1999/xhtml">
 3<head>
 4    <title>MFCActiveX</title>
 5
 6    <script language="javascript" type="text/javascript">
 7        function SetFloatProperty() {
 8            var fVal = parseFloat(floatPropInput.value);
 9            if (!isNaN(fVal)) {
10                MFCActiveX1.FloatProperty = fVal;
11            }
12        }
13        function GetFloatProperty() {
14            alert("MFCActiveX1.FloatProperty = " +
15                MFCActiveX1.FloatProperty.toString());
16        }
17    </script>
18
19    <script language="vbscript" type="text/vbscript" for="MFCActiveX1" event="FloatPropertyChanging(NewValue, byref Cancel)">
20'       http://support.microsoft.com/kb/253282
21'       we do not use jscript or javascript because they passes all variables
22'       by value (not by reference). The FloatPropertyChanging event requires 
23'       passing the cancel param by reference.
24        If confirm("FloatProperty is being changed to " & Cstr(NewValue)) Then
25            Cancel = false
26        Else
27            Cancel = true
28        End If
29'       'Cancel' does not seem to work [to be fixed in future, Jialiang]        
30    </script>
31
32    <style type="text/css">
33        body
34        {
35            font-family: Calibri;
36        }
37        #MFCActiveX1
38        {
39            height: 96px;
40            width: 291px;
41        }
42    </style>
43</head>
44<body>
45    <object id="MFCActiveX1" classid="CLSID:E389AD6C-4FB6-47AF-B03A-A5A5C6B2B820">
46    </object>
47    <p>
48    </p>
49    FloatProperty:
50    <input type="text" name="floatPropInput" value="" style="width: 120px" />
51    <input type="button" name="submit" value="Set" onclick="SetFloatProperty()" />
52    <input type="button" name="retrieve" value="Get" onclick="GetFloatProperty()" />
53</body>
54</html>