a sample of how to create a very simple ActiveX component:
// AxComp.cs
using System;
using System.Runtime.InteropServices;
namespace AXComponent
&leftsign;
public interface AXTest
&leftsign;
string callMe();
&rightsign;
[ClassInterface(ClassInterfaceType.AutoDual)]
public class AxComp :AXTest
&leftsign;
public string callMe()
&leftsign;
return "My dog has no nose, how does it smell?";
&rightsign;
&rightsign;
&rightsign;
Compile this using:
csc /t:library AxComp.cs
Register and generate Typelib with:
regasm AxComp.dll /tlb:AxCompNet.dll /codebase
Try the control: ( testControl.htm )
<html>
<head>
<script language="javascript">
var obNewAXComponent = new ActiveXObject("AXComponent.AXComp");
alert(obNewAXComponent.callMe());
</script>
</head>
<body>
<h1>Awful!</h1>
</body>
</html>
历史博文
- 20090812 KIS2010 WIN2003 - 2009
- 20090813 Wordpress cms BBtheme 修改 - 2009
- 20090812 xml rpc comodo - 2009
- 20090807 Godaddy gegehost - 2009
- 20090807 双飞燕 G7630 电池 - 2009
- 20090807 c# WebBrowser NewWindow2 - 2009
- 20090807 c# Parent Process - 2009
- 20090803 長沙 益阳 印象 - 2009
- 20090803 益阳 丧俗 - 2009
- 20090803 母系 亲戚 外婆 - 2009