Click here to Skip to main content
16,017,944 members
Home / Discussions / C / C++ / MFC
   

C / C++ / MFC

 
GeneralCOM Exe Link error Pin
VCSharp0071-Jun-05 18:07
VCSharp0071-Jun-05 18:07 
GeneralRe: COM Exe Link error Pin
Christian Graus1-Jun-05 18:16
protectorChristian Graus1-Jun-05 18:16 
GeneralRe: COM Exe Link error Pin
VCSharp0071-Jun-05 21:00
VCSharp0071-Jun-05 21:00 
GeneralRe: COM Exe Link error Pin
NormDroid1-Jun-05 23:23
professionalNormDroid1-Jun-05 23:23 
GeneralRe: COM Exe Link error Pin
VCSharp0072-Jun-05 3:13
VCSharp0072-Jun-05 3:13 
GeneralHi All Pin
Sreekanth Muralidharan1-Jun-05 18:01
Sreekanth Muralidharan1-Jun-05 18:01 
GeneralRe: Hi All Pin
ThatsAlok1-Jun-05 19:18
ThatsAlok1-Jun-05 19:18 
GeneralAbout <b>FindFirstChangeNotification</b> and <b>ReadDirectoryChangeW</b> Pin
a_du1-Jun-05 16:31
a_du1-Jun-05 16:31 
hi,
i am developing a folder watching application. i want to use the fuction FindFirstChangeNotification and ReadDirectoryChangeW.
The problem here is when i create a MFC project using Dialog approach
i inlcude the sample code MSDN provide in a button handler function, and if i run it, the application will hung and i have to use task manager to close it.
the same thing happen if i use ReadDirectoryChangeW.
however if i put the same code in a win32 application project( using MFC shared .dll ), it can works well.
Pls help, thanks, the msdn sample code is below:


DWORD dwWaitStatus;
HANDLE dwChangeHandles[2];

// Watch the C:\WINDOWS directory for file creation and
// deletion.

dwChangeHandles[0] = FindFirstChangeNotification(
"C:\\WINDOWS", // directory to watch
FALSE, // do not watch the subtree
FILE_NOTIFY_CHANGE_FILE_NAME); // watch file name changes

if (dwChangeHandles[0] == INVALID_HANDLE_VALUE)
ExitProcess(GetLastError());

// Watch the C:\ subtree for directory creation and
// deletion.

dwChangeHandles[1] = FindFirstChangeNotification(
"C:\\", // directory to watch
TRUE, // watch the subtree
FILE_NOTIFY_CHANGE_DIR_NAME); // watch dir. name changes

if (dwChangeHandles[1] == INVALID_HANDLE_VALUE)
ExitProcess(GetLastError());

// Change notification is set. Now wait on both notification
// handles and refresh accordingly.

while (TRUE)
{

// Wait for notification.

dwWaitStatus = WaitForMultipleObjects(2, dwChangeHandles,
FALSE, INFINITE);

switch (dwWaitStatus)
{
case WAIT_OBJECT_0:

// A file was created or deleted in C:\WINDOWS.
// Refresh this directory and restart the
// change notification. RefreshDirectory is an
// application-defined function.

RefreshDirectory("C:\\WINDOWS")
if ( FindNextChangeNotification(
dwChangeHandles[0]) == FALSE )
ExitProcess(GetLastError());
break;

case WAIT_OBJECT_0 + 1:

// A directory was created or deleted in C:\.
// Refresh the directory tree and restart the
// change notification. RefreshTree is an
// application-defined function.

RefreshTree("C:\\");
if (FindNextChangeNotification(
dwChangeHandles[1]) == FALSE)
ExitProcess(GetLastError());
break;

default:
ExitProcess(GetLastError());
}
}

GeneralRe: About <b>FindFirstChangeNotification</b> and <b>ReadDirectoryChangeW</b> Pin
ThatsAlok1-Jun-05 18:51
ThatsAlok1-Jun-05 18:51 
GeneralRe: About <b>FindFirstChangeNotification</b> and <b>ReadDirectoryChangeW</b> Pin
a_du1-Jun-05 23:41
a_du1-Jun-05 23:41 
GeneralRe: About <b>FindFirstChangeNotification</b> and <b>ReadDirectoryChangeW</b> Pin
ThatsAlok1-Jun-05 23:55
ThatsAlok1-Jun-05 23:55 
GeneralRe: About <b>FindFirstChangeNotification</b> and <b>ReadDirectoryChangeW</b> Pin
S. Senthil Kumar1-Jun-05 23:45
S. Senthil Kumar1-Jun-05 23:45 
GeneralRe: About <b>FindFirstChangeNotification</b> and <b>ReadDirectoryChangeW</b> Pin
ThatsAlok1-Jun-05 23:57
ThatsAlok1-Jun-05 23:57 
GeneralPostMessage causing hang... Pin
Ian Bowler1-Jun-05 16:25
Ian Bowler1-Jun-05 16:25 
GeneralRe: PostMessage causing hang... Pin
Christian Graus1-Jun-05 16:43
protectorChristian Graus1-Jun-05 16:43 
GeneralRe: PostMessage causing hang... Pin
Ian Bowler1-Jun-05 16:48
Ian Bowler1-Jun-05 16:48 
GeneralRe: PostMessage causing hang... Pin
Christian Graus1-Jun-05 16:51
protectorChristian Graus1-Jun-05 16:51 
GeneralRe: PostMessage causing hang... Pin
S. Senthil Kumar1-Jun-05 23:50
S. Senthil Kumar1-Jun-05 23:50 
GeneralRe: PostMessage causing hang... Pin
Nilesh K.1-Jun-05 16:49
Nilesh K.1-Jun-05 16:49 
GeneralRe: PostMessage causing hang... Pin
Ian Bowler1-Jun-05 16:57
Ian Bowler1-Jun-05 16:57 
GeneralRe: PostMessage causing hang... Pin
Nilesh K.1-Jun-05 17:02
Nilesh K.1-Jun-05 17:02 
GeneralRe: PostMessage causing hang... Pin
Ian Bowler1-Jun-05 17:04
Ian Bowler1-Jun-05 17:04 
GeneralRe: PostMessage causing hang... Pin
Nilesh K.1-Jun-05 17:14
Nilesh K.1-Jun-05 17:14 
GeneralRe: PostMessage causing hang... Pin
Ian Bowler1-Jun-05 17:19
Ian Bowler1-Jun-05 17:19 
GeneralRe: PostMessage causing hang... Pin
Nilesh K.1-Jun-05 17:31
Nilesh K.1-Jun-05 17:31 

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.