开发者

Why do equal strings sometimes behave differently? (VB.NET COM interface)

开发者 https://www.devze.com 2022-12-15 16:12 出处:网络
Example: Dim Sh32 As Object = CreateObject(\"Shell.Application\") Dim path As String = \"C:\\temp\\catalog.zip\"

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.T开发者_开发技巧oString)

-> works

Any idea?

Clearly path = path.ToString, but they behave differently when used as COM parameters.


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 ;)

0

精彩评论

暂无评论...
验证码 换一张
取 消