IShellLinkA and IShellLinkW unicode

Windows specific forum
User avatar
Rescator
Addict
Addict
Posts: 1769
Joined: Sat Feb 19, 2005 5:05 pm
Location: Norway

IShellLinkA and IShellLinkW unicode

Post 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*
freak
PureBasic Team
PureBasic Team
Posts: 5948
Joined: Fri Apr 25, 2003 5:21 pm
Location: Germany

Post 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.
quidquid Latine dictum sit altum videtur
User avatar
Rescator
Addict
Addict
Posts: 1769
Joined: Sat Feb 19, 2005 5:05 pm
Location: Norway

Post 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?
Last edited by Rescator on Thu Nov 09, 2006 4:05 am, edited 1 time in total.
freak
PureBasic Team
PureBasic Team
Posts: 5948
Joined: Fri Apr 25, 2003 5:21 pm
Location: Germany

Post 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... ;)
quidquid Latine dictum sit altum videtur
User avatar
Rescator
Addict
Addict
Posts: 1769
Joined: Sat Feb 19, 2005 5:05 pm
Location: Norway

Post 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 :)
Post Reply