COM Interop Presentation comments
来源:互联网 发布:mysql in share mode 编辑:程序博客网 时间:2024/06/03 11:16
&Agenda
=========================
=========================
What is COM
ATL project
COM project
------ATLClass.h------ int GetSelf(int x);
------ATLClass.cpp------
int
ATLClass::GetSelf(int x) {
return x;
}
------CATLSimple.h------
int GetSelf(int x) { return x; } STDMETHOD(GetSelf)(LONG x, LONG* y);
------CATLSimple.cpp------
STDMETHODIMP CATLSimple::GetSelf(LONG x, LONG* y) {
// TODO: Add your implementation code here
*y=x;
return
S_OK;
------.c in COMPS project------
COM_i.c
COM_p.c
unmanaged: C++ console call C++ dll
C# dll project
C# console project
Managed: C++ calls C#
Unmanaged C++
àDDE
àOLE1.0
àOLE2.0 (COM)
àDCOM
àActiveX
Advantages: CBD, Code Reusability, OOP, Communicate each, Network.
What is metadata
Metadata stored information:
public static extern int LoadLibrary(
[MarshalAs(UnmanagedType.LPStr)] string lpLibFileName);
public static extern IntPtr GetProcAddress(int hModule,
[MarshalAs(UnmanagedType.LPStr)] string lpProcName);
public static extern bool FreeLibrary(int hModule);
Load Dynamically
// function pointer
delegate int Add(int a, int b);
//1. Dynamically load C++ Dll
int hModule = LoadLibrary(AppDomain.CurrentDomain.BaseDirectory + @"CppInterop.dll");
if (hModule == 0) return;
//2. Read function pointer
IntPtr intPtr = GetProcAddress(hModule, "Add");
//3. Encapsulate function pointer to delegate
Add addFunction = (Add)Marshal.GetDelegateForFunctionPointer(intPtr, typeof(Add));
• Load Statically
- COM Interop Presentation comments
- COM interop理论/实践
- COM interop理论/实践
- COM interop理论/实践
- COM Interop入门
- Understanding COM Interop
- Com Interop入门
- Advanced COM Interop
- COM Interop 理论与实践
- COM interop技术理论/实践
- 关于PInvoke 和COM Interop
- Com Interop入门 (转载)
- [转贴]COM Interop 注册相关
- COM Interop 理论与实践
- c# COM Interop 第二部分
- COM Interop遇到的几个问题
- Comments
- Comments
- DataList内容详解
- Longest Repeated Substring
- .Net 自定义应用程序配置
- 窗体间传值练习
- IOS开发网络篇之──ASIHTTPRequest详解
- COM Interop Presentation comments
- 手机短信PDU字符串中用到的7bit加密解密函数
- Win7下使用双屏 显示不同分辨率的桌面
- C#事件小记
- Java 日期时间 Date类型,long类型,String类型表现形式的转换
- MySQL中的排序
- cisco3750堆叠技术
- 在mysql数据库中日期与long型的转化
- Cisco Service的10个子命令