以文本方式查看主题 - Foxtable(狐表) (http://www.foxtable.com/bbs/index.asp) -- 专家坐堂 (http://www.foxtable.com/bbs/list.asp?boardid=2) ---- [求助]帮忙改改这段内容 谢谢 (http://www.foxtable.com/bbs/dispbbs.asp?boardid=2&id=86332) |
-- 作者:jiskin -- 发布时间:2016/6/15 15:28:00 -- [求助]帮忙改改这段内容 谢谢 Dim extsubkey = Registry.ClassesRoot.OpenSubKey(".xls") \'从注册表中读取扩展名相应的子键 If extsubkey IsNot Nothing Then Dim extdefaultvalue = DirectCast(extsubkey.GetValue(Nothing), String) \'取出扩展名对应的文件类型名称 Dim typesubkey = Registry.ClassesRoot.OpenSubKey(extdefaultvalue) \'从注册表中读取文件类型名称的相应子键 If typesubkey IsNot Nothing Then Dim description = DirectCast(typesubkey.GetValue(Nothing), String) \'得到类型描述字符串 Dim defaulticonsubkey = typesubkey.OpenSubKey("DefaultIcon") \'取默认图标子键 If defaulticonsubkey IsNot Nothing Then \'得到图标来源字符串 Dim defaulticon = DirectCast(defaulticonsubkey.GetValue(Nothing), String) \'取出默认图标来源字符串 Dim iconstringArray = defaulticon.Split(","C) Dim nIconIndex As Integer = 0 If iconstringArray.Length > 1 Then Integer.TryParse(iconstringArray(1), nIconIndex) End If \'得到图标 Dim phiconLarge As new System.IntPtr Dim phiconSmall As new System.IntPtr ExtractIconExW(iconstringArray(0).Trim(""""C), nIconIndex, phiconLarge, phiconSmall, 1) Dim icon As icon = Icon.FromHandle(phiconLarge) Dim fileStream As new System.IO.FileStream("c:\\test.ico", System.IO.FileMode.Create) icon.Save(fileStream) fileStream.Close() End If End If End If 请问这段内容如何才能在FT里运行
|
-- 作者:大红袍 -- 发布时间:2016/6/15 15:45:00 -- 参考
http://www.foxtable.com/bbs/dispbbs.asp?BoardID=2&ID=56054&skin=0
|
-- 作者:jiskin -- 发布时间:2016/6/15 15:53:00 -- 谢谢 |
-- 作者:jiskin -- 发布时间:2016/6/15 16:59:00 -- 以下是引用大红袍在2016/6/15 15:45:00的发言:
参考
http://www.foxtable.com/bbs/dispbbs.asp?BoardID=2&ID=56054&skin=0
老板,不知为何,其他后缀的都可以生成,就“.exe”的后缀会报错 传递给ICON的win32的句柄无效或者类型错误 怎么破? |
-- 作者:大红袍 -- 发布时间:2016/6/15 17:02:00 -- 哪有.exe的图标不可能获取,获取后的到的你希望是什么? |
-- 作者:大红袍 -- 发布时间:2016/6/15 17:04:00 -- 直接这样写不行?
Dim icon As Icon = System.Drawing.Icon.ExtractAssociatedIcon(ApplicationPath & "foxtable.exe") \'直接使用icon
|
-- 作者:jiskin -- 发布时间:2016/6/15 17:08:00 -- 以下是引用大红袍在2016/6/15 17:02:00的发言:
哪有.exe的图标不可能获取,获取后的到的你希望是什么?
Dim ico As Icon = System.Drawing.Icon.ExtractAssociatedIcon(dr("执行文件")) 原本用这个方法获取图标的,但是实际使用中 当执行文件的路径是UNC的网络路径时就报错了,有没有办法破? |
-- 作者:大红袍 -- 发布时间:2016/6/15 17:11:00 -- 以下是引用jiskin在2016/6/15 17:08:00的发言:
Dim ico As Icon = System.Drawing.Icon.ExtractAssociatedIcon(dr("执行文件")) 原本用这个方法获取图标的,但是实际使用中 当执行文件的路径是UNC的网络路径时就报错了,有没有办法破?
方法一:如果是.exe后缀的,你固定式某个图标就好。
方法二:你可以把东西先下载下来,然后再指定路径获取。 |
-- 作者:jiskin -- 发布时间:2016/6/15 17:14:00 -- 以下是引用大红袍在2016/6/15 17:11:00的发言:
方法一:如果是.exe后缀的,你固定式某个图标就好。
方法二:你可以把东西先下载下来,然后再指定路径获取。
好吧…… |