|
Okay, thanks I'll take a look at the source. Its not that I'm using only one socket . I'll add support for more connections, but later. I only need blocking for listening and everything else asynchronous.
I guess, I'll have to kick-off some threads. Any good strategy for using blocking listening and non-blocking I/O, MULTITHREADEDly
|
|
|
|
|
Hi,
I wanted to get the path of Recycle Bin in vista. But when i used
SHGetFolderPath with CSIDL_BITBUCKET , it returns E_FAIL.
how can i get the path of Recycle bin in Vista.
thanks
Nitheesh
Jose Jo Martin
http://www.simpletools.co.in
|
|
|
|
|
The Recycle Bin isn't a real folder - it's a virtual folder that aggregates the recycle bin folders from all drives that have them. Look at the documentation[^]:
CSIDL_BITBUCKET (FOLDERID_RecycleBinFolder)
The virtual folder that contains the objects in the user's Recycle Bin.
Java, Basic, who cares - it's all a bunch of tree-hugging hippy cr*p
|
|
|
|
|
While Stuart is correct that the Recycle Bin is considered a virtual folder... copies of the files and the INFO/INFO2 database are stored in multiple physical locations on mounted disk drive volumes.
Raymond Chen described a method for determining whether a folder is part of the recycle bin:
How can I tell that a directory is really a recycle bin?[^]
As far as I know..all folders with COM class identifier CLSID_RecycleBin have always been created in the root of the volume. So in theory you would need to enumerate all folders in the volume root directory and use Raymond's function to determine if they are part of the recycle bin.
Best Wishes,
-David Delaune
|
|
|
|
|
So...I guess the best response to the OP would have been 'why do you want to do that? Because if you tell us what you really want to do, we can probably give you a better answer...'.
Java, Basic, who cares - it's all a bunch of tree-hugging hippy cr*p
|
|
|
|
|
This seems to be a recurring theme here on codeproject.com where a majority of the questions are poorly formed. When I determine that the author of the post does not know enough about the subject to properly form a question I try to include educational links and a brief summary in my comments to avoid future questions and elongated threads.
Best Wishes,
-David Delaune
|
|
|
|
|
Randor wrote: This seems to be a recurring theme here on codeproject.com
Not just on CP - at work, I'm often asking people 'and your real question is???'
Java, Basic, who cares - it's all a bunch of tree-hugging hippy cr*p
|
|
|
|
|
Hi David,
Sorry for not describing what i am actually want to do. Here is my problem.
I am doing a project in which i wanted to show the user the files in Recycle bin so that they can make sure that no necessary files are getting deleted in a mistake from the file system. And i am programmatically clearing the Recylcle bin using the API SHEmptyRecycleBin(). So when the user click on button with Caption "Open Recycle Bin" i need to show them with the files in it.
thanks
Nitheesh.
Jose Jo Martin
http://www.simpletools.co.in
|
|
|
|
|
Nitheesh George wrote: when the user click on button with Caption "Open Recycle Bin" i need to show them with the files in it.
A codeproject search provided this example:
How to programmatically use the Recycle Bin[^]
Best Wishes,
-David Delaune
|
|
|
|
|
> 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
|
|
|
|