🚀 go-pugleaf

RetroBBS NetNews Server

Inspired by RockSolid Light RIP Retro Guy

Thread View: borland.public.cppbuilder.nativeapi
8 messages
8 total messages Started by Asger Jørgensen Thu, 18 Oct 2007 19:56
IShellFolder::GetDisplayNameOf FileName with extension
#1168
Author: Asger Jørgensen
Date: Thu, 18 Oct 2007 19:56
20 lines
1287 bytes
Hi there

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

Thanks in advance
Asger
Re: IShellFolder::GetDisplayNameOf FileName with extension
#1169
Author: Bruce Salzman
Date: Thu, 18 Oct 2007 20:46
27 lines
1773 bytes
"Asger Jørgensen" <junk@Asger-P.dk> wrote in message 
news:MPG.2181d8e14a7e5fb989858@newsgroups.borland.com...
> Hi there
>
> 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
>

You can use the fnsplit() function on the full path to get the filename + 
extension.

-- 
Bruce 
Re: IShellFolder::GetDisplayNameOf FileName with extension
#1170
Author: 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
Re: IShellFolder::GetDisplayNameOf FileName with extension
#1171
Author: Asger Jørgensen
Date: Thu, 18 Oct 2007 22:05
13 lines
1347 bytes
Thanks to both of You.

But I was hoping for a way to make windows give me 
the right kind of file name. 
Some of the drives I am checking have several tera 
bites of files, so if I can avoid takining apart the 
filename my self I would like that very much.

Kind regards
Asger

 
Re: IShellFolder::GetDisplayNameOf FileName with extension
#1172
Author: Bruce Salzman
Date: Thu, 18 Oct 2007 22:17
17 lines
1695 bytes
"Asger Jørgensen" <junk@Asger-P.dk> wrote in message 
news:MPG.2181f708e199695a989859@newsgroups.borland.com...
>
> Thanks to both of You.
>
> But I was hoping for a way to make windows give me
> the right kind of file name.
> Some of the drives I am checking have several tera
> bites of files, so if I can avoid takining apart the
> filename my self I would like that very much.
>

The computer actually does most of the work. :^)

-- 
Bruce 
Re: IShellFolder::GetDisplayNameOf FileName with extension
#1173
Author: Remy Lebeau (TeamB)
Date: Thu, 18 Oct 2007 22:29
14 lines
1513 bytes
"Asger J�rgensen" <junk@Asger-P.dk> wrote in message 
news:MPG.2181d8e14a7e5fb989858@newsgroups.borland.com...

> SHGDN_FORPARSING
> and this one gives the full path

What ITEMIDLIST are you giving to GetDisplayNameOf()?  Where are you getting 
it from?  Are you using the IShellFolder of the root Desktop namespace or of 
a specific parent folder?  Please show an actual code example that 
demonstrates the problem.


Gambit
Re: IShellFolder::GetDisplayNameOf FileName with extension
#1174
Author: Asger Jørgensen
Date: Fri, 19 Oct 2007 01:05
29 lines
1964 bytes
Hi Remy

In article <4717de62@newsgroups.borland.com>, 
no.spam@no.spam.com says...
> 
> "Asger Jørgensen" <junk@Asger-P.dk> wrote in message 
> news:MPG.2181d8e14a7e5fb989858@newsgroups.borland.com...
> 
> > SHGDN_FORPARSING
> > and this one gives the full path
> 
> What ITEMIDLIST are you giving to GetDisplayNameOf()?  Where are you getting 
> it from?  Are you using the IShellFolder of the root Desktop namespace or of 
> a specific parent folder?  Please show an actual code example that 
> demonstrates the problem.

Well I was actually only reading the helpfile
to see which function to use, but since I need 
the size of the files as well i am using
SHGetDataFromIDList which gives me both the 
size and the kind of name that I need.

But I have new problems, see my other question.

Thanks for all the help
Kind regards
Asger
Re: IShellFolder::GetDisplayNameOf FileName with extension
#1175
Author: Asger Jørgensen
Date: Fri, 19 Oct 2007 01:38
11 lines
1351 bytes
In article 
<MPG.2182214b839a08e598985a@newsgroups.borland.com>, 
junk@Asger-P.dk says...
> 
> But I have new problems, see my other question.

That problem is solved so there is no other question
right now.

Kind regards
Asger
Thread Navigation

This is a paginated view of messages in the thread with full content displayed inline.

Messages are displayed in chronological order, with the original post highlighted in green.

Use pagination controls to navigate through all messages in large threads.

Back to All Threads