Results 1 to 4 of 4

Thread: File Name Confusion: ö

  1. #1

    Thread Starter
    PowerPoster
    Join Date
    Jul 2010
    Location
    NYC
    Posts
    7,658

    File Name Confusion: ö

    There is a file on my hard drive that contains the character "ö" - an 'o' with umlauts above it. When the filename enters VB, either cut and pasted into the IDE or any control in my application, or listed in a filelist box, or (the most relevant) read from an IShellFolder name enumeration (with both the SHGDN_INFOLDER flag and the SHGDN_FORPARSING flag) and displayed in a listview, it's split into 2 characters.

    Another weird aspect to this is if it's pasted into a label edit on the listview, it shows as one character until the label edit is complete, THEN splits into 2 characters. And when it's pasted from VB and back into Explorer, it remains as 2 separate characters.

    Now this is causing a major problem, as any operations end with a File Not Found error since it's looking for the 2 character file. It's not just a display issue, it's whenever it enters a VB string, eg:

    orig=pathfrompidl, or orig=isf.GetDisplayNameOf(relativepidl)
    new=orig & "2"
    Name orig As new

    results in file not found.

    What gives?? And how might I go about working around this issue?

    Edit: I considered it might having something to do with Unicode, so I tried the following:

    orig=SHGetPathFromIDListW
    new="a" & orig
    MoveFileWithProgressW(orig,new...)

    But to no avail. MoveFileWithProgress returned 0 (failed), but then GetLastError (API function, according to MSDN's entry on MFWP should return the error code) also returned 0... but I'm assuming it was not found that way either. Sorry for the pseudocode but the main point is I'm moving it directly from the IShellFolder.GetDisplayNameOf or SHGetPathFromIDListW function, appending a single character, then going directly to MoveFile while debugging this-- no controls involved at this point.

    This is what is being passed to MoveFileWithProgressW:
    Last edited by fafalone; Feb 9th, 2012 at 12:19 PM.

  2. #2
    VB-aholic & Lovin' It LaVolpe's Avatar
    Join Date
    Oct 2007
    Location
    Beside Waldo
    Posts
    19,541

    Re: File Name Confusion: ö

    Could you give us your declarations for: SHGetPathFromIDListW & MoveFileWithProgressW
    Insomnia is just a byproduct of, "It can't be done"

    Classics Enthusiast? Here's my 1969 Mustang Mach I Fastback. Her sister '67 Coupe has been adopted

    Newbie? Novice? Bored? Spend a few minutes browsing the FAQ section of the forum.
    Read the HitchHiker's Guide to Getting Help on the Forums.
    Here is the list of TAGs you can use to format your posts
    Here are VB6 Help Files online


    {Alpha Image Control} {Memory Leak FAQ} {Unicode Open/Save Dialog} {Resource Image Viewer/Extractor}
    {VB and DPI Tutorial} {Manifest Creator} {UserControl Button Template} {stdPicture Render Usage}

  3. #3

    Thread Starter
    PowerPoster
    Join Date
    Jul 2010
    Location
    NYC
    Posts
    7,658

    Re: File Name Confusion: ö

    Code:
    Public Declare Function SHGetPathFromIDListW Lib "shell32.dll" (ByVal pidl As Long, ByVal pszPath As Any) As Long
    
    Public Declare Function MoveFileWithProgressW Lib "kernel32.dll" (ByVal lpExistingFileName As String, ByVal lpNewFileName As String, ByVal lpProgressRoutine As Long, lpData As Any, ByVal dwFlags As Long) As Long

  4. #4
    VB-aholic & Lovin' It LaVolpe's Avatar
    Join Date
    Oct 2007
    Location
    Beside Waldo
    Posts
    19,541

    Re: File Name Confusion: ö

    See if this works. Changes in blue
    Code:
    Public Declare Function MoveFileWithProgressW Lib "kernel32.dll" (ByVal lpExistingFileName As Long, ByVal lpNewFileName As Long, ByVal lpProgressRoutine As Long, lpData As Any, ByVal dwFlags As Long) As Long
    
    lReturn = MoveFileWithProgressW(StrPtr(orig), StrPtr(new), ...)
    Insomnia is just a byproduct of, "It can't be done"

    Classics Enthusiast? Here's my 1969 Mustang Mach I Fastback. Her sister '67 Coupe has been adopted

    Newbie? Novice? Bored? Spend a few minutes browsing the FAQ section of the forum.
    Read the HitchHiker's Guide to Getting Help on the Forums.
    Here is the list of TAGs you can use to format your posts
    Here are VB6 Help Files online


    {Alpha Image Control} {Memory Leak FAQ} {Unicode Open/Save Dialog} {Resource Image Viewer/Extractor}
    {VB and DPI Tutorial} {Manifest Creator} {UserControl Button Template} {stdPicture Render Usage}

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