Click here to Skip to main content
15,911,711 members
Home / Discussions / C / C++ / MFC
   

C / C++ / MFC

 
AnswerRe: CListCtrl, how to iterate through all items? Pin
David Crow10-Sep-03 6:16
David Crow10-Sep-03 6:16 
GeneralRe: CListCtrl, how to iterate through all items? Pin
Anonymous10-Sep-03 6:40
Anonymous10-Sep-03 6:40 
GeneralXP Serial communication Pin
Arthur Westerman10-Sep-03 4:54
Arthur Westerman10-Sep-03 4:54 
GeneralcreateProcess questions Pin
ns10-Sep-03 4:46
ns10-Sep-03 4:46 
GeneralRe: createProcess questions Pin
Magnus Westin10-Sep-03 4:58
Magnus Westin10-Sep-03 4:58 
Generalerror Pin
ranjjj10-Sep-03 4:24
ranjjj10-Sep-03 4:24 
GeneralRe: error Pin
David Crow10-Sep-03 6:22
David Crow10-Sep-03 6:22 
GeneralWeird problem with FindFirstChangeNotification Pin
Magnus Westin10-Sep-03 3:16
Magnus Westin10-Sep-03 3:16 
The reason for this small test program was that I read on google about a possibility that you could not delete a directory that has a FindFirstChangeNotification watch on it. As it turned out, its no problem at all (at least on WinXP). But I noticed another stranger thing.

When I delete the directory in Explorer, the HANDLE is set to signal state and I get a continuous flow of "Something happened".

But when I delete the directory in Total Commander (new name for Windows Commander) I get error 5 (Access is denied.) from FindNextChangeNotification. And the program ends.

This is not really a question, since the correct implementation should check that the director (or file) you are watching still exists. But what really bothered me were the different results from Explorer and Total Commander. So I wondered if some one else has had this problem or if some one knows why this happens.

Here is the small test program I ran while deleting the directory (its written in Visual Studio 6.0 sp5):

int main( int argc, char* argv[] )
{
	HANDLE h = ::FindFirstChangeNotification( "d:\\test\\magnus", FALSE, FILE_NOTIFY_CHANGE_FILE_NAME );
	if( h == INVALID_HANDLE_VALUE )
	{
		std::cout << "Error on FFCN: " << ::GetLastError() << std::endl;
		return 0;
	}


	std::cout << "Entering loop" << std::endl;

	for( ;; )
	{
		DWORD dwWaitState = ::WaitForSingleObject( h, INFINITE );
		switch( dwWaitState )
		{
		case WAIT_OBJECT_0:
			std::cout << "Something happened" << std::endl;
			break;
		case WAIT_ABANDONED:
			std::cout << "Error WAIT_ABANDONED" << std::endl;
			break;
		case WAIT_TIMEOUT:
			std::cout << "Error WAIT_TIMEOUT" << std::endl;
			break;
		default:
			std::cout << "Error DEFAULT" << std::endl;
			break;
		}

		if( dwWaitState != WAIT_OBJECT_0 )
			break;

		if( ::FindNextChangeNotification( h ) == 0 )
		{
			std::cout << "Error on FNCN: " << ::GetLastError() << std::endl;
			break;
		}
	}

	::FindCloseChangeNotification( h );
	return 0;
}

Magnus
GeneralHHeelp Pin
Member 42425910-Sep-03 3:13
Member 42425910-Sep-03 3:13 
GeneralRe: HHeelp Pin
valikac10-Sep-03 9:24
valikac10-Sep-03 9:24 
GeneralRe: HHeelp Pin
Member 42425910-Sep-03 19:12
Member 42425910-Sep-03 19:12 
GeneralRe: HHeelp Pin
valikac11-Sep-03 11:41
valikac11-Sep-03 11:41 
GeneralRe: HHeelp Pin
Phil Hamer10-Sep-03 9:25
Phil Hamer10-Sep-03 9:25 
GeneralRe: HHeelp Pin
Member 42425910-Sep-03 19:09
Member 42425910-Sep-03 19:09 
QuestionShape file source code ?? Pin
David Chamberlain10-Sep-03 2:31
David Chamberlain10-Sep-03 2:31 
AnswerRe: Shape file source code ?? Pin
JWood10-Sep-03 4:15
JWood10-Sep-03 4:15 
GeneralICM Problem Pin
CodeBrain10-Sep-03 2:14
CodeBrain10-Sep-03 2:14 
GeneralCScrollView Help Pin
VanHlebar10-Sep-03 1:26
VanHlebar10-Sep-03 1:26 
GeneralRe: CScrollView Help Pin
Ryan Binns10-Sep-03 3:13
Ryan Binns10-Sep-03 3:13 
GeneralRe: CScrollView Help Pin
VanHlebar10-Sep-03 8:32
VanHlebar10-Sep-03 8:32 
GeneralCreating a Modal Dialog before calling DoModal() Pin
ohadp10-Sep-03 0:39
ohadp10-Sep-03 0:39 
GeneralRe: Creating a Modal Dialog before calling DoModal() Pin
vcplusplus10-Sep-03 1:45
vcplusplus10-Sep-03 1:45 
GeneralRe: Creating a Modal Dialog before calling DoModal() Pin
ohadp10-Sep-03 1:47
ohadp10-Sep-03 1:47 
GeneralRe: Creating a Modal Dialog before calling DoModal() Pin
Ryan Binns10-Sep-03 3:10
Ryan Binns10-Sep-03 3:10 
GeneralRe: Creating a Modal Dialog before calling DoModal() Pin
Member 42425910-Sep-03 3:19
Member 42425910-Sep-03 3:19 

General General    News News    Suggestion Suggestion    Question Question    Bug Bug    Answer Answer    Joke Joke    Praise Praise    Rant Rant    Admin Admin   

Use Ctrl+Left/Right to switch messages, Ctrl+Up/Down to switch threads, Ctrl+Shift+Left/Right to switch pages.