Results 1 to 18 of 18

Thread: [RESOLVED] Help for UNICODE problem!

  1. #1

    Thread Starter
    Junior Member
    Join Date
    Sep 2008
    Posts
    26

    Resolved [RESOLVED] Help for UNICODE problem!

    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

  2. #2

    Thread Starter
    Junior Member
    Join Date
    Sep 2008
    Posts
    26

    Re: Help for UNICODE problem!

    Anyone help me please? I have no idea about the unicode...

  3. #3
    PowerPoster
    Join Date
    May 2006
    Location
    Location, location!
    Posts
    2,673

    Re: Help for UNICODE problem!

    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
    Well, everyone else has been doing it :-)
    Loading a file into memory QUICKLY - Using SendKeys - HyperLabel - A highly customisable label replacement - Using resource files/DLLs with VB - Adding GZip to your projects
    Expect more to come in future
    If I have helped you, RATE ME! :-)

    I love helping noobs with their VB problems (probably because, as an amateur programmer, I am only slightly better at VB than them :-)) but if you SERIOUSLY want to get help for free from a community such as VBForums, you have to first have a grounding (basic knowledge) in VB6, otherwise you're way too much work to help...You've got to give a little if you want to get help from us, in other words!

    And we DON'T do your homework. If your tutor doesn't teach you enough to help you make the project without his or her help, FIND A BETTER TUTOR or try reading books on programming! We are happy to help with minor things regarding the project, but you have to understand the rest of it if you want our help to be useful.

  4. #4

    Thread Starter
    Junior Member
    Join Date
    Sep 2008
    Posts
    26

    Re: Help for UNICODE problem!

    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

  5. #5
    PowerPoster
    Join Date
    May 2006
    Location
    Location, location!
    Posts
    2,673

    Re: Help for UNICODE problem!

    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
    Well, everyone else has been doing it :-)
    Loading a file into memory QUICKLY - Using SendKeys - HyperLabel - A highly customisable label replacement - Using resource files/DLLs with VB - Adding GZip to your projects
    Expect more to come in future
    If I have helped you, RATE ME! :-)

    I love helping noobs with their VB problems (probably because, as an amateur programmer, I am only slightly better at VB than them :-)) but if you SERIOUSLY want to get help for free from a community such as VBForums, you have to first have a grounding (basic knowledge) in VB6, otherwise you're way too much work to help...You've got to give a little if you want to get help from us, in other words!

    And we DON'T do your homework. If your tutor doesn't teach you enough to help you make the project without his or her help, FIND A BETTER TUTOR or try reading books on programming! We are happy to help with minor things regarding the project, but you have to understand the rest of it if you want our help to be useful.

  6. #6

    Thread Starter
    Junior Member
    Join Date
    Sep 2008
    Posts
    26

    Re: Help for UNICODE problem!

    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.

  7. #7
    Frenzied Member some1uk03's Avatar
    Join Date
    Jun 2006
    Location
    London, UK
    Posts
    1,675

    Re: Help for UNICODE problem!

    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.

    You will need custom controls which support UniCode.

    Search the forum for UniCode aware button, labels etc...
    _____________________________________________________________________

    ----If this post has helped you. Please take time to Rate it.
    ----If you've solved your problem, then please mark it as RESOLVED from Thread Tools.



  8. #8
    VB6, XHTML & CSS hobbyist Merri's Avatar
    Join Date
    Oct 2002
    Location
    Finland
    Posts
    6,654

    Re: Help for UNICODE problem!

    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...
    Attached Files Attached Files

  9. #9

    Thread Starter
    Junior Member
    Join Date
    Sep 2008
    Posts
    26

    Re: Help for UNICODE problem!

    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.
    Attached Images Attached Images  

  10. #10
    PowerPoster
    Join Date
    Dec 2004
    Posts
    25,618

    Re: Help for UNICODE problem!

    i think for unicode you would need SHGetFileInfoW function
    but that may be a misunderstanding
    i do my best to test code works before i post it, but sometimes am unable to do so for some reason, and usually say so if this is the case.
    Note code snippets posted are just that and do not include error handling that is required in real world applications, but avoid On Error Resume Next

    dim all variables as required as often i have done so elsewhere in my code but only posted the relevant part

    come back and mark your original post as resolved if your problem is fixed
    pete

  11. #11

    Thread Starter
    Junior Member
    Join Date
    Sep 2008
    Posts
    26

    Re: Help for UNICODE problem!

    Quote Originally Posted by westconn1
    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.

    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

  12. #12
    PowerPoster
    Join Date
    Dec 2004
    Posts
    25,618

    Re: Help for UNICODE problem!

    i found this
    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
    here http://www.com.it-berater.org/COM/wi..._functions.htm
    i do my best to test code works before i post it, but sometimes am unable to do so for some reason, and usually say so if this is the case.
    Note code snippets posted are just that and do not include error handling that is required in real world applications, but avoid On Error Resume Next

    dim all variables as required as often i have done so elsewhere in my code but only posted the relevant part

    come back and mark your original post as resolved if your problem is fixed
    pete

  13. #13
    PowerPoster
    Join Date
    May 2006
    Location
    Location, location!
    Posts
    2,673

    Re: Help for UNICODE problem!

    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 :-)
    Well, everyone else has been doing it :-)
    Loading a file into memory QUICKLY - Using SendKeys - HyperLabel - A highly customisable label replacement - Using resource files/DLLs with VB - Adding GZip to your projects
    Expect more to come in future
    If I have helped you, RATE ME! :-)

    I love helping noobs with their VB problems (probably because, as an amateur programmer, I am only slightly better at VB than them :-)) but if you SERIOUSLY want to get help for free from a community such as VBForums, you have to first have a grounding (basic knowledge) in VB6, otherwise you're way too much work to help...You've got to give a little if you want to get help from us, in other words!

    And we DON'T do your homework. If your tutor doesn't teach you enough to help you make the project without his or her help, FIND A BETTER TUTOR or try reading books on programming! We are happy to help with minor things regarding the project, but you have to understand the rest of it if you want our help to be useful.

  14. #14
    Fanatic Member DrUnicode's Avatar
    Join Date
    Mar 2008
    Location
    Natal, Brazil
    Posts
    631

    Re: Help for UNICODE problem!

    StrConv not needed. Just use the Wide API calls and dereference the pointer to Unicode string. Updated demo attached.
    Attached Files Attached Files

  15. #15

    Thread Starter
    Junior Member
    Join Date
    Sep 2008
    Posts
    26

    Re: Help for UNICODE problem!

    Quote Originally Posted by smUX
    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() doesn't help in my case. Before I post here, I've tried the StrConv() function already.

  16. #16

    Thread Starter
    Junior Member
    Join Date
    Sep 2008
    Posts
    26

    Re: Help for UNICODE problem!

    Quote Originally Posted by DrUnicode
    StrConv not needed. Just use the Wide API calls and dereference the pointer to Unicode string. Updated demo attached.
    DrUnicode, you are GREAT!!!!
    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!
    Attached Images Attached Images  

  17. #17
    Fanatic Member DrUnicode's Avatar
    Join Date
    Mar 2008
    Location
    Natal, Brazil
    Posts
    631

    Re: Help for UNICODE problem!

    Did you try Zip are Post #14?
    Oops. our messages crossed. Ignore this.

  18. #18

    Thread Starter
    Junior Member
    Join Date
    Sep 2008
    Posts
    26

    Re: Help for UNICODE problem!

    Quote Originally Posted by DrUnicode
    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!
    The screen shot is based on your modified project with "W" version!

    Thank you very much!!

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  



Click Here to Expand Forum to Full Width