Page 1 of 1

IShellLinkA and IShellLinkW unicode

Posted: Sat Nov 04, 2006 5:50 pm
by Rescator
http://www.purebasic.fr/english/viewtopic.php?t=8668

Was testing that code, and since I by default have unicode enabled on new sources that example failed at once.
Turning off unicode and it works.

Now... trying to make it work with unicode is a pain
as all the unicode/ansi stuff has to be reversed manually.
I'm also curious as to why there is still a IShellLinkA and IShellLinkW
Should this not be simply IShellLink now and automatic A and W like most other structures?

*scratches head*

Posted: Sat Nov 04, 2006 7:32 pm
by freak
Unlike the WinAPI in general, COM is by design unicode only. Thats why PB does not
do any automatic substitution of unicode/ansi commands.
The fact that this Interface is provided in an ansi and unicode version is very
rare.

You will have to do this manually.

Btw, the IShellLinkA and W are the exact same in PB, so you just have to
swap the IID value and remove the unicode-conversion for the IPersistFile:Save
and it will work again.

Posted: Thu Nov 09, 2006 4:01 am
by Rescator
"Fixed" for those interested: http://www.purebasic.fr/english/viewtopic.php?t=24533

PS! I still think it should just be IShellLink
and let PB itself handle IShellLinkA and IShellLinkW like it does with other unicode stuff these days.

No idea what Microsoft docs say on this though, might be a reason why Fred left it like this?

Posted: Thu Nov 09, 2006 5:53 pm
by freak
Rescator wrote:PS! I still think it should just be IShellLink
and let PB itself handle IShellLinkA and IShellLinkW like it does with other unicode stuff these days.
Why should we go through the trouble for just this one interface !?
A I said, COM is per design unicode only. It makes no sense to add automatic switches there.

This Interface is Microsofts stupid design decision, not ours... ;)

Posted: Thu Nov 09, 2006 5:55 pm
by Rescator
Point taken. Yeah it's very weird. when searchig google I found there is a few more com interfaces that is like this one.. *shakes head* I always hated COM btw heh :)