Solved

Long file names to short filenames!

Posted on 2004-04-22
5
369 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 49

Accepted Solution

by:
Ryan Chong earned 20 total points
Comment Utility
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 49

Expert Comment

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

Author Comment

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

Expert Comment

by:Ryan Chong
Comment Utility
>>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
Comment Utility
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

Threat Intelligence Starter Resources

Integrating threat intelligence can be challenging, and not all companies are ready. These resources can help you build awareness and prepare for defense.

Join & Write a Comment

Introduction As chip makers focus on adding processor cores over increasing clock speed, developers need to utilize the features of modern CPUs.  One of the ways we can do this is by implementing parallel algorithms in our software.   One recent…
Calculating holidays and working days is a function that is often needed yet it is not one found within the Framework. This article presents one approach to building a working-day calculator for use in .NET.
Get a first impression of how PRTG looks and learn how it works.   This video is a short introduction to PRTG, as an initial overview or as a quick start for new PRTG users.
Access reports are powerful and flexible. Learn how to create a query and then a grouped report using the wizard. Modify the report design after the wizard is done to make it look better. There will be another video to explain how to put the final p…

728 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

Need Help in Real-Time?

Connect with top rated Experts

9 Experts available now in Live!

Get 1:1 Help Now