|
Hi,
I have an application that writes hundreds of small files (video) to the disk.
i want to be able to limit the size of disk the application is using, so when a certain quota is reached, it starts deleting the oldest files to make room.
the files are saved in directories named after the date they were created in, and under another directory, that specifies it's source, so going through all these files every time the limit is near may be inefficient, but i have to support a directory structure clear enough for a user to access manually later, so i can't just put them all in one directory and sort by date.
any suggestions on strategies to this sort of disk management ?
|
|
|
|
|
This is what disk quotas is for. However, I'm not sure how to enable it programmatically. My first guess, since it's a policy-level change, is it's not a trivial task. This might be a starting point.
"When I was born I was so surprised that I didn't talk for a year and a half." - Gracie Allen
|
|
|
|
|
Unless i didn't understand - that's not the solution i'm looking for. The disk quota prevents writing new files, but does not provide any kind of FIFO mechanism to automatically delete the oldest files.
thanks for trying.
|
|
|
|
|
Well, your initial requirements seemed to be in two pieces. First, you wanted to limit the space used by the application, and second, you wanted to delete old files. Disk quotas would handle the first, but you'd need something like a service to handle the second.
"When I was born I was so surprised that I didn't talk for a year and a half." - Gracie Allen
|
|
|
|
|
If the dir tree starts from a fixed root, try to iterate through the tree via ::FindFirstFile, ::FindNextFile, ::FindClose, check the disk quota, and if a new file would overcome the limit delete the oldest one. It's very easy to implement, and can optimized just caching the prev dimension and remembering some few old files in order to iterate only when needed.
Hope this helps.
Regards,
Andrea
|
|
|
|
|
Greetings,
Did not see this mentioned in a search. I recently went to a dual monitor setup (left/right) and I now have a nice big play area. 8-) But in Visual Studio, when I open a file, it creates a HUGE window that spans the whole workspace. I can't seem to find any setting that controls this. Is there any way I can tell Visual Studio what size of window to open by default?
Thanks!...Steve
|
|
|
|
|
If using Visual Studio .Net 2003, then go to Tools -> Options and under Environment, click General.
On this page, you can choose either the tabbed view or the MDI view, as in old Visual Studio 6.0. VS must be restarted in order for the effect to be applied.
-Antti Keskinen
----------------------------------------------
The definition of impossible is strictly dependant
on what we think is possible.
|
|
|
|
|
Thanks, but I am using V6.0, not .net. I should have been more specific. I'd like to use .net, I have it, but some of the off-the-shelf components we use are not compatible, so can't compile our C++ in it.
Thanks again Antti!
Steve
|
|
|
|
|
Hi all,
I have a dialog that have to do something when it gains the focus.
The dialog is derived by CDialog and contains some controls.
I tried w/ CWnd::OnKillFocus and CWnd::OnSetFocus but my overloaded funcs are never called. The func CWnd::OnLButtonDown works well but I also need to know when the dialog loses the input.
Could you please help me?
Thanx a lot.
Best regards,
Andrea
|
|
|
|
|
De Nardis Andrea wrote:
I have a dialog that have to do something when it gains the focus.
Check out the WM_ACTIVATE and/or WM_ACTIVATEAPP messages.
"When I was born I was so surprised that I didn't talk for a year and a half." - Gracie Allen
|
|
|
|
|
Hi David,
unfortunately it does not work.
My dialog is a window inside a frame in a SDI application. I checked w/ Spy++ and it does not receive any WM_ACTIVATE msg.
Have u got any idea?
Sorry if I am annoying u w/ silly question.
Thanx a lot.
Bye,
Andrea
|
|
|
|
|
But how do i assign some uneditable text to a rich text control which will change to some other text when clicking on the diferent Sub-Tree Controls.Can you please give me some code as i am not habituated to MFC.
|
|
|
|
|
bunty2k4 wrote:
But how do i assign some uneditable text to a rich text control...
How text is added to a control has nothing to do with whether it is editable or not. Use SetWindowText() , Paste() , and ReplaceSel() to put text into the control.
To make the control uneditable, use the SetReadOnly(TRUE) or EnableWindow(FALSE) methods.
"When I was born I was so surprised that I didn't talk for a year and a half." - Gracie Allen
|
|
|
|
|
I am trying to develop a morabaraba game in c++ Builder and i have completed the board but my problem is placing the pieces.please help me out.
Let freedom reign
|
|
|
|
|
I am programming some "wrapper' software in Visual C++ 6.0 to control some 3rd party software that is written in HTML and has java script within the code. The HTML has buttons for making certain selections in the HTML file. I would like to programmatically make partial button selections and force the onclick to happen. I would appreciate any help I can get.
Freeman Taylor
|
|
|
|
|
I don't think it's possible to wrap C++ compiled code around html/javascript. You can interface but not wrap.
|
|
|
|
|
I guess wrap is not the term I should have used. Interface is what I am doing. I have successfully interfaced with the HTML file. Now I need to be able to control the buttons within the HTML file and that is what I have not been successful in doing. Any help would be appreciated.
Freeman Taylor
|
|
|
|
|
I you are using a class derived from CHtmlView you can do most anything you want with the html and with the Javascript including calling C++ code from JS and vice-versa.
To call a JS function you can use: execScript()
This is a snippet from my Surfulater app code:
MSHTML::IHTMLDocument2Ptr pDoc( GetHtmlDocument() );
if ( pDoc != NULL )
{
_variant_t vtRet;
_bstr_t bstrFunc = _T("EndEditing()");
vtRet = pDoc->GetparentWindow()->execScript( bstrFunc, L"JScript" );
}
See: http://www.codeproject.com/com/jscalls.asp#xx229574xx[^]
There is a lot of good documentation and sample code around on this subject. Yell out if you need more pointers.
Neville Franks, Author of ED for Windows www.getsoft.com and coming soon: Surfulater www.surfulater.com
|
|
|
|
|
If I let the user open a file through GetOpenFileName, how to have the customizations done on that dialog box stay from one open to another ?
If the user switches to the detailed view and selects new columns (choose details), how to have to columns back the next time he wants to open a file ?
Visual Studio.Net File, Open, File function does this !
... but my app does not
Help, please !
|
|
|
|
|
Hi everyone,
I am writing an application that can replace a keypress with another one, e.g. if I press the 'm' key on the keyboard, my application detects it and replaces it with 'x' for example.
This is achieved by setting a low level keyboard hook.
Up to now, the replacement map is hard-coded into the hook dll, but I want to configure it on the fly with a program in the TNA.
My question:
Is there a standard way of communication between my hook dll and the config program (i'm planning a callback function that is called everytime a key is pressed. it returns the replacement key) or do I have to think of my own with perhaps ReadProcessMemory, a MMF or something like that??
thx in advance,
Oliver
|
|
|
|
|
I am setting a socket option to use the KeepAlive feature...using setsocketopt(). If there is an error or break in the network connetion an error code is generated...but this can take minutes. I need an indication in seconds that there is a problem. Is there a way to do this??
Thanks,
Jerry
|
|
|
|
|
Last I checked the RFC (10 years ago) the timeout was 2 hours! If you need less you need to impliment that yourself. Basicly you need to ping the other end every second, and check for errors. However TCP does in order delivery, so if one packet is lost but the connection is otherwise good (this is a normal situation!) it can take more than one second for the retry.
You can get around this with UDP. In fact it might be better to use UDP for your keep alive because then you know which packets are lost, and when things are arriving out of order.
|
|
|
|
|
Hello, i am bunty, i needed some help, i want to learn more about c++ , i am currently studying it but i am failing to get it in my heads.I immediately need a program built in which:-
1)There will be a built in User Id and password for the startup of the program.It has to be password protected to ward off prying eyes.
2)it will have a treeControl on the leftside pane on clicking different sub-tree items on the left pane there will be a display window which will show different pre-built in written stuff which is un-editable.
I need it written in VC++.Please answer me through this column.Please help me someone.
|
|
|
|
|
|
Hello, i am bunty, i needed some help, i want to learn more about c++ , i am currently studying it but i am failing to get it in my heads.I immediately need a program built in which:-
1)There will be a built in User Id and password for the startup of the program.It has to be password protected to ward off prying eyes.
2)it will have a treeControl on the leftside pane on clicking different sub-tree items on the left pane there will be a display window which will show different pre-built in written stuff which is un-editable.
I need it written in VC++.Please answer me through this column.Please help me someone.
|
|
|
|