Solved

Long file names to short filenames!

Posted on 2004-04-22
5
372 Views
Last Modified: 2010-04-24
1st
I need my application to find out directory where its in and show it in short filename. So far i got

        Dim caption As String
        caption = (Windows.Forms.Application.ExecutablePath)
        MsgBox(caption)

and it showing me something like this

D:\Visual Studio Projects\ex

but i want it to be

D:\visual~1\ex

how can i make it work????

2nd.

How to make my application to be on top of startbar???

0
Comment
Question by:g00r00
  • 3
  • 2
5 Comments
 
LVL 50

Accepted Solution

by:
Ryan Chong earned 20 total points
ID: 10896597
Try:

Private Declare Function GetShortPathName Lib "kernel32" Alias "GetShortPathNameA" (ByVal lpszLongPath As String, ByVal lpszShortPath As String, ByVal lBuffer As Integer) As Integer

Private Function FilePathToShort(ByVal OriginalFileName As String) As String
        'create a buffer
        Dim Buffer As String = Space(255)
        'copy the current directory to the buffer and append 'myfile.ext'
        Dim Ret As Integer = GetShortPathName(OriginalFileName, Buffer, 164)
        'remove the unnecessary chr$(0)'s
        Return Buffer.Substring(0, Ret)
    End Function

    Private Sub Button1_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Button7.Click
        MessageBox.Show(FilePathToShort("D:\Visual Studio Projects\ex"))
    End Sub
0
 
LVL 50

Expert Comment

by:Ryan Chong
ID: 10896604
>>How to make my application to be on top of startbar???
Try:
Me.TopMost = True
0
 

Author Comment

by:g00r00
ID: 10900355
if you use me.topmost then your application will be ontop of all other applications, but not on top of the startbar,,,
0
 
LVL 50

Expert Comment

by:Ryan Chong
ID: 10900623
>>but not on top of the startbar
Yes if the application window is Maximized, No if it's in Normal WindowState
0
 

Author Comment

by:g00r00
ID: 10902575
I try and even in maximized state its not of top of startbar, gime me the source code and i'll try it!!!
0

Featured Post

PRTG Network Monitor: Intuitive Network Monitoring

Network Monitoring is essential to ensure that computer systems and network devices are running. Use PRTG to monitor LANs, servers, websites, applications and devices, bandwidth, virtual environments, remote systems, IoT, and many more. PRTG is easy to set up & use.

Question has a verified solution.

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

Since .Net 2.0, Visual Basic has made it easy to create a splash screen and set it via the "Splash Screen" drop down in the Project Properties.  A splash screen set in this manner is automatically created, displayed and closed by the framework itsel…
Parsing a CSV file is a task that we are confronted with regularly, and although there are a vast number of means to do this, as a newbie, the field can be confusing and the tools can seem complex. A simple solution to parsing a customized CSV fi…
Windows 10 is mostly good. However the one thing that annoys me is how many clicks you have to do to dial a VPN connection. You have to go to settings from the start menu, (2 clicks), Network and Internet (1 click), Click VPN (another click) then fi…
This video shows how to quickly and easily add an email signature for all users on Exchange 2016. The resulting signature is applied on a server level by Exchange Online. The email signature template has been downloaded from: www.mail-signatures…

773 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