Oct 4

1 VB.Net中实现VB6中的App.hInstance   不指定

felix021 @ 2007-10-4 02:05 [IT » 程序设计] 评论(0) , 引用(0) , 阅读(5556) | Via 本站原创 | |
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
发表评论
表情
emotemotemotemotemot
emotemotemotemotemot
emotemotemotemotemot
emotemotemotemotemot
emotemotemotemotemot
打开HTML
打开UBB
打开表情
隐藏
记住我
昵称   密码   *非必须
网址   电邮   [注册]