Link to home
Start Free TrialLog in
Avatar of jurij
jurij

asked on

drive info

How to determine drive size / free space / label / etc. in visual studio c++ (6)?
A short example if you will, please!
Avatar of jkr
jkr
Flag of Germany image

Avatar of jurij
jurij

ASKER

Tought so..
Why does my app crash,when i try to use

ULARGE_INTEGER free;
ULARGE_INTEGER total;
ULARGE_INTEGER totalfree;

GetDiskFreeSpaceEx("C:\\",free,total,totalfree);

I get the same resoults with GetVolumeInformation(..).
Any clues?
TNX!
Avatar of jurij

ASKER

free and the others are pointers to ULARGE_INTEGER..
ULARGE_INTEGER free;
ULARGE_INTEGER total;
ULARGE_INTEGER totalfree;

GetDiskFreeSpaceEx("C:\\",&free,&total,&totalfree);
Avatar of jurij

ASKER

Of course! TNX!

One more problem...
Tha data I recive is not correct.. Is "C:\\" right? or am I using my variables wrong?
my code afther I recive the data:

tmp tmp[15];
sprintf(tmp,'\n',free);
m_output.SetSelection(tmp);

TNX!
 
ASKER CERTIFIED SOLUTION
Avatar of jkr
jkr
Flag of Germany image

Link to home
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
Start Free Trial
Avatar of jurij

ASKER

TNX - it works.. but i don't know how to calculate used space - i can't substract two ULARGE_INTEGERs?

And I having some problems with "GetVolumeInformation" too.
----------------------------------------------------------
     char type_FS;
     DWORD name_length;
     DWORD serial_num;
     char name;

GetVolumeInformation("C:\\",&name,30,&serial_num,&name_length,NULL,&type_FS,10);
     sprintf(tmp,"%d",name);
     m_name.ReplaceSel(tmp);

     sprintf(tmp,"%d",serial_num);
     m_serial_num.ReplaceSel(tmp);

     sprintf(tmp,"%d",type_FS);
     m_FS.ReplaceSel(tmp);
----------------------------------------------------------
All I get are some strange numbers - thoug i should get some characters - at least for drive name and stuff..
My output:
name: 84
serial_num: 185212388
FS_type: 70
I can't make heads or tails from this.. :/