๐Ÿš€ go-pugleaf

RetroBBS NetNews Server

Inspired by RockSolid Light RIP Retro Guy

Article View: borland.public.cppbuilder.nativeapi
Article #1170

Re: IShellFolder::GetDisplayNameOf FileName with extension

#1170
From: Ed Mulroy [TeamB]
Date: Thu, 18 Oct 2007 21:05
51 lines
2265 bytes
You could do something like this:

--------------------------------
const char *FilenameFromFullName(char *fullname)
  {
  char *result;

  if (fullname && *fullname) // if it is a valid string
    {
    result = strrchr(fullname, "\\"); // point to after last backslash

    if ((result != NULL) && (result[1] != '\0')) // if chars follow the '\\'
      {
      if (fullname[1] == ':') // if a drive in the path
        {
        if (fullname[2] != '\0') // if chars follow the colon
          result = fullname + 3; // name is what comes after the colon
        }
      else
       {
       result = fullname + 1; // name is what comes after the last '\\'
       }
      }
    }
  else
    result = NULL; // if string is invalid, result is NULL

  return result;
  }
--------------------------------

.  Ed

> Asger J๏ฟฝrgensen wrote in message
> news:MPG.2181d8e14a7e5fb989858@newsgroups.borland.com...
>
> How do I get the filename with extension, but
> without the path.
>
> In the helpfile under GetDisplayNameOf there is three
> options
>
> SHGDN_NORMAL
> and
> SHGDN_INFOLDER
> seems to give the same result, the filename with or
> without extension acording to what the user have
> chosen for the explorer.
>
> SHGDN_FORPARSING
> and this one gives the full path
Technical Details
Message-ID: <4717ca9c$1@newsgroups.borland.com>
Path: arc1-ca.pugleaf.net!g2news2.google.com!news4.google.com!news.germany.com!newsfeed01.sul.t-online.de!t-online.de!newsgroups.borland.com!not-for-mail
References: <MPG.2181d8e14a7e5fb989858@newsgroups.borland.com>

Show Full Headers
Complete Article Headers
X-Google-Thread: 10cc67,837423057db5c2d9
X-Google-Attributes: gid10cc67,public,usenet
X-Google-Language: ENGLISH,ASCII
From: "Ed Mulroy [TeamB]" <dont_email_me@bitbuc.ket>
Newsgroups: borland.public.cppbuilder.nativeapi
References: <MPG.2181d8e14a7e5fb989858@newsgroups.borland.com>
Subject: Re: IShellFolder::GetDisplayNameOf  FileName with extension
Date: Thu, 18 Oct 2007 17:05:33 -0400
Lines: 53
X-Priority: 3
X-MSMail-Priority: Normal
X-Newsreader: Microsoft Outlook Express 6.00.2900.3138
X-MimeOLE: Produced By Microsoft MimeOLE V6.00.2900.3198
X-RFC2646: Format=Flowed; Original
NNTP-Posting-Host: 69.142.254.168
Message-ID: <4717ca9c$1@newsgroups.borland.com>
X-Trace: newsgroups.borland.com 1192741532 69.142.254.168 (18 Oct 2007 14:05:32 -0700)
X-Authenticated-User: edmulroy
Path: arc1-ca.pugleaf.net!g2news2.google.com!news4.google.com!news.germany.com!newsfeed01.sul.t-online.de!t-online.de!newsgroups.borland.com!not-for-mail