Attribute VB_Name = "ModGDIPlusPath"
Private Declare Function GetModuleFileName Lib "kernel32" Alias "GetModuleFileNameA" _
    (ByVal hModule As Long, ByVal lpFileName As String, ByVal nSize As Long) As Long

Private Declare Function GetModuleHandle Lib "kernel32" Alias "GetModuleHandleA" _
    (ByVal lpModuleName As String) As Long

Public Function GetPathToModule(ByVal inFile As String) As String
    Dim mHandle As Long
    Dim mBuff As String * 256
    On Error GoTo errHandler
    mHandle = GetModuleHandle(inFile)
      'If inFile does not exist in one of the allowable places (i.e. not found by API),
      'then "....\VB6.exe" would be returned instead.  Hence exit here
    If mHandle = 0 Then GoTo errHandler  ' Comment out gives path to VB6.exe
      'Get filename corresponding to above handle
    GetModuleFileName mHandle, mBuff, Len(mBuff)
    GetPathToModule = Left$(mBuff, InStr(mBuff & vbNullChar, vbNullChar) - 1)
    Exit Function
errHandler:
    GetPathToModule = "(Path not found)"
End Function

