Solved

GetShortPathName API said, "No Entry Point in kernel32.DLL"

Posted on 1998-05-17
2
435 Views
Last Modified: 2012-05-04
What is wrong with this code?

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

Private Sub Form_Load()
Dim strShort As String
Dim nLenShort As Long
nLenShort = 0

    strShort = Space(255)
    ' strShort = String(255," ")

    GetShortPathName "C:\Program Files", strShort, nLenShort
End Sub


This I get an error saying, "No Entry Point in the kernel32.dll".  

I'm running Win95 with IE4.01 and VB5 Enterprise..
0
Comment
Question by:Chizl
2 Comments
 
LVL 4

Accepted Solution

by:
yowkee earned 50 total points
ID: 1452443
  Kernel32.dll contains function GetShortPathNameA (ANSI) and GetShortPathNameW (Unicode), instead of GetShortPathName. Thus, you should declare the function as:

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

'Then,

Private Sub Form_Load()
   
    Dim lRtn As Long
    Dim sShort As String * 256
   
    lRtn = GetShortPathName("C:\Program Files\", sShort, 256)
    MsgBox sShort
End Sub

0
 
LVL 4

Author Comment

by:Chizl
ID: 1452444
Thanx
0

Featured Post

3 Use Cases for Connected Systems

Our Dev teams are like yours. They’re continually cranking out code for new features/bugs fixes, testing, deploying, testing some more, responding to production monitoring events and more. It’s complex. So, we thought you’d like to see what’s working for us.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Introduction I needed to skip over some file processing within a For...Next loop in some old production code and wished that VB (classic) had a statement that would drop down to the end of the current iteration, bypassing the statements that were c…
Most everyone who has done any programming in VB6 knows that you can do something in code like Debug.Print MyVar and that when the program runs from the IDE, the value of MyVar will be displayed in the Immediate Window. Less well known is Debug.Asse…
Get people started with the utilization of class modules. Class modules can be a powerful tool in Microsoft Access. They allow you to create self-contained objects that encapsulate functionality. They can easily hide the complexity of a process from…
This lesson covers basic error handling code in Microsoft Excel using VBA. This is the first lesson in a 3-part series that uses code to loop through an Excel spreadsheet in VBA and then fix errors, taking advantage of error handling code. This l…

810 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question