473,508 Members | 2,210 Online
Bytes | Software Development & Data Engineering Community
+ Post

Home Posts Topics Members FAQ

FreeSpace Property in C++ .Net

Hi,

I am trying to use the FreeSpace property in C++ .Net, but I having
problems. I looked around and most of the examples I found are in VB or C#.

I tried to convert a C# example to a C++.Net program, but C++>Net does not
like when I use the FreeSpace property. Here is a piece of my code:

UInt64 PlotFileDrive::getDiskSpace()
{
String * myPath = ("win32_logicaldisk.deviceid=\"C:\"");

ManagementObject * disk = new ManagementObject(myPath);
if (NULL == disk)
return 0;
else
return Convert::ToUInt64(disk["FreeSpace"]);
}

C++>Net complains about the disk["FreeSpace"], the error message I got says:

error C2107: illegal index, indirection not allowed
Does anyboy have any C++ .Net examples using the FreeSpace property. I
appreciate any help I can get.
Nov 16 '05 #1
1 1873
Try
UInt64 PlotFileDrive::getDiskSpace()
{
String * myPath = ("win32_logicaldisk.deviceid=\"C:\"");

ManagementObject * disk = new ManagementObject(myPath);
if (NULL == disk)
return 0;
else
return Convert::ToUInt64(disk->Item["FreeSpace"]);
}
"mmzly" <mm***@discussions.microsoft.com> wrote in message
news:06**********************************@microsof t.com...
Hi,

I am trying to use the FreeSpace property in C++ .Net, but I having
problems. I looked around and most of the examples I found are in VB or
C#.

I tried to convert a C# example to a C++.Net program, but C++>Net does not
like when I use the FreeSpace property. Here is a piece of my code:

UInt64 PlotFileDrive::getDiskSpace()
{
String * myPath = ("win32_logicaldisk.deviceid=\"C:\"");

ManagementObject * disk = new ManagementObject(myPath);
if (NULL == disk)
return 0;
else
return Convert::ToUInt64(disk["FreeSpace"]);
}

C++>Net complains about the disk["FreeSpace"], the error message I got
says:

error C2107: illegal index, indirection not allowed
Does anyboy have any C++ .Net examples using the FreeSpace property. I
appreciate any help I can get.

Nov 16 '05 #2

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

3
2462
by: Johnny M | last post by:
using Access 2003 Pardon the subject line, but I don't have a better word for this strange behavior (or behavior I don't understand!!!) I have a class module named DepreciationFactor. One of...
7
2600
by: MP | last post by:
Hello, I am trying to write a class that will expose some properties. One of the property is extracted from a SQL database and can be NULL or some integer value. Is there a elegant way of...
3
5139
by: MattC | last post by:
Hi, I found this code somewhere on the net and need to make some alterations. public class GenericSorter : IComparer { String sortProperty; bool sortOrder; public GenericSorter(String...
2
1746
by: Edward Diener | last post by:
How does one specify in a component that a property is a pointer to another component ? How is this different from a property that is actually an embedded component ? Finally how is one notified in...
2
3316
by: Dan | last post by:
I've written a short function to return the amount of free disk space on a specified drive (for example c:) and it works fine on my development platform. In production, however, I am getting an...
0
5545
by: Brian Young | last post by:
Hi all. I'm using the Property Grid control in a control to manage a windows service we have developed here. The windows service runs a set of other jobs that need to be managed. The control...
15
2024
by: Lauren Wilson | last post by:
Owning your ideas: An essential tool for freedom By Daniel Son Thinking about going into business? Have an idea that you think will change the world? What if you were told that there was no way...
0
955
by: Derrick | last post by:
Good Morning! Is there a simple way to get freespace on a network drive, without going thru the hoops of setting up WMI? Something in the basic System.IO package? I have a basic file uploads...
1
1346
by: cday119 | last post by:
I have a Class with about 10 properties. All properties return right except for one. It is real annoying and I can't see why its not working. Maybe someone else can see something. It is the...
0
7132
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...
0
7504
tracyyun
by: tracyyun | last post by:
Dear forum friends, With the development of smart home technology, a variety of wireless communication protocols have appeared on the market, such as Zigbee, Z-Wave, Wi-Fi, Bluetooth, etc. Each...
0
5640
agi2029
by: agi2029 | last post by:
Let's talk about the concept of autonomous AI software engineers and no-code agents. These AIs are designed to manage the entire lifecycle of a software development project—planning, coding, testing,...
1
5059
isladogs
by: isladogs | last post by:
The next Access Europe User Group meeting will be on Wednesday 1 May 2024 starting at 18:00 UK time (6PM UTC+1) and finishing by 19:30 (7.30PM). In this session, we are pleased to welcome a new...
0
4720
by: conductexam | last post by:
I have .net C# application in which I am extracting data from word file and save it in database particularly. To store word all data as it is I am converting the whole word file firstly in HTML and...
0
3211
by: TSSRALBI | last post by:
Hello I'm a network technician in training and I need your help. I am currently learning how to create and manage the different types of VPNs and I have a question about LAN-to-LAN VPNs. The...
0
1568
by: 6302768590 | last post by:
Hai team i want code for transfer the data from one system to another through IP address by using C# our system has to for every 5mins then we have to update the data what the data is updated ...
1
773
muto222
by: muto222 | last post by:
How can i add a mobile payment intergratation into php mysql website.
0
432
bsmnconsultancy
by: bsmnconsultancy | last post by:
In today's digital era, a well-designed website is crucial for businesses looking to succeed. Whether you're a small business owner or a large corporation in Toronto, having a strong online presence...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.