Hello, Amjad:
Here is an example written in two minutes:
class chema_gspn
declare auto function GetShortPathName lib "kernel32" (byval lpszLongPath as string, byval lpszShortPath as string, byval cchBuffer as integer) as integer
public shared sub Main()
dim result as new string(" "c,260) 'Needs to contain something.
call getshortpathname("C:\Documents and Settings\Chema\Mis documentos\Mis archivos recibidos", result, microsoft.visualbasic.len(result))
system.console.writeline(result.substring(0,result.indexof(char.minvalue))) 'Only get string until chr(0) found.
system.console.readline
end sub
end class
It's not perfect: "len" returns the number of characters, not the number of bytes, wich is what we need...; it has no error checking...; (put your own objections here)...
Regards.
"Amjad" <
[email protected]> escribió en el mensaje Thanks. You were right about the reason of why I'd need
the short path naming scheme in my program.
However, I tried the "GetShortPathName" function and VB
said it's not declared. How do I declare it?
Do you have a sample code on how to use this function in
VB .NET?
I'm trying to avoid using FileSystemObject option. I'm
looking for a simple string manipulation solution.
Amjad