动态调用Dll是会出现一些问题,我还取不到dll中的全局变量呢
解决方案 »
- 有办法区别dll的版本没?
- 怎样枚举出某个外部程序的所有子窗口句柄,通过win32API
- winform程序,在WIN XP下编写,要在WIN2003 X64平台上运行,如何设置配置管理器?
- C#中,静态方法所耗内存会释放吗?
- 泛型的find方法无效?
- Invalidate和Refresh有什么区别?
- 分不多,但是准给分,疑问WA问题
- 隐式加载时机
- toolStripDropDownButton和toolStripDropDownButton有什么区别
- C#是即时编译型语言,能不能在程序一起动就把所有中间代码编译成机器代码呢?
- winform中datagridview纵向合并相同值的单元格的问题
- 欢迎进入
[DllImport("DSStream.dll", EntryPoint = "DSStream_SetOwnerWnd")]
public static extern Int32 DSStream_SetOwnerWnd(int iCardID, int hParentWnd);在C#中调用DSStream_SetOwnerWnd(0,this.Handle.ToInt32());
Byte(unsigned char) System.Byte
SHORT(short) System.Int16
WORD(unsigned short) System.UInt16
INT(int) System.Int16 → System.Int32
UINT(unsigned int) System.UInt16 → System.UInt32
LONG(long) System.Int32
ULONG(unsigned long) System.UInt32
DWORD(unsigned long) System.UInt32
DECIMAL System.Decimal
BOOL(long) System.Boolean
CHAR(char) System.Char
LPSTR(char *) System.String
LPWSTR(wchar_t *) System.String
LPCSTR(const char *) System.String
LPCWSTR(const wchar_t *) System.String
PCAHR(char *) System.String
BSTR System.String
FLOAT(float) System.Single
DOUBLE(double) System.Double
VARIANT System.Object
PBYTE(byte *) System.Byte[]
这是我做的一个项目中定义的不知道能不能帮上忙!!!
//---------------------------------------------
很感谢你贴出这么多类型对应关系!
请问 c++中 bool * 对应C#什么类型?
改成Int类型:
[DllImport("DSStream.dll", EntryPoint = "DSStream_SetOwnerWnd")]
public static extern Int32 DSStream_SetOwnerWnd(int iCardID, int hParentWnd);在C#中调用DSStream_SetOwnerWnd(0,this.Handle.ToInt32());
、、-----------------------------------------------------------
此方法已试用还是不行!急啊!!高人在哪?
不过我一般用int
最好的做法是采用c++混合编程,将本地代码集中到DLL中,而在托管代码中也可以很方便的引用DLL,直接调用里面的函数。
public static extern Int32 DSStream_SetOwnerWnd(int iCardID, int hParentWnd);
看看这样可以吗?HWND 转换成IntPtr是对的
如果还有问题,那么用Marshal.sizeof()比对下参数的长度是否一致,好运!