用VS2005开发COM 组件

[ 2010-02-11 12:34:04 | Author: sunrise_chen ]
Font Size: Large | Medium | Small

1, 添加引用
using System.Runtime.InteropServices;

2, 在类名前加上
[ProgId("Shanger.Sunrise")] //Com调用的名字
[Guid("CAF9E079-7A4F-46ac-9516-9A5CCAB41ABD")]  //设置GUID
Guid 可以在 工具-> 创建 Guid里得到

3, 设置Com可见
双击 "解决方案管理器>项目名>Properties", "应用程序">"程序集信息">"使程序集Com可见"
.或者.
AssemblyInfo.cs里修改: [assembly: ComVisible(true)]
效果一样的.

4. 本机调试(可选)
"解决方案管理器>项目名>Properties", "生成"标签里选"为 COM Interop 注册"

5. 部署
还没做,以后再讲.

[Last Modified By sunrise_chen, at 2010-02-11 12:35:07]
Comments Feed Comments Feed: http://www.ccopus.com/blog/feed.asp?q=comment&id=25

There is no comment on this article.

Post Comment
Smilies
[smile] [confused] [cool] [cry]
[eek] [angry] [wink] [sweat]
[lol] [stun] [razz] [redface]
[rolleyes] [sad] [yes] [no]
[heart] [star] [music] [idea]
Enable UBB Codes
Auto Convert URL
Show Smilies
Hidden Comment
Username:   Password:   Register Now?
Security Code * Please Enter the Security Code