COM Interop P/Invoke
sukhoeing
这个作者很懒,什么都没留下…
展开
-
BE.P/Invoke.net addin for visual studio
BE.pinvoke is the PINVOKE.NET Add-In for Visual Studio 2005. I failed getting the old PINVOKE Add-In to work with VS 2005, so i wrote my own from the scratch. The UI looks very similar to original PI原创 2007-06-23 20:04:00 · 893 阅读 · 0 评论 -
VB 2005 中用P/Invoke进行windows HOOK 的方法
Imports System.Runtime.InteropServicesPublic Class Form1Class Form1 Private Structure MOUSEHOOKSTRUCTStructure MOUSEHOOKSTRUCT Public pt As Point Public hWnd As IntPtr Public hitTest As In转载 2007-06-29 15:53:00 · 1054 阅读 · 0 评论 -
_TypePtr error
After importing a managed classs tlb in an unmanaged C++ application, youve a good chance to get several compling errors about _TypePtr.To work around this issue, You’ll need to add the path to ms原创 2007-07-13 10:28:00 · 1101 阅读 · 0 评论 -
如何在托管环境下释放COM对象
Shanny同学介绍了DataGridView数据导出到Excel的几个方法,其中讲到的使用Microsoft.Office.Core.dll即Microsoft Office 11.0 Object Library.代码大概如下:private void ExecuteTransfer(){ ApplicationClass app; try { app = new Application转载 2007-07-23 17:00:00 · 3840 阅读 · 3 评论 -
Getting IErrorInfo part of com error in Managed Code
有个客户问了如下的问题:How to Getting IErrorInfo part of com error in Managed Code?经过一番调查发现,在托管应用程序中,如果想要得到IErrorInfo中成员函数所对应的信息,就必须从产生的异常的字段中取得相应的信息。在MSDN的这个地方有详细的描述: How to: Map HRESULTs and Exceptions原创 2007-09-11 14:49:00 · 799 阅读 · 0 评论 -
P/Invoke传递的callback中会用到的一个很有用的属性
就像这个帖子中提到的,如果要调用C/C++ dll export出来的一个函数,并且要传一个callback的delegate进去,就会产生一个问题: delegate默认的函数调用约定是stdcall,但是C++端一般会要求这个callback是cdecl的。这个问题在.net 1.1中没有好的解决方法,只能反汇编你的assembly然后手动修改对应delegate的属性。 在.net 2.原创 2007-11-17 23:43:00 · 1196 阅读 · 0 评论 -
如何得知一个__ComObject对象的实际类型
在使用Com Interop的时候(像VS Macro和VSTO)的时候,一个函数的返回值往往在Debugger中显示为System.__ComObject。这个时候就可以使用Microsoft.VisualBasic.Information.TypeName(object VarName)来查询其实际的类型,这个函数内部调用了IDisPatch的 GetTypeInfo函数和ITypeInfo.原创 2007-12-25 21:31:00 · 2664 阅读 · 0 评论