|
WalderMort wrote: Also, I have just accounted for a further 4GB by giving myself access rights to the "System Volume Information".
Same here. It now seems that my numbers have gone the other way. GetDiskFreeSpaceEx() reports 28GB used bytes, but I am counting 30.3GB bytes used by files, a difference of 231.4MB. Hmmm...
"A good athlete is the result of a good and worthy opponent." - David Crow
"To have a respect for ourselves guides our morals; to have deference for others governs our manners." - Laurence Sterne
|
|
|
|
|
Haha, sounds like your loop could do with a little refining. Try the DeviceIoApproach as I mentioned earlier, you should get some more realistic values.
Waldermort
|
|
|
|
|
WalderMort wrote: Try the DeviceIoApproach as I mentioned earlier...
Which control code did you have in mind?
"A good athlete is the result of a good and worthy opponent." - David Crow
"To have a respect for ourselves guides our morals; to have deference for others governs our manners." - Laurence Sterne
|
|
|
|
|
you would need to use the FSCTL_GET_EXTENT_BUFFERS. The trouble is with this operation is that you don't know how large the buffer should be. I wrapped the call up in a class with the buffer as a static member. Each time the buffer is too small, I double the size and keep calling until successful.
The Extent count indicates how many fragments the file has, 0 indicates that it is located in the MFT. Each extent returned will then tell you how many clusters each fragment has. By adding these and multiplying by your drives 'bytes per cluster' you will find out exactly how much space a particular file/folder is taking.
Also be aware of NT's compressed runs which is indicated by a startLCN of -1. I still haven't managed to get my head around what this actualy means.
Waldermort
|
|
|
|
|
WalderMort wrote: If you know of a way to do this programaticaly I would be glad to hear.
I can 'get' the access rights, but haven't quite got the 'set' part down yet.
"A good athlete is the result of a good and worthy opponent." - David Crow
"To have a respect for ourselves guides our morals; to have deference for others governs our manners." - Laurence Sterne
|
|
|
|
|
You still working on that, lol.
To be honest, I didn't touch that part of my code yet, I'm still working on my class hierarchy.
I was thinking to use ShellExec() with the "runas" flag, change the security settings and store them into a file, which I believe cacls is able to do. This should, in theory, allow the origional settings to be replaced once complete. But like I said, I didn't try this yet and probably won't for another week or so.
If you manage to do it using another method, I would be interested to see how.
Waldermort
|
|
|
|
|
hi
i have establish a connection to remote computer by FTP and how to search file on remote computer in a particular directory and as soon as i found file i want to bring that file in my computer and search again for next file
plaese help me
thank u in advance
malik
|
|
|
|
|
If you are using MFC you could look into the CFtpFileFind class which is based on the CFileFind class
|
|
|
|
|
So exactly which part are you having trouble with?
"A good athlete is the result of a good and worthy opponent." - David Crow
"To have a respect for ourselves guides our morals; to have deference for others governs our manners." - Laurence Sterne
|
|
|
|
|
Hello to all,
right now i am doing a programm such that files selected by user will be uploaded on the server, now while uploading the files i want to invoke a progress bar dialog which will show the number of files uploaded and time left for uploading, through progress bar and this should be done without disturbing the process of uploading files. how it can be done? can anybody help me plz.
Thanks and Regards,
Anay Kulkarni
|
|
|
|
|
Put the progress control on a dialog, and show the dialog using a different thread. In mfc, you can use wroker thread.
|
|
|
|
|
NishantB++ wrote: and show the dialog in a different thread.
I would suggest the opposite: do the real work in a separate thread (in this case, the upload of the files) and regularly send messages with the current status to the progress dialog (which is in the main thread).
|
|
|
|
|
Thats also good , But it may a bit hard to implement (depends on the file upload code).
Anyway will it make any difference ?
|
|
|
|
|
NishantB++ wrote: Anyway will it make any difference ?
Yes, in your case, the progress dialog won't be a modal dialog (althought you call DoModal) because it is started in a separate thread. So, the user will still be able to interract with the main UI during the file upload, which is in general what you don't want.
Also, you still need to send messages (or find another way to communicate between the threads) because your dialog isn't aware of the current status of the upload. So, it doesn't make a difference.
|
|
|
|
|
Cedric Moonen wrote:Yes, in your case, the progress dialog won't be a modal dialog.
This is not correct. The dialog box will be modal. I have just checked it.
Cedric Moonen wrote:
Also, you still need to send messages
This case apply in both cases, whether you put the progress dialog in thread or the file upload code in thred.
The dialog box always need the current progress, which it doesnot have.
|
|
|
|
|
NishantB++ wrote: This is not correct. The dialog box will be modal. I have just checked it.
How did you check it ? Did you start a new thread, and in that thread you created a modal dialog and then checked if you could work with the main UI ?
|
|
|
|
|
Yes, I did the same.
Here is the code -
void CtestdlgDlg::OnBnClickedOk()
{
AfxBeginThread (MyControllingFunction, NULL);
}
UINT __cdecl MyControllingFunction( LPVOID pParam )
{
CMyDlg dlg;
dlg.DoModal ();
return 0;
}
|
|
|
|
|
What happen if you click on the ok button of your test dialog (not the one created in the thread but the one that was created originally) ?
|
|
|
|
|
The thread dialog pops up and now you are unable to click on the original dialog (Main Dlg).I mean, it shows the modal behaviour.
|
|
|
|
|
A simple modeless dialog with a few static controls and a progress control would suffice.
"A good athlete is the result of a good and worthy opponent." - David Crow
"To have a respect for ourselves guides our morals; to have deference for others governs our manners." - Laurence Sterne
|
|
|
|
|
I want to find the value of checkbox wother it is checked or unchecked.
Which function to use.
I kope GetDlgItemText() will not work.
Dhiraj Kumar Saini
|
|
|
|
|
CButton::GetCheck
Maxwell Chen
|
|
|
|
|
In addition to the MFC suggestion already provided, you can also send the control a BM_GETCHECK or BM_SETCHECK message.
"A good athlete is the result of a good and worthy opponent." - David Crow
"To have a respect for ourselves guides our morals; to have deference for others governs our manners." - Laurence Sterne
|
|
|
|
|
Hello Friends,
I am facing the problem of memory leak. In one of the application I am taking dynamic global object. And when I try to delete then in my WinMain() function before return 0; statement but it gives me assertion errror.
I am using somewhat like this;
<br />
myclass *obj = new myclass();<br />
<br />
INT WINAPI WinMain( ....)<br />
{<br />
delete obj;
return 0;<br />
<br />
}
the error is like this:
Debug assertion failed.
expression _BLOCK_TYPE_IS_VALID(pHead->nBlockUse) is invalid.
So I am using somewhat like this
INT WINAPI WinMain( ....)<br />
{<br />
delete (void *)obj;
return 0;<br />
<br />
}
Now my question is.
Now will there be any memory leak in the programme or not ???
|
|
|
|
|
I guess yes. The type info is corrupted.
Maxwell Chen
|
|
|
|