|
|
|
start date: Sat, 21 Jul 2007 08:34:01 -0700,
posted on: microsoft.public.dotnet.framework.compactframework
back
| Thread Index |
|
1
ve3wtj
|
|
2
dbgrick
|
|
3
ve3wtj
|
|
4
ve3wtj
|
|
5
ctacke/ ctacke[at]opennetcf[dot]com
|
Trying to find .NET CF 2.0 equivalent for GetDiskFreeSpace
Hello.
I'm running Win Mobile 5.0 on an ARM XScale, and writing in VS2005 - Visual
Basic with Compact Framework 2.0.
I want to find out (programmaticaly) how much storage space is available on
the Pocket PC, both in main storage ("\") and on a storage card ("\Storage
Card\"), and show a message box if either has less than 16 MB free.
I've tried the following inside a "Public Class Form1" but get a
NotSupportedException error:
Public Declare Function GetDiskFreeSpaceExW Lib "CoreDll.Dll" ( _
ByRef DirectoryName As String, _
ByRef FreeBytesAvailable As Int64, _
ByRef TotalNumberOfBytes As Int64, _
ByRef TotalNumberOfFreeBytes As Int64) As Boolean
Dim res As Boolean
res = Form1.GetDiskFreeSpaceExW("\", FreeBytesAvailable, TotalNumberOfBytes,
TotalNumberOfFreeBytes)
MsgBox(FreeBytesAvailable.ToString)
I've also tried using GlobalMemoryStatus and GetSystemMemoryDivision - these
work without raising an exception, but seem to give me program memory instead
of storage space.
Date:Sat, 21 Jul 2007 08:34:01 -0700
Author:
|
RE: Trying to find .NET CF 2.0 equivalent for GetDiskFreeSpace
You need to use the method GetDiskSpaceFreeEx, Do not specify the wide
character version. HEre is a link that should help:
http://msdn2.microsoft.com/en-US/library/aa912270.aspx
Rick D.
Contractor
"ve3wtj" wrote:
> Hello.
>
> I'm running Win Mobile 5.0 on an ARM XScale, and writing in VS2005 - Visual
> Basic with Compact Framework 2.0.
>
> I want to find out (programmaticaly) how much storage space is available on
> the Pocket PC, both in main storage ("\") and on a storage card ("\Storage
> Card\"), and show a message box if either has less than 16 MB free.
>
> I've tried the following inside a "Public Class Form1" but get a
> NotSupportedException error:
>
> Public Declare Function GetDiskFreeSpaceExW Lib "CoreDll.Dll" ( _
> ByRef DirectoryName As String, _
> ByRef FreeBytesAvailable As Int64, _
> ByRef TotalNumberOfBytes As Int64, _
> ByRef TotalNumberOfFreeBytes As Int64) As Boolean
>
> Dim res As Boolean
>
> res = Form1.GetDiskFreeSpaceExW("\", FreeBytesAvailable, TotalNumberOfBytes,
> TotalNumberOfFreeBytes)
>
> MsgBox(FreeBytesAvailable.ToString)
>
> I've also tried using GlobalMemoryStatus and GetSystemMemoryDivision - these
> work without raising an exception, but seem to give me program memory instead
> of storage space.
Date:Sat, 21 Jul 2007 10:18:00 -0700
Author:
|
RE: Trying to find .NET CF 2.0 equivalent for GetDiskFreeSpace
Thanks for the suggestion, but dropping the W didn't make a difference - I
still get
a "NotSupportedException".
I've since been able to use GetStoreInformation() to acquire main storage
space, but still no success with '\Storage Card'.
"dbgrick" wrote:
> You need to use the method GetDiskSpaceFreeEx, Do not specify the wide
> character version. HEre is a link that should help:
>
> http://msdn2.microsoft.com/en-US/library/aa912270.aspx
>
> Rick D.
> Contractor
>
> "ve3wtj" wrote:
>
> > Hello.
> >
> > I'm running Win Mobile 5.0 on an ARM XScale, and writing in VS2005 - Visual
> > Basic with Compact Framework 2.0.
> >
> > I want to find out (programmaticaly) how much storage space is available on
> > the Pocket PC, both in main storage ("\") and on a storage card ("\Storage
> > Card\"), and show a message box if either has less than 16 MB free.
> >
> > I've tried the following inside a "Public Class Form1" but get a
> > NotSupportedException error:
> >
> > Public Declare Function GetDiskFreeSpaceExW Lib "CoreDll.Dll" ( _
> > ByRef DirectoryName As String, _
> > ByRef FreeBytesAvailable As Int64, _
> > ByRef TotalNumberOfBytes As Int64, _
> > ByRef TotalNumberOfFreeBytes As Int64) As Boolean
> >
> > Dim res As Boolean
> >
> > res = Form1.GetDiskFreeSpaceExW("\", FreeBytesAvailable, TotalNumberOfBytes,
> > TotalNumberOfFreeBytes)
> >
> > MsgBox(FreeBytesAvailable.ToString)
> >
> > I've also tried using GlobalMemoryStatus and GetSystemMemoryDivision - these
> > work without raising an exception, but seem to give me program memory instead
> > of storage space.
Date:Sat, 21 Jul 2007 11:58:05 -0700
Author:
|
RE: Trying to find .NET CF 2.0 equivalent for GetDiskFreeSpace
Looks like I needed to pass the directory name by value instead of by
reference. Issue resolved.
--
David Friesen, B.Eng
"ve3wtj" wrote:
> Thanks for the suggestion, but dropping the W didn't make a difference - I
> still get
> a "NotSupportedException".
>
> I've since been able to use GetStoreInformation() to acquire main storage
> space, but still no success with '\Storage Card'.
>
>
> "dbgrick" wrote:
>
> > You need to use the method GetDiskSpaceFreeEx, Do not specify the wide
> > character version. HEre is a link that should help:
> >
> > http://msdn2.microsoft.com/en-US/library/aa912270.aspx
> >
> > Rick D.
> > Contractor
> >
> > "ve3wtj" wrote:
> >
> > > Hello.
> > >
> > > I'm running Win Mobile 5.0 on an ARM XScale, and writing in VS2005 - Visual
> > > Basic with Compact Framework 2.0.
> > >
> > > I want to find out (programmaticaly) how much storage space is available on
> > > the Pocket PC, both in main storage ("\") and on a storage card ("\Storage
> > > Card\"), and show a message box if either has less than 16 MB free.
> > >
> > > I've tried the following inside a "Public Class Form1" but get a
> > > NotSupportedException error:
> > >
> > > Public Declare Function GetDiskFreeSpaceExW Lib "CoreDll.Dll" ( _
> > > ByRef DirectoryName As String, _
> > > ByRef FreeBytesAvailable As Int64, _
> > > ByRef TotalNumberOfBytes As Int64, _
> > > ByRef TotalNumberOfFreeBytes As Int64) As Boolean
> > >
> > > Dim res As Boolean
> > >
> > > res = Form1.GetDiskFreeSpaceExW("\", FreeBytesAvailable, TotalNumberOfBytes,
> > > TotalNumberOfFreeBytes)
> > >
> > > MsgBox(FreeBytesAvailable.ToString)
> > >
> > > I've also tried using GlobalMemoryStatus and GetSystemMemoryDivision - these
> > > work without raising an exception, but seem to give me program memory instead
> > > of storage space.
Date:Sat, 21 Jul 2007 12:36:01 -0700
Author:
|
Re: Trying to find .NET CF 2.0 equivalent for GetDiskFreeSpace
A String is a reference type, so it's already being passed as a pointer.
Passing it ByRef sends a pointer to a pointer, which is the likely cause of
failure.
--
Chris Tacke, Embedded MVP
OpenNETCF Consulting
Managed Code in an Embedded World
www.OpenNETCF.com
"ve3wtj" wrote in message
news:A6469684-AEC3-4659-90BB-54EC6587ADF2@microsoft.com...
> Thanks for the suggestion, but dropping the W didn't make a difference - I
> still get
> a "NotSupportedException".
>
> I've since been able to use GetStoreInformation() to acquire main storage
> space, but still no success with '\Storage Card'.
>
>
> "dbgrick" wrote:
>
>> You need to use the method GetDiskSpaceFreeEx, Do not specify the wide
>> character version. HEre is a link that should help:
>>
>> http://msdn2.microsoft.com/en-US/library/aa912270.aspx
>>
>> Rick D.
>> Contractor
>>
>> "ve3wtj" wrote:
>>
>> > Hello.
>> >
>> > I'm running Win Mobile 5.0 on an ARM XScale, and writing in VS2005 -
>> > Visual
>> > Basic with Compact Framework 2.0.
>> >
>> > I want to find out (programmaticaly) how much storage space is
>> > available on
>> > the Pocket PC, both in main storage ("\") and on a storage card
>> > ("\Storage
>> > Card\"), and show a message box if either has less than 16 MB free.
>> >
>> > I've tried the following inside a "Public Class Form1" but get a
>> > NotSupportedException error:
>> >
>> > Public Declare Function GetDiskFreeSpaceExW Lib "CoreDll.Dll" ( _
>> > ByRef DirectoryName As String, _
>> > ByRef FreeBytesAvailable As Int64, _
>> > ByRef TotalNumberOfBytes As Int64, _
>> > ByRef TotalNumberOfFreeBytes As Int64) As Boolean
>> >
>> > Dim res As Boolean
>> >
>> > res = Form1.GetDiskFreeSpaceExW("\", FreeBytesAvailable,
>> > TotalNumberOfBytes,
>> > TotalNumberOfFreeBytes)
>> >
>> > MsgBox(FreeBytesAvailable.ToString)
>> >
>> > I've also tried using GlobalMemoryStatus and GetSystemMemoryDivision -
>> > these
>> > work without raising an exception, but seem to give me program memory
>> > instead
>> > of storage space.
Date:Sat, 21 Jul 2007 16:51:00 -0500
Author:
|
|
|