|
> Raymond Chen described a method for determining whether a folder is part of the recycle bin
Very bad "method".
(and avoid this poor blog (plenty of wrong notions, not professional at all..))
|
|
|
|
|
I know that sending WM_CLOSE or WM_DESTROY or WM_QUIT can destory a window created by other thread.
But this is not working when the target window is child window(With WS_CHILD Style, like property window in SDI).
[My Question is]
Can I destory other thread's child window?
If I can, please give me some advise about how to do it.
|
|
|
|
|
Did u open the thread with full access permission?
Величие не Бога может быть недооценена.
|
|
|
|
|
I am writing a text file . open it and write it any thing. Now I write a programme that open the file and read it . but I fail to read that data i write . As I save the data on text file by pressing save button and then read file by programme i am able to get data. why it is happenning ??. Is it neccessary to save the data before read . is there any method to read data from internal buffer of file that is not saved .
Trioum
|
|
|
|
|
trioum wrote: I am writing a text file . open it and write it any thing. Now I write a programme that open the file and read it . but I fail to read that data i write .
What do you mean exactly ? Do you open your text file with a program like notepad and then add some text to your file, without saving the file and then try to get back that data from the file directly ?
If you are wondering why this doesn't work, well, that's simply because you didn't save your file. The modifications are not commited to your file until you save it. In fact the modifications are kept in the "internal buffer" of notepad and there's no way to retrieve this information from the file directly.
trioum wrote: Is it neccessary to save the data before read
Yes
trioum wrote: is there any method to read data from internal buffer of file that is not saved .
No, because this data is kept in notepad, and not in the file.
|
|
|
|
|
Is there any way to retrieve that data from notepad
Trioum
|
|
|
|
|
But why do you want to do such a thing ? Why do you want to retrieve data which has not been saved to the file ?
Could you explain a bit what you are trying to achieve ?
|
|
|
|
|
yes reason for that .actually I have xml file which is updating continously by a third party software .
And I want to add its data into database . I open it as text file parse it data and add into the data base ,but problem is that it is not updated data that is in its buffer . it shows last updated data . and there is no way to save the xml file every milisecond .how can I solve my problem
Trioum
|
|
|
|
|
What does it have to do with notepad ? If your third party software updates the file directly, then there's nothing to do with notepad here.
Are you sure you read your data correctly ?
|
|
|
|
|
yes I read it correctly I open it as fopen("file.xml",rb);
Trioum
|
|
|
|
|
But what does notepad have to do here ? I guess your third party software saves the file directly, it doesn't use notepad to "save its data" ?
trioum wrote: yes I read it correctly I open it as fopen("file.xml",rb);
That doesn't mean that you are reading it correctly afterwards. It is also possible that your third party program is unable to write the data to the file because you still have the file open.
|
|
|
|
|
Cedric Moonen wrote: But what does notepad have to do here ?
Nothing. You mentioned it first (as an example), and the OP just concurred.
"Old age is like a bank account. You withdraw later in life what you have deposited along the way." - Unknown
"Fireproof doesn't mean the fire will never come. It means when the fire comes that you will be able to withstand it." - Michael Simmons
|
|
|
|
|
He was talking about a program in which he was writing the text file and saving it. Notepad was just an example but I don't know what this program (being notepad or whatever else) has something to do with the question...
|
|
|
|
|
Hello trioum,
When an application is modifying disk clusters at a very high speed... the NT Cache Manager could buffer these disk changes to avoid thrashing the drive. You can call the FlushFileBuffers Function[^] and flush the buffers associated with the handle. Another option is to open the file with FILE_FLAG_WRITE_THROUGH and FILE_FLAG_NO_BUFFERING to ask the cache manager to disable buffering.
INFO: FILE_FLAG_WRITE_THROUGH and FILE_FLAG_NO_BUFFERING[^]
You should be aware that these CreateFile flags can have an enormous negative impact on disk performance.
Best Wishes,
-David Delaune
|
|
|
|
|
I cannot use flushfilebuffer function because it is already opened for write access by third party software. I can only read it
Trioum
|
|
|
|
|
trioum wrote: I cannot use flushfilebuffer function because it is already opened for write access by third party software.
Sure you can.
Here is a little professional tip that Mark Russinovich used to create his Sync v2.0[^] disk flusher.
BOOL FlushDiskDrive(TCHAR *szDrive)
{
BOOL bRet = FALSE;
HANDLE h = CreateFile(szDrive, GENERIC_READ|GENERIC_WRITE, FILE_SHARE_READ|FILE_SHARE_WRITE,NULL,OPEN_EXISTING,0,NULL);
if(INVALID_HANDLE_VALUE != h)
{
bRet = FlushFileBuffers(h);
CloseHandle(h);
}
return bRet;
}
FlushDiskDrive(_T("\\\\.\\\\C:));
What we are doing here is opening the disk volume and flushing the entire volume cache. This code will not work for removable USB drives. This code also requires Administrator privileges. It is possible that a standard user with the FILE_FLAG_BACKUP_SEMANTICS permission may be able to use it, I am not certain and do not have time to test... I am leaving the office in a few minutes.
Let me know if this works for you.
Best Wishes,
-David Delaune
|
|
|
|
|
Thanks for I will R&D and let you know
Trioum
|
|
|
|
|
No it is not working as I want . What I do I open a note pad in c drive and type something . and the run your code by specifying "c" drive .code run successfully but data in notepad not saved .according to you data in notepad must be saved???.
Trioum
|
|
|
|
|
You lost me here. Why are we suddenly talking about notepad? Based on prior thread posts I thought you had problems flushing an XML file from a third-party software.
trioum wrote: but data in notepad not saved .according to you data in notepad must be saved???.
What are you asking here? Are you actually asking me why text in notepad memory is not being saved to disk when you flush the mounted volume?
Unfortunately I do not think we are on the same level here.
Good Luck,
-David Delaune
|
|
|
|
|
I first check with xml file is it not working then with text file . in both it is not working
Trioum
|
|
|
|
|
Hello.
I am using ::SHEmptyRecycleBin(NULL, NULL, SHERB_NOCONFIRMATION|SHERB_NOPROGRESSUI|SHERB_NOSOUND);
to empty recycle bin in a utility that checks the various aspects of a PC like if antivirus is installed or not, firewall enabled or not etc. To empty recycle bin I use the above call. I have included "shellapi.h" and that's all.
Am I missing something? I thought this is all I need to do. I am using VS2005.
Regards.
|
|
|
|
|
I think yes.. if you wnat more information check the link[^]
|
|
|
|
|
Could not really see where I made a mistake. Reading that article - well, I did that before I posted here. But still I reread it. Still lost.
Regards.
|
|
|
|
|
What is real issue?
Величие не Бога может быть недооценена.
|
|
|
|
|
Getting a return value of E_NOINTERFACE when I was expecting S_OK. I know, I made a mistake. Now where is it? That's the question I am trying to solve.
Regards.
|
|
|
|