Click here to Skip to main content
15,894,291 members
Home / Discussions / C#
   

C#

 
GeneralRe: Using OwnerDraw MenuItems in a NotifyIcon ContextMenu Pin
ethan3-Jan-03 6:09
ethan3-Jan-03 6:09 
GeneralRe: Using OwnerDraw MenuItems in a NotifyIcon ContextMenu Pin
Stephane Rodriguez.3-Jan-03 20:01
Stephane Rodriguez.3-Jan-03 20:01 
GeneralSplitting a string into lines Pin
Le centriste3-Jan-03 4:58
Le centriste3-Jan-03 4:58 
GeneralRe: Splitting a string into lines Pin
Paul Riley3-Jan-03 5:04
Paul Riley3-Jan-03 5:04 
GeneralRe: Splitting a string into lines Pin
Le centriste3-Jan-03 5:26
Le centriste3-Jan-03 5:26 
QuestionRenderContext? Pin
Dave Kerr3-Jan-03 4:37
Dave Kerr3-Jan-03 4:37 
QuestionHow to get the short (DOS) version of a long filename? Pin
Matt Philmon3-Jan-03 3:15
Matt Philmon3-Jan-03 3:15 
AnswerRe: How to get the short (DOS) version of a long filename? Pin
Richard Deeming3-Jan-03 3:38
mveRichard Deeming3-Jan-03 3:38 
Use the GetShortPathName API:
using System.IO;
using System.Runtime.InteropServices;
using System.Text;
 
[DllImport("kernel32.dll", CharSet = CharSet.Auto)]
private static extern int GetShortPathName(
    [MarshalAs(UnmanagedType.LPTStr)]
    string path,
    [MarshalAs(UnmanagedType.LPTStr)]
    StringBuilder shortPath,
    int shortPathLength);
 
public static string GetShortPathName(string fileName)
{
    if (fileName == null || fileName.Length == 0) 
        return string.Empty;
    
    if (!Path.IsPathRooted(fileName)) 
        fileName = Path.GetFullPath(fileName);
    
    try 
    {
        int len = GetShortPathName(fileName, null, 0);
        if (len > 0) 
        {
            StringBuilder sb = new StringBuilder(len);
            GetShortPathName(fileName, sb, len);
            return sb.ToString();
        }
        else
            return fileName;
    }
    catch 
    {
        return fileName;
    }
}



"These people looked deep within my soul and assigned me a number based on the order in which I joined." - Homer
GeneralRe: How to get the short (DOS) version of a long filename? Pin
Matt Philmon3-Jan-03 4:47
Matt Philmon3-Jan-03 4:47 
GeneralRe: How to get the short (DOS) version of a long filename? Pin
Ray Cassick3-Jan-03 5:40
Ray Cassick3-Jan-03 5:40 
GeneralRe: How to get the short (DOS) version of a long filename? Pin
Nick Parker3-Jan-03 6:40
protectorNick Parker3-Jan-03 6:40 
GeneralRe: How to get the short (DOS) version of a long filename? Pin
Ray Cassick3-Jan-03 6:52
Ray Cassick3-Jan-03 6:52 
GeneralRe: How to get the short (DOS) version of a long filename? Pin
leppie3-Jan-03 6:57
leppie3-Jan-03 6:57 
GeneralRe: How to get the short (DOS) version of a long filename? Pin
Paul Riley3-Jan-03 7:21
Paul Riley3-Jan-03 7:21 
GeneralRe: How to get the short (DOS) version of a long filename? Pin
David Stone3-Jan-03 12:01
sitebuilderDavid Stone3-Jan-03 12:01 
GeneralRe: How to get the short (DOS) version of a long filename? Pin
Paul Riley3-Jan-03 12:25
Paul Riley3-Jan-03 12:25 
GeneralRe: How to get the short (DOS) version of a long filename? Pin
Domenic Denicola3-Jan-03 17:50
Domenic Denicola3-Jan-03 17:50 
GeneralDirectShow 9 and C# Pin
Oyvind Bratland3-Jan-03 2:30
Oyvind Bratland3-Jan-03 2:30 
GeneralRe: DirectShow 9 and C# Pin
Stephane Rodriguez.3-Jan-03 5:47
Stephane Rodriguez.3-Jan-03 5:47 
GeneralRe: DirectShow 9 and C# Pin
Oyvind Bratland3-Jan-03 22:20
Oyvind Bratland3-Jan-03 22:20 
GeneralRe: DirectShow 9 and C# Pin
Stephane Rodriguez.3-Jan-03 22:28
Stephane Rodriguez.3-Jan-03 22:28 
General(Suggestion): Database comparison Pin
Jassim Rahma3-Jan-03 0:53
Jassim Rahma3-Jan-03 0:53 
GeneralRe: (Suggestion): Database comparison Pin
Adrian Hall3-Jan-03 5:42
Adrian Hall3-Jan-03 5:42 
Generaldll Problem with De-serializable object Pin
bryanhuang2-Jan-03 21:47
bryanhuang2-Jan-03 21:47 
GeneralRe: dll Problem with De-serializable object Pin
Alex Korchemniy3-Jan-03 7:27
Alex Korchemniy3-Jan-03 7:27 

General General    News News    Suggestion Suggestion    Question Question    Bug Bug    Answer Answer    Joke Joke    Praise Praise    Rant Rant    Admin Admin   

Use Ctrl+Left/Right to switch messages, Ctrl+Up/Down to switch threads, Ctrl+Shift+Left/Right to switch pages.