Solved

Long file names to short filenames!

Posted on 2004-04-22
5
375 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
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
  • 3
  • 2
5 Comments
 
LVL 52

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 52

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 52

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

Enroll in May's Course of the Month

May’s Course of the Month is now available! Experts Exchange’s Premium Members and Team Accounts have access to a complimentary course each month as part of their membership—an extra way to increase training and boost professional development.

Question has a verified solution.

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

Well, all of us have seen the multiple EXCEL.EXE's in task manager that won't die even if you call the .close, .dispose methods. Try this method to kill any excels in memory. You can copy the kill function to create a check function and replace the …
Introduction When many people think of the WebBrowser (http://msdn.microsoft.com/en-us/library/2te2y1x6%28v=VS.85%29.aspx) control, they immediately think of a control which allows the viewing and navigation of web pages. While this is true, it's a…
Nobody understands Phishing better than an anti-spam company. That’s why we are providing Phishing Awareness Training to our customers. According to a report by Verizon, only 3% of targeted users report malicious emails to management. With compan…

734 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