Click here to Skip to main content
15,905,683 members
Home / Discussions / C / C++ / MFC
   

C / C++ / MFC

 
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 
GeneralRe: FileSystemWatcher in C++ - how to stop? [modified] Pin
dkwo30-Aug-07 0:25
dkwo30-Aug-07 0:25 
QuestionActive Directory Service Intertface ADsGetObject fails with 80004002 Pin
Killer329-Aug-07 23:45
Killer329-Aug-07 23:45 
QuestionVC6 to VS.NET 2002 Port Errors Pin
Jason Teagle29-Aug-07 23:40
Jason Teagle29-Aug-07 23:40 
AnswerRe: VC6 to VS.NET 2002 Port Errors Pin
KarstenK30-Aug-07 0:43
mveKarstenK30-Aug-07 0:43 
GeneralRe: VC6 to VS.NET 2002 Port Errors Pin
Jason Teagle30-Aug-07 10:09
Jason Teagle30-Aug-07 10:09 
GeneralRe: VC6 to VS.NET 2002 Port Errors Pin
KarstenK30-Aug-07 20:18
mveKarstenK30-Aug-07 20:18 
QuestionGetting some error while using make file... Pin
Yashusid29-Aug-07 23:07
Yashusid29-Aug-07 23:07 
AnswerRe: Getting some error while using make file... Pin
Roger Broomfield29-Aug-07 23:44
Roger Broomfield29-Aug-07 23:44 
GeneralRe: Getting some error while using make file... Pin
Yashusid29-Aug-07 23:54
Yashusid29-Aug-07 23:54 
QuestionOpenGL, GLSL, C++, DLL, Delphi , f...ing mix Pin
Delfistyaosani29-Aug-07 23:05
Delfistyaosani29-Aug-07 23:05 
Questiondouble and long-double Pin
includeh1029-Aug-07 22:18
includeh1029-Aug-07 22:18 
AnswerRe: double and long-double Pin
toxcct29-Aug-07 22:26
toxcct29-Aug-07 22:26 
AnswerRe: double and long-double Pin
jhwurmbach29-Aug-07 23:11
jhwurmbach29-Aug-07 23:11 
AnswerRe: double and long-double Pin
Russell'30-Aug-07 0:07
Russell'30-Aug-07 0:07 
QuestionRe: double and long-double Pin
David Crow30-Aug-07 3:29
David Crow30-Aug-07 3:29 
Questionconst member variable issue Pin
Neo Andreson29-Aug-07 21:52
Neo Andreson29-Aug-07 21:52 

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.