Doing,
Dim arrFiles() as string
Dim strWinDir as String
Dim intRet as Integer
Dim strWavFilePath as string
StrWinDir = Space(255)
intRet = GetWindowsDirectory(StrWinDir, Len(StrWinDir))
If intRet > 0 Then
arrFiles = system.IO.Directory.GetFiles (strWinDir &
"\media\","*.wav")
End IF
'-------------------------------------------------------------
I get
An unhandled exception of type 'System.IO.PathtoLongException'
occured in mscorlib.dll
Additionl information. the path is too long after being fully
qualified. Make sure path is less than 260 characters.
'---------------------------------------------------------------
The exception occurs on the getfiles statement.
The path is less than 260 characters.
Any help would be appreciated.
Laurence Nuttall
Programmer Analyst III
UCLA - Division of Continuing Education 9 1480
"Laurence Nuttall" <Bl***@Bliff.com> wrote in message
news:uY**************@TK2MSFTNGP11.phx.gbl... Doing,
Dim arrFiles() as string Dim strWinDir as String Dim intRet as Integer Dim strWavFilePath as string
StrWinDir = Space(255) intRet = GetWindowsDirectory(StrWinDir, Len(StrWinDir))
try trimming your strWinDir
I know you need the Space(255) for the buffer into unmanaged, but maybe
adding a .Trim() after all is said and done would help.
-CJ
If intRet > 0 Then arrFiles = system.IO.Directory.GetFiles (strWinDir & "\media\","*.wav")
End IF
'-------------------------------------------------------------
I get
An unhandled exception of type 'System.IO.PathtoLongException' occured in mscorlib.dll
Additionl information. the path is too long after being fully qualified. Make sure path is less than 260 characters.
'---------------------------------------------------------------
The exception occurs on the getfiles statement. The path is less than 260 characters.
Any help would be appreciated.
Laurence Nuttall Programmer Analyst III UCLA - Division of Continuing Education
* Laurence Nuttall <Bl***@Bliff.com> scripsit: Doing,
Dim arrFiles() as string Dim strWinDir as String Dim intRet as Integer Dim strWavFilePath as string
StrWinDir = Space(255) intRet = GetWindowsDirectory(StrWinDir, Len(StrWinDir))
If intRet > 0 Then arrFiles = system.IO.Directory.GetFiles (strWinDir & "\media\","*.wav")
Cut off the content of 'strWinDir' ('intRet' will contain the length of
the windows directory's path) using 'Left'.
--
Herfried K. Wagner [MVP]
<http://www.mvps.org/dotnet>
I can't find the left in vb.net, so
I used the trim
arrFiles = system.IO.Directory.GetFiles (strWinDir.Trim & "\media\","*.wav")
This still gets me the exception.
If I remove the "*.wav" and substitute ""
no exception occurs, but the arrfiles array is empty.
Larry
Herfried K. Wagner [MVP] wrote: * Laurence Nuttall <Bl***@Bliff.com> scripsit:
Doing,
Dim arrFiles() as string Dim strWinDir as String Dim intRet as Integer Dim strWavFilePath as string
StrWinDir = Space(255) intRet = GetWindowsDirectory(StrWinDir, Len(StrWinDir))
If intRet > 0 Then arrFiles = system.IO.Directory.GetFiles (strWinDir & "\media\","*.wav")
Cut off the content of 'strWinDir' ('intRet' will contain the length of the windows directory's path) using 'Left'.
* Laurence Nuttall <Bl***@Bliff.com> scripsit: I can't find the left in vb.net, so I used the trim
'Trim' won't work here too. Use something like
'Strings.Left(strWinDir, intRet) & ...'.
--
Herfried K. Wagner [MVP]
<http://www.mvps.org/dotnet>
If I put a literal "C:\Windows"
in the get files statement it works.
example:
arrFiles = system.IO.Directory.GetFiles ("C:\Windows" &
"\media\","*.wav")
but it doesn't like it if the first parameter is a variable
string.
Larry
Herfried K. Wagner [MVP] wrote: * Laurence Nuttall <Bl***@Bliff.com> scripsit:
Doing,
Dim arrFiles() as string Dim strWinDir as String Dim intRet as Integer Dim strWavFilePath as string
StrWinDir = Space(255) intRet = GetWindowsDirectory(StrWinDir, Len(StrWinDir))
If intRet > 0 Then arrFiles = system.IO.Directory.GetFiles (strWinDir & "\media\","*.wav")
Cut off the content of 'strWinDir' ('intRet' will contain the length of the windows directory's path) using 'Left'.
The (Strings.Left(strWinDir, intRet)
worked.
What is Strings.left ?
Herfried K. Wagner [MVP] wrote: * Laurence Nuttall <Bl***@Bliff.com> scripsit:
I can't find the left in vb.net, so I used the trim
'Trim' won't work here too. Use something like 'Strings.Left(strWinDir, intRet) & ...'.
Laurence,
It appears that you don't have to make the API call... http://www.vb2themax.com/Item.asp?PageID=TipBank&ID=514
Worked for me...
Tom
"Laurence Nuttall" <Bl***@Bliff.com> wrote in message
news:uY**************@TK2MSFTNGP11.phx.gbl... Doing,
Dim arrFiles() as string Dim strWinDir as String Dim intRet as Integer Dim strWavFilePath as string
StrWinDir = Space(255) intRet = GetWindowsDirectory(StrWinDir, Len(StrWinDir))
If intRet > 0 Then arrFiles = system.IO.Directory.GetFiles (strWinDir & "\media\","*.wav")
End IF
'-------------------------------------------------------------
I get
An unhandled exception of type 'System.IO.PathtoLongException' occured in mscorlib.dll
Additionl information. the path is too long after being fully qualified. Make sure path is less than 260 characters.
'---------------------------------------------------------------
The exception occurs on the getfiles statement. The path is less than 260 characters.
Any help would be appreciated.
Laurence Nuttall Programmer Analyst III UCLA - Division of Continuing Education
* Laurence Nuttall <Bl***@Bliff.com> scripsit: The (Strings.Left(strWinDir, intRet) worked.
What is Strings.left ?
It takes the left part of a string (the 1st 'intRet' number of
characters).
--
Herfried K. Wagner [MVP]
<http://www.mvps.org/dotnet> This thread has been closed and replies have been disabled. Please start a new discussion. Similar topics
by: Chuck Hartman |
last post by:
I have a Windows service that requests web pages from a site using an
HttpWebRequest object. When I try to request a page from an ASP.NET 2 site,
I get a WebException with message "The remote...
|
by: Dave Stewart |
last post by:
I recently wrote my first Vb.net application, or at least my first complex app since moving up from vb6. When run from the VS.NET IDE, the program shows no errors and runs fine. When the output exe...
|
by: Lucvdv |
last post by:
Can someone explain why this code pops up a messagebox saying the
ThreadAbortException wasn't handled?
The first exception is reported only in the debug pane, as expected.
The second (caused by...
|
by: Samuel R. Neff |
last post by:
When you have an unhandled exception in vb.net how do you view the
exception information in the debugger?
In C# the debugger creates a local variable that points to the
exception and you can...
|
by: Colmeister |
last post by:
I recently read Jason Clark's excellent article on Unhandled Exceptions
(http://msdn.microsoft.com/msdnmag/issues/04/06/NET/default.aspx) and have
attempted to incorporate the features he talks...
|
by: Simon Tamman {Uchiha Jax} |
last post by:
Now this is bugging me.
I just released software for a client and they have reported an unhandled
stack overflow exception.
My first concern is that the entirity of the UI and any threaded...
|
by: Bob |
last post by:
If I induce and unhandled exception in my vb.net code for instance using
'-- just a simple "object not initialized" exception (should read "as new")
Dim x As Specialized.NameValueCollection
...
|
by: Bob |
last post by:
In Vs 2005 you have new applicationsEvents.vb I was testing it in a simple
app and found that it was easier to implement unhandled exception management
tah it was in Vs2003 (vb.net) You can, if you...
|
by: bg_ie |
last post by:
Hi,
I have the following Program.cs -
namespace TestFrameworkApplication
{
static class Program
{
/// <summary>
/// The main entry point for the application.
|
by: =?Utf-8?B?c3VydHVyeg==?= |
last post by:
Hi,
I feel like a noob for asking this.
When I publish a VB windows application, I want to disable the ability of
the the user to continue when there is an unhandled exception.
For example,...
|
by: taylorcarr |
last post by:
A Canon printer is a smart device known for being advanced, efficient, and reliable. It is designed for home, office, and hybrid workspace use and can also be used for a variety of purposes. However,...
|
by: Charles Arthur |
last post by:
How do i turn on java script on a villaon, callus and itel keypad mobile phone
|
by: ryjfgjl |
last post by:
If we have dozens or hundreds of excel to import into the database, if we use the excel import function provided by database editors such as navicat, it will be extremely tedious and time-consuming...
|
by: emmanuelkatto |
last post by:
Hi All, I am Emmanuel katto from Uganda. I want to ask what challenges you've faced while migrating a website to cloud.
Please let me know.
Thanks!
Emmanuel
|
by: BarryA |
last post by:
What are the essential steps and strategies outlined in the Data Structures and Algorithms (DSA) roadmap for aspiring data scientists? How can individuals effectively utilize this roadmap to progress...
|
by: Sonnysonu |
last post by:
This is the data of csv file
1 2 3
1 2 3
1 2 3
1 2 3
2 3
2 3
3
the lengths should be different i have to store the data by column-wise with in the specific length.
suppose the i have to...
|
by: Hystou |
last post by:
There are some requirements for setting up RAID:
1. The motherboard and BIOS support RAID configuration.
2. The motherboard has 2 or more available SATA protocol SSD/HDD slots (including MSATA, M.2...
|
by: Hystou |
last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can...
|
by: Oralloy |
last post by:
Hello folks,
I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>".
The problem is that using the GNU compilers,...
| |