Thread: HD/CPU/Programming querying

  1. #1
    Registered User
    Join Date
    Mar 2004
    Posts
    220

    HD/CPU/Programming querying

    I need to know how I would go about quering certain things about certain devices on win xp.

    I need to query the current size on the hard drive, and the total possible space on the hard drive.

    I also need to find out the CPU load that i'm running at currently.

    I'm also needing to be able to communicate with winamp 5. Specifically, I want to be able to play a song, stop a song, and pause a song within my program. I would like to be able to find out the song name that Winamp is currrently playing, and the total song length, current song time, and all that good stuff.

    If possible, I would like to know how to program a bandwidth meter of sorts. Checking what the current upload/download bandwidth is on the network. My current setup has the modem going through the USB port..not ethernet(certain reasons disable me to set this up, not about to explain, to much space).

    I've never done anything quite like this and I figure it would be an interesting experience to learn how to do some of this stuff. I don't expect there to be any sort of gui with this, I can do that myself. Really all I want to learn how to do is query these values and put them in to the appropriate variables for later use and manipulation.
    OS: Windows XP Pro CE
    IDE: VS .NET 2002
    Preferred Language: C++.

  2. #2
    Registered User
    Join Date
    Sep 2004
    Location
    California
    Posts
    3,268
    Here is how to do your HD queries:

    Code:
    DWORD d1,d2,d3,d4;
    unsigned int freespace, totalspace;
    if(GetDiskFreeSpace("c:\\", &d1, &d2, &d3, &d4))
    {
        freespace = d1 * d2 *d3;
        totalspace = d1 * d2 * d4;
    }
    To get the CPU usage information, you can look into using Performance Data Helper.

    As for interacting with winamp, you will probably need to use google for that one. See if winamp has any sort of API you can use.

    For monitoring internet activity, I suggest you take a look at the Code Project article here:
    http://www.codeproject.com/internet/winnetstat.asp

    Let me know if you have any questions.

  3. #3
    Registered User
    Join Date
    Mar 2004
    Posts
    220
    So far my only question is, what do d1-4 correspond to? Also, my assumption that GetDiskFreeSpace() is in windows.h is correct, yes?
    -I haven't tried this yet, have alot to do today >_>
    OS: Windows XP Pro CE
    IDE: VS .NET 2002
    Preferred Language: C++.

  4. #4
    Registered User
    Join Date
    Sep 2004
    Location
    California
    Posts
    3,268
    Take a look at the function here. That should answer your questions about what the passed parameters mean. You are correct in assuming that windows.h is the required header.

Popular pages Recent additions subscribe to a feed

Similar Threads

  1. Connecting to a mysql server and querying problem
    By Diod in forum C++ Programming
    Replies: 8
    Last Post: 02-13-2006, 10:33 AM
  2. Help with querying the data in memory
    By htn407 in forum C++ Programming
    Replies: 5
    Last Post: 04-20-2005, 06:04 PM