Solved

Long file names to short filenames!

Posted on 2004-04-22
5
374 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 51

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 51

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 51

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

Independent Software Vendors: We Want Your Opinion

We value your feedback.

Take our survey and automatically be enter to win anyone of the following:
Yeti Cooler, Amazon eGift Card, and Movie eGift Card!

Question has a verified solution.

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

Suggested Solutions

1.0 - Introduction Converting Visual Basic 6.0 (VB6) to Visual Basic 2008+ (VB.NET). If ever there was a subject full of murkiness and bad decisions, it is this one!   The first problem seems to be that people considering this task of converting…
It’s quite interesting for me as I worked with Excel using vb.net for some time. Here are some topics which I know want to share with others whom this might help. First of all if you are working with Excel then you need to Download the Following …
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…
Exchange organizations may use the Journaling Agent of the Transport Service to archive messages going through Exchange. However, if the Transport Service is integrated with some email content management application (such as an antispam), the admini…

756 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