|
-
Feb 9th, 2012, 10:10 AM
#1
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.
-
Feb 9th, 2012, 12:18 PM
#2
Re: File Name Confusion: ö
Could you give us your declarations for: SHGetPathFromIDListW & MoveFileWithProgressW
-
Feb 9th, 2012, 12:20 PM
#3
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
-
Feb 9th, 2012, 12:35 PM
#4
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), ...)
Posting Permissions
- You may not post new threads
- You may not post replies
- You may not post attachments
- You may not edit your posts
-
Forum Rules
|
Click Here to Expand Forum to Full Width
|