Re: Relative path to absolute

Tech-Archive recommends: Repair Windows Errors & Optimize Windows Performance

From: Steven Burn (nobody_at_PVT_it-mate.co.uk)
Date: 04/02/04


Date: Fri, 2 Apr 2004 18:12:35 +0100

If blah.exe is in the same folder as your app, why not just use App.Path?

i.e. App.Path & "\blah.exe"

You can use the following to strip the filename;

Function StripName(name As String) As String
    Dim path As Variant
    path = Split(name, "\")
    StripName = path(UBound(path))
End Function

And the following to strip the path;

Function Strippath(sFileName As String)
    Dim intPos As Integer
    intPos = InStrRev(sFileName, "\")
    If intPos = 0 Then
        Exit Function
    Else
        Strippath = Left$(sFileName, intPos)
    End If
End Function

--
Regards
Steven Burn
Ur I.T. Mate Group
www.it-mate.co.uk
Keeping it FREE!
Disclaimer:
I know I'm probably wrong, I just like taking part ;o)
Mike Kanski <mkanski@asi-solutions.com> wrote in message
news:upnLpTNGEHA.1396@TK2MSFTNGP11.phx.gbl...
> Is there an easy way to convert relative path to the absolute?
>
> I have a VB application that reads INI file for all the objects that it
> needs to run.
> INI file example:
>
> [Run]
> RunBlah=../../Blah.exe
>
> The app knows the base address:
> c:\programs\company\myapp\
>
> Now i need to read the RunBlah entry and run:
> c:\programs\blah.exe
>
> Is there an easy way or maybe a function i can call to get the absolute
> path?
>
> i.e.
> Function GetAbsolutePath(BasePath,RelativePath) as string
> ...
>     returns absolute path
> end function
>
>
>


Relevant Pages

  • Re: June 2005 EAL Question
    ... parameter to a string. ... > public class MyEventLogInstaller: Installer ... You have a web app, ... >>> at Microsoft.Win32.RegistryKey.OpenSubKey(String name, Boolean ...
    (microsoft.public.dotnet.general)
  • Re: Running other applications
    ... associated with a file type (extension). ... file and calling FindExecutable: ... ByVal lpDirectory As String, ByVal lpResult As String) As Long ... > The app is a program called Data Junction. ...
    (microsoft.public.vb.general.discussion)
  • Re: Cant register Windows Scripting Host with Windows 7
    ... My app has been in use since 1999 and is designed to work on Win 95 onwards hence the installer has always include WSH. ... One functions I have used it for in the program is to find the location of the users special folders eg. documents folder and then to delete a subfolder. ... Public Function GetSpecialFolderAs String ... Dim lNullPos As Long ...
    (microsoft.public.vb.general.discussion)
  • RE: SoapHttpClientProtocol request canceled
    ... the VB app on Citrix works fine with .NET components when only ... .NET1.1 is installed and the app uses .NET1.1. ... > The VB.NET exe and the VB6 exe both use VB.NET dll to sent request/response ... >> inputHeaderer, String messageControlPayload, string inputMessage) ...
    (microsoft.public.dotnet.framework.webservices)
  • Re: Multi language application
    ... the block below implies that you created your app as "Unicode app". ... Whether you choose UTF8 or UTF16 is really up to you but by default in a "Unicode app", you're likely to write less code with UTF16 strings. ... You can use::MultiByteToWideChar Win32 API to convert from UTF-8 to UTF-16, and pass the UTF-16 string to Windows controls. ...
    (microsoft.public.vc.mfc)