为什么相同的字符串有时表现不同? (VB.NET COM接口)
示例:
Dim Sh32 As Object = CreateObject("Shell.Application")
Dim path As String = "C:\temp\catalog.zip"
Dim sf As Object = Sh32.NameSpace(path)
->不起作用,sf = Nothing
Dim Sh32 As Object = CreateObject("Shell.Application")
Dim path As String = "C:\temp\catalog.zip"
Dim sf As Object = Sh32.NameSpace(path.ToString)
->有效
有什么想法吗?
显然,path = path.ToString,但是当用作 COM 参数时,它们的行为有所不同。
Example:
Dim Sh32 As Object = CreateObject("Shell.Application")
Dim path As String = "C:\temp\catalog.zip"
Dim sf As Object = Sh32.NameSpace(path)
-> does not work, sf = Nothing
Dim Sh32 As Object = CreateObject("Shell.Application")
Dim path As String = "C:\temp\catalog.zip"
Dim sf As Object = Sh32.NameSpace(path.ToString)
-> works
Any idea?
Clearly path = path.ToString, but they behave differently when used as COM parameters.
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(1)
嗯,我不太了解 VB 和/或 COM 的细节,但也许字符串对象和字符串表示之间有区别?
看到有人“知情”解决这个难题应该很有趣;)
Hmm, I don't know the details of VB and/or COM well enough, but maybe there is a difference between a string object and a string representation?
Should be interesting to see someone "in the know" resolving the puzzle ;)