Click here to Skip to main content
15,922,584 members
Home / Discussions / C / C++ / MFC
   

C / C++ / MFC

 
GeneralRe: Problem while switching from debugging mode to release mode Pin
Naveen30-Aug-07 0:41
Naveen30-Aug-07 0:41 
GeneralRe: Problem while switching from debugging mode to release mode Pin
Sangeetha_J30-Aug-07 1:32
Sangeetha_J30-Aug-07 1:32 
GeneralRe: Problem while switching from debugging mode to release mode Pin
Naveen30-Aug-07 2:13
Naveen30-Aug-07 2:13 
GeneralRe: Problem while switching from debugging mode to release mode Pin
Sangeetha_J30-Aug-07 2:20
Sangeetha_J30-Aug-07 2:20 
GeneralRe: Problem while switching from debugging mode to release mode Pin
Naveen30-Aug-07 2:43
Naveen30-Aug-07 2:43 
GeneralRe: Problem while switching from debugging mode to release mode Pin
Sangeetha_J30-Aug-07 2:59
Sangeetha_J30-Aug-07 2:59 
GeneralRe: Problem while switching from debugging mode to release mode Pin
Naveen30-Aug-07 3:02
Naveen30-Aug-07 3:02 
GeneralRe: Problem while switching from debugging mode to release mode Pin
Sangeetha_J30-Aug-07 5:19
Sangeetha_J30-Aug-07 5:19 
GeneralRe: Problem while switching from debugging mode to release mode Pin
Ahmad_Hassan30-Aug-07 20:09
Ahmad_Hassan30-Aug-07 20:09 
QuestionRe: Problem while switching from debugging mode to release mode Pin
David Crow30-Aug-07 3:25
David Crow30-Aug-07 3:25 
GeneralRe: Problem while switching from debugging mode to release mode Pin
Sangeetha_J31-Aug-07 1:46
Sangeetha_J31-Aug-07 1:46 
QuestionDebugging a release build Pin
Waldermort30-Aug-07 0:10
Waldermort30-Aug-07 0:10 
AnswerRe: Debugging a release build Pin
Naveen30-Aug-07 0:20
Naveen30-Aug-07 0:20 
GeneralRe: Debugging a release build Pin
Waldermort30-Aug-07 0:31
Waldermort30-Aug-07 0:31 
GeneralRe: Debugging a release build Pin
Naveen30-Aug-07 0:53
Naveen30-Aug-07 0:53 
GeneralRe: Debugging a release build Pin
Waldermort30-Aug-07 0:57
Waldermort30-Aug-07 0:57 
GeneralRe: Debugging a release build Pin
Naveen30-Aug-07 0:59
Naveen30-Aug-07 0:59 
GeneralRe: Debugging a release build Pin
Waldermort30-Aug-07 1:54
Waldermort30-Aug-07 1:54 
GeneralRe: Debugging a release build Pin
Naveen30-Aug-07 2:09
Naveen30-Aug-07 2:09 
GeneralRe: Debugging a release build Pin
Waldermort30-Aug-07 2:13
Waldermort30-Aug-07 2:13 
GeneralRe: Debugging a release build Pin
jhwurmbach30-Aug-07 2:20
jhwurmbach30-Aug-07 2:20 
GeneralRe: Debugging a release build Pin
Cyrilix30-Aug-07 20:01
Cyrilix30-Aug-07 20:01 
GeneralRe: Debugging a release build Pin
Waldermort30-Aug-07 20:07
Waldermort30-Aug-07 20:07 
QuestionFileSystemWatcher in C++ - how to stop? Pin
dkwo30-Aug-07 0:05
dkwo30-Aug-07 0:05 
Hi,
in my VC++ 2005 application I am using FileSystemWatcher in order to look for a new file. This code works so far:

void OnCreated (Object* source, FileSystemEventArgs* e)<br />
{<br />
SendEventInfo(e->FullPath);<br />
}<br />
<br />
void CAxControlDlg::StartWaitforStatusFile(void)<br />
{<br />
FileSystemWatcher* pWatcher = new FileSystemWatcher(path);<br />
pWatcher->Filter = m_statusfile_name;<br />
<br />
FileWatcherEvents* fileEvents = new FileWatcherEvents(pWatcher, GetSafeHwnd(), WM_FILE_CREATED);<br />
pWatcher->Created += new FileSystemEventHandler(fileEvents, &FileWatcherEvents::OnCreated); <br />
}




The open question is how to stop the FileSystemWatcher. If a file has been created and processed a new FileSystemWatcher should be started again. But then the task is running twice, i.e. the file is found two times etc..

I would like to stop pWatcher, but as this is defined in a function I can't stop it in another function. The solution would be to declare pWatcher as a member variable. But if I add

FileSystemWatcher* pWatcher;

to the header file

I get error C3265 (cannot declare a managed 'managed construct' in an unmanaged 'unmanaged construct').

Any ideas how to solve that? The code is compiled with the "/clr:oldSyntax" option.

Thanks in advance for your help.
AnswerRe: FileSystemWatcher in C++ - how to stop? Pin
Waldermort30-Aug-07 0:19
Waldermort30-Aug-07 0: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.