I now have a complete project, and I wish to turn from ANSI to UNICODE.
I need expert at here to help me complete it!
Below is the link to the project!
http://vbnet.mvps.org/index.html?cod...angenotify.htm
Printable View
I now have a complete project, and I wish to turn from ANSI to UNICODE.
I need expert at here to help me complete it!
Below is the link to the project!
http://vbnet.mvps.org/index.html?cod...angenotify.htm
Anyone help me please? I have no idea about the unicode...
You need to give us more information about exactly what you need to do before you have any chance of help...we're not spiritualists, we need info before we can give any back
Actually is I'm having the problem to show the chinese file name under the project. The chinese file name always shows me '????' in the list. I don't know how to convert to UNICODE.
For example:
C:\Test\腳本.txt
The project shows me:
C:\Test\??.txt
If it's a listbox, you need a unicode-friendly lisbox (one which displays unicode data as unicode)...search the forum and I'm sure you'll find something, or wait and someone who knows better than me will help now we know what is needed
Inside the project, I know there is a way to declare the UNICODE function, SHGetFileInfoW and SHGetPathFromIDListW.
But I don't know how to use those 2 functions. So I need someone help me convert the original SHGetFileInfoA and SHGetPathFromIDListA to UNICODE version(SHGetFileInfoW and SHGetPathFromIDListW) and make it shows the correct Chinese file name inside the textbox.
You can't show unicode chars in a standard vb Control, and thats including a textbox.Quote:
and make it shows the correct Chinese file name inside the textbox.
You will need custom controls which support UniCode.
Search the forum for UniCode aware button, labels etc...
Here is the project with an Unicode aware textbox included. I haven't done anything to the code though, mostly just pasted it in, so you'll see the same results.
Maybe gets someone else started with it...
Merri, thanksfor your concern about my UNICODE problem. I've tested your project, but I still getting the same problem with it.
I think the main problem is about the SHGetFileInfoA and SHGetPathFromIDListA. I hope someone can help me switch to SHGetFileInfoW and SHGetPathFromIDListW.
Merri, please see the attachment for the picture that I captured from my PC. The screen shot is using your modifed project with the UNITEXT control and I still facing the same problem.
i think for unicode you would need SHGetFileInfoW function
but that may be a misunderstanding
Yes, you are right! But I don't know how to declare the SHGetFileInfoW and SHGetPathFromIDListW. And I also don't know how to use both of those 2 functions.Quote:
Originally Posted by westconn1
If using the ANSI version(SHGetFileInfoA and SHGetPathFromIDListA), I found that it always return ?? if the filename is other than english character.
So, I think it would not be the UNICODE control(text box) problem.
Hope someone can help me:cry: :cry:
i found this
here http://www.com.it-berater.org/COM/wi..._functions.htmQuote:
DECLARE FUNCTION SHGetFileInfo _
LIB "SHELL32.DLL" _
ALIAS "SHGetFileInfoA" ( _
BYREF pszPath AS ASCIIZ, _
BYVAL dwFileAttributes AS DWORD, _
BYREF psfi AS SHFILEINFO, _
BYVAL cbFileInfo AS DWORD, _
BYVAL uFlags AS DWORD _
) AS DWORD
DECLARE FUNCTION SHGetFileInfoW _
LIB "SHELL32.DLL" _
ALIAS "SHGetFileInfoW" ( _
BYVAL pszPath AS DWORD, _
BYVAL dwFileAttributes AS DWORD, _
BYREF psfi AS SHFILEINFOW, _
BYVAL cbFileInfo AS DWORD, _
BYVAL uFlags AS DWORD _
) AS DWORD
If I was to *GUESS* were the error is in the code, it would be to do with the way you're dealing with the filename now...obviously unicode displaying isn't the issue because the folder name is coming through fine (see "item path") so it's something to do with how the data is being handled before being displayed.
Try converting using VB's own Convert() function, although I don't know whether you want vbUnicode or FromUnicode, you'll have to work that one out :-)
StrConv not needed. Just use the Wide API calls and dereference the pointer to Unicode string. Updated demo attached.
StrConv() doesn't help in my case. Before I post here, I've tried the StrConv() function already.Quote:
Originally Posted by smUX
DrUnicode, you are GREAT!!!!:)Quote:
Originally Posted by DrUnicode
This is exactly what I want!
If only use the SHGetFileInfoW and SHGetPathFromIDListW also cannot show the correct filename in the normal ANSI control. It must use together with the UNICODE control to show the correct filename too.
And finally thanks to DrUnicode and Merri for the code and Unicode Control. And also the people try to help me and give me idea on how to solve the problem too! Thanks!:thumb: ;)
Did you try Zip are Post #14?
Oops. our messages crossed. Ignore this.
Yup, I've tested your code with the "W" version of those 2 functions!Quote:
Originally Posted by DrUnicode
The screen shot is based on your modified project with "W" version!
Thank you very much!!:) :)