Oct
4
1 VB.Net中实现VB6中的App.hInstance
1 VB.Net中实现VB6中的App.hInstance
by sandy_zc_1
FM,借个地方,呵呵
VB.Net中实现VB6中的App.hInstance
查了半天,终于找到了一个可用的方法,.Net真是麻烦啊。
先
Imports System.Runtime.InteropServices
然后定义
Dim hInstance as IntPtr
再定义
Dim mdl() As System.Reflection.Module = System.Reflection.Assembly.GetExecutingAssembly.GetModules
最后
hInstance=Marshal.GetHINSTANCE(mdl(0))
如果要传API的话,还得把IntPtr转Int32
Dim hInstance32 as Int32 =hIsntance.ToInt32
这段时间搞.Net,感触真多啊,感觉M$为了做跨平台,把.Net搞的太脱离Win32了,结果现在跨平台没有进展多少,Win32编程倒是麻烦了不少。不爽啊。
作者: 58.49.113.* 2007-10-4 02:05 回复此发言
--------------------------------------------------------------------------------
2 回复:VB.Net中实现VB6中的App.hInstance
才想谁会在我的地盘发这种东西。。汗
作者: Felix021 2007-10-4 03:00 回复此发言
--------------------------------------------------------------------------------
转载请注明出自 ,如是转载文则注明原出处,谢谢:)
RSS订阅地址: https://www.felix021.com/blog/feed.php 。
by sandy_zc_1
FM,借个地方,呵呵
VB.Net中实现VB6中的App.hInstance
查了半天,终于找到了一个可用的方法,.Net真是麻烦啊。
先
Imports System.Runtime.InteropServices
然后定义
Dim hInstance as IntPtr
再定义
Dim mdl() As System.Reflection.Module = System.Reflection.Assembly.GetExecutingAssembly.GetModules
最后
hInstance=Marshal.GetHINSTANCE(mdl(0))
如果要传API的话,还得把IntPtr转Int32
Dim hInstance32 as Int32 =hIsntance.ToInt32
这段时间搞.Net,感触真多啊,感觉M$为了做跨平台,把.Net搞的太脱离Win32了,结果现在跨平台没有进展多少,Win32编程倒是麻烦了不少。不爽啊。
作者: 58.49.113.* 2007-10-4 02:05 回复此发言
--------------------------------------------------------------------------------
2 回复:VB.Net中实现VB6中的App.hInstance
才想谁会在我的地盘发这种东西。。汗
作者: Felix021 2007-10-4 03:00 回复此发言
--------------------------------------------------------------------------------
欢迎扫码关注:
转载请注明出自 ,如是转载文则注明原出处,谢谢:)
RSS订阅地址: https://www.felix021.com/blog/feed.php 。