GetShortPathName 
Author Message
 GetShortPathName

Marios,
Quote:
>there must be something fundamental that I am missing. Anyone knows?

Yes on both counts ;-)
You need to use the Alias.  That is what it is known as within kernel32.
Private Declare Function GetShortPathName& Lib "kernel32" _
Alias "GetShortPathNameA" _
(ByVal lpszLongPath As String, ByVal lpszShortPath As String, ByVal
cchBuffer As Long)
NN
Quote:

>I am trying to get the "DOS" path directory of a file. I do have the
>win-32 file name but I would like to get the "8.3" path. I have
>included the GetShortPathName using the API add-in. as below. However,
>when a call is made i get the following error:

>"Can't find DLL entry point GetShortFileName in kernel32".

>I know that kernel32 is in the windows directory (after all, it is not
>as if it can't find the dll). Other calls to the dll are successful.
>This fails in win-95 and win-98 (two different machines), so I guess
>there must be something fundamental that I am missing. Anyone knows?

>- dll function declaration

>Declare Function GetShortPathName Lib "kernel32" (ByVal lpszLongPath
>As String, ByVal lpszShortPath As String, ByVal cchBuffer As Long) As
>Long

>Many thanks

>Marios



Fri, 02 Feb 2001 03:00:00 GMT  
 GetShortPathName
I am trying to get the "DOS" path directory of a file. I do have the
win-32 file name but I would like to get the "8.3" path. I have
included the GetShortPathName using the API add-in. as below. However,
when a call is made i get the following error:

"Can't find DLL entry point GetShortFileName in kernel32".

I know that kernel32 is in the windows directory (after all, it is not
as if it can't find the dll). Other calls to the dll are successful.
This fails in win-95 and win-98 (two different machines), so I guess
there must be something fundamental that I am missing. Anyone knows?

- dll function declaration

Declare Function GetShortPathName Lib "kernel32" (ByVal lpszLongPath
As String, ByVal lpszShortPath As String, ByVal cchBuffer As Long) As
Long

Many thanks

Marios



Sat, 03 Feb 2001 03:00:00 GMT  
 GetShortPathName
Don't know if this is just a typo in your posting, but I noticed that
the error message refers to GetShortFileName, and the declaration to
GetShortPathName.

Roy Lewallen

Quote:

> I am trying to get the "DOS" path directory of a file. I do have the
> win-32 file name but I would like to get the "8.3" path. I have
> included the GetShortPathName using the API add-in. as below. However,
> when a call is made i get the following error:

> "Can't find DLL entry point GetShortFileName in kernel32".

> I know that kernel32 is in the windows directory (after all, it is not
> as if it can't find the dll). Other calls to the dll are successful.
> This fails in win-95 and win-98 (two different machines), so I guess
> there must be something fundamental that I am missing. Anyone knows?

> - dll function declaration

> Declare Function GetShortPathName Lib "kernel32" (ByVal lpszLongPath
> As String, ByVal lpszShortPath As String, ByVal cchBuffer As Long) As
> Long

> Many thanks

> Marios



Sat, 03 Feb 2001 03:00:00 GMT  
 GetShortPathName
This might work better:

Declare Function GetShortPathName Lib "kernel32" Alias
"GetShortPathName" (ByVal lpszLongPath As String, ByVal lpszShortPath As
String, ByVal cchBuffer As Long) As Long

/henrik

Quote:

> I am trying to get the "DOS" path directory of a file. I do have the
> win-32 file name but I would like to get the "8.3" path. I have
> included the GetShortPathName using the API add-in. as below. However,
> when a call is made i get the following error:

> "Can't find DLL entry point GetShortFileName in kernel32".

> I know that kernel32 is in the windows directory (after all, it is not
> as if it can't find the dll). Other calls to the dll are successful.
> This fails in win-95 and win-98 (two different machines), so I guess
> there must be something fundamental that I am missing. Anyone knows?

> - dll function declaration

> Declare Function GetShortPathName Lib "kernel32" (ByVal lpszLongPath
> As String, ByVal lpszShortPath As String, ByVal cchBuffer As Long) As
> Long

> Many thanks

> Marios



Sat, 03 Feb 2001 03:00:00 GMT  
 GetShortPathName
Your response is exactly what I needed but I can't seem to make it
work.  I think I'm having trouble with the arguments to the function.
I don't get any errors but I don't get a valid response from the
function either.  This is what I did:

Declare Function GetShortPathName Lib _
    "kernel32" Alias "GetShortPathNameA" _
    (ByVal lpszLongPath As String, _
     ByVal lpszShortPath As String, _
     ByVal cchBuffer As Long) As Long

Public sub test()

        Dim lcchbuffer As Long
        Dim intresponse As Long
        Dim strLocLong As String
        Dim strLocShort As String

        strLocLong = "C:\Program Files\MicroSoft"

        intresponse = GetShortPathName(strAutoCADLocation, _
                strACADLocShort, lcchbuffer)

        msgbox strLocLong
        msgbox strLocShort

End Sub

My second message box always comes up blank.  Any ideas?



Sat, 03 Feb 2001 03:00:00 GMT  
 GetShortPathName
Found the answer on Microsoft's Support Page.

This is what I did:

Declare Function GetShortPathName Lib _
    "kernel32" Alias "GetShortPathNameA" _
    (ByVal lpszLongPath As String, _
     ByVal lpszShortPath As String, _
     ByVal cchBuffer As Long) As Long

Public sub test()

        Dim lcchbuffer As Long
        Dim intresponse As Long
        Dim strLocLong As String
        Dim strLocShort As String

        strLocLong = "C:\Program Files\MicroSoft"

'NEED TO DO THIS:
strLocShort=space(255)
lcchbuffer=len(strLocShort)
'NOW IT WILL WORK

        intresponse = GetShortPathName(strAutoCADLocation, _
                strACADLocShort, lcchbuffer)

        msgbox strLocLong
        msgbox strLocShort

End Sub



Sat, 03 Feb 2001 03:00:00 GMT  
 GetShortPathName
Thanks all for the GetShortPathName and GetShortFileName. Unfortunately,
where ever i put the code, i get error messages.

My best guess i need to add some line somewhere to let the program know it
will use kernel32.dll, however, i cannot find it in the help files (probably
because i really don't know what to look for...), and don't understand what
happens in the calldll sample.

(Do i have to add a .bas module?)

So if anyone could tell me how, i'd be very pleased.

tnx,

Peter



Sat, 03 Feb 2001 03:00:00 GMT  
 
 [ 8 post ] 

 Relevant Pages 

1. Function GetShortPathName(...) in VBA

2. GetShortPathName API

3. GetShortPathName not work under NT?

4. GetShortPathName

5. GetShortPathName

6. GetShortPathName problems

7. ANSWER/API MISPRINT: Generic Thunking of GetShortPathName

8. API GetShortPathName BUG or WHAT??????????????????????????

9. Function GetShortPathName(...) in VBA

10. API GetShortPathName BUG or WHAT??????????????????????????

11. GetShortPathName Problem

12. GetShortPathName / File Exist routine

 

 
Powered by phpBB® Forum Software