LabWindows/CVI

cancel
Showing results for 
Search instead for 
Did you mean: 

Need a way to display long path name is a small string control

I need to display a long path name, like

\\MachineName\FolderName\Sub-Folder\Sub-Folder\FileName.txt

into a small textbox, something like

\\MachineName\...\FileName.txt

The FileName.txt should be visible (I will make sure textbox is big enough
to display that). How do I do this?

I had asked this question earlier but guess I wasn't clear, so someone had
suggested GetShortPathName which only converts long path names into 8.3 DOS
format.

One way I can think of is splitting the path so I get the filename and
directory name and then do some parsing and display them but if there is
some WIN API do it, it will be good.


vishi
0 Kudos
Message 1 of 5
(2,846 Views)
Perhaps you can test the string length before displaying. Then, if the string is longer than will fit in your string control, set the string control justification to Right instead of Left.
0 Kudos
Message 2 of 5
(2,846 Views)
Thanks but I need to display drive/computer name which starts at the
begining and FileName which is at the end.

Windows does this, so I am hoping there is an API do it, rather than coding
myself.

vishi

"Craig Leidholm" wrote in message
news:50650000000500000002D20000-1042324653000@exchange.ni.com...
> Perhaps you can test the string length before displaying. Then, if
> the string is longer than will fit in your string control, set the
> string control justification to Right instead of Left.
0 Kudos
Message 3 of 5
(2,846 Views)
The last time you asked this question, I was hoping someone would know a Windows API function to do this. But here's a way of doing it by manipulating the strings.
Download All
0 Kudos
Message 4 of 5
(2,846 Views)
Thanks

"Al S" wrote in message
news:506500000005000000DED20000-1042324653000@exchange.ni.com...
> The last time you asked this question, I was hoping someone would know
> a Windows API function to do this. But here's a way of doing it by
> manipulating the strings.
0 Kudos
Message 5 of 5
(2,846 Views)