- 博客(0)
- 资源 (4)
- 收藏
- 关注
Flex + ASP_Net + FlourineFX环境配置,开发,发布(文檔+代碼)
Flex + ASP_Net + FlourineFX环境配置,开发,发布(文檔+代碼) .我搞幾天了,終於調通了。。。
2010-12-05
C#版ActiveX + JS +Flex通讯 完整实现
C#版ActiveX + JS +Flex通訊 全實現
因項目部署需要,特把之前寫的與讀卡器通訊的模塊改為ActiveX插件,給Flash調用,由於Flash不能直接調用ActiveX,所以,用JS作為中間層,作為Flash和ActiveX通訊的橋梁。
開發環境:WINXP _EN
開發工具:VS2005,Flex 3. .net 2.0
ActiveX控件開發
1:新建一個工程項目,MyActiveXDemo,選擇Visual C#->Windows Control Library
2:修改UserControl1.cs為ReadICCard.cs
3:設置工程發布屬性,工程屬性->Application->Assembly information, 把Make assembly Com-Visible 勾上。
4:到 工程屬性->Build->Output, 把 Register for COM interop 勾上。
5:修改AssemblyInfo.cs文件,加上紅色方框部分內容:
6:在ReadICCardActiveX 控件里,添加一個GUID,可以使用 工具-创建GUID 菜单创建一个GUID
7:为了让ActiveX控件获得客户端的信任,控件类还需要实现一个名为“IObjectSafety”的接口。先创建该接口(注意,不能修改该接口的GUID值):(這里是直接copy網上的)
using System;
using System.Collections.Generic;
using System.Text;
using System.Runtime.InteropServices;
namespace Preresearch.CSharpActiveX
{
[ComImport, GuidAttribute( " CB5BDC81-93C1-11CF-8F20-00805F2CD064 " )]
[InterfaceTypeAttribute(ComInterfaceType.InterfaceIsIUnknown)]
public interface IObjectSafety
{
[PreserveSig]
int GetInterfaceSafetyOptions( ref Guid riid, [MarshalAs(UnmanagedType.U4)] ref int pdwSupportedOptions, [MarshalAs(UnmanagedType.U4)] ref int pdwEnabledOptions);
[PreserveSig()]
int SetInterfaceSafetyOptions( ref Guid riid, [MarshalAs(UnmanagedType.U4)] int dwOptionSetMask, [MarshalAs(UnmanagedType.U4)] int dwEnabledOptions);
}
}
然后在控件类中继承并实现该接口:
#region IObjectSafety 成员
private const string _IID_IDispatch = " {00020400-0000-0000-C000-000000000046} " ;
private const string _IID_IDispatchEx = " {a6ef9860-c720-11d0-9337-00a0c90dcaa9} " ;
private const string _IID_IPersistStorage = " {0000010A-0000-0000-C000-000000000046} " ;
private const string _IID_IPersistStream = " {00000109-0000-0000-C000-000000000046} " ;
private const string _IID_IPersistPropertyBag = " {37D84F60-42CB-11CE-8135-00AA004BB851} " ;
private const int INTERFACESAFE_FOR_UNTRUSTED_CALLER = 0x00000001 ;
private const
2009-11-06
FB4 SOAP WebService C#
FB4 call WEBSERVICE,base on SOAP protocol.. the webservice writed with C#.
FB4 call WEBSERVICE,base on SOAP protocol.. the webservice writed with C#.
FB4 call WEBSERVICE,base on SOAP protocol.. the webservice writed with C#.
FB4 call WEBSERVICE,base on SOAP protocol.. the webservice writed with C#.
2012-03-09
空空如也
TA创建的收藏夹 TA关注的收藏夹
TA关注的人
RSS订阅