Click here to Skip to main content
15,904,153 members
Home / Discussions / C / C++ / MFC
   

C / C++ / MFC

 
GeneralRe: converting byte to bit Pin
Christian Graus14-Jun-05 1:29
protectorChristian Graus14-Jun-05 1:29 
GeneralRe: converting byte to bit Pin
PJ Arends14-Jun-05 7:08
professionalPJ Arends14-Jun-05 7:08 
GeneralRe: converting byte to bit Pin
Christian Graus14-Jun-05 13:49
protectorChristian Graus14-Jun-05 13:49 
Questionhow to debug a helper object? Pin
ThinkingPrometheus14-Jun-05 0:54
ThinkingPrometheus14-Jun-05 0:54 
GeneralRelease in _RecordsetPtr Pin
Anonymous14-Jun-05 0:36
Anonymous14-Jun-05 0:36 
GeneralShell Extension On 64 bit Windows XP Pin
Bond0414-Jun-05 0:10
Bond0414-Jun-05 0:10 
Generalneed help!! please help me.. Pin
c_ngo13-Jun-05 20:39
c_ngo13-Jun-05 20:39 
GeneralRe: need help!! please help me.. Pin
Bob Stanneveld13-Jun-05 23:51
Bob Stanneveld13-Jun-05 23:51 
GeneralRe: need help!! please help me.. Pin
Nilesh K.14-Jun-05 0:25
Nilesh K.14-Jun-05 0:25 
GeneralRe: need help!! please help me.. Pin
Christian Graus14-Jun-05 1:21
protectorChristian Graus14-Jun-05 1:21 
GeneralRe: need help!! please help me.. Pin
Bob Stanneveld14-Jun-05 3:32
Bob Stanneveld14-Jun-05 3:32 
GeneralRe: need help!! please help me.. Pin
c_ngo15-Jun-05 15:30
c_ngo15-Jun-05 15:30 
GeneralRe: need help!! please help me.. Pin
c_ngo15-Jun-05 15:35
c_ngo15-Jun-05 15:35 
QuestionHow to remove close button from window? Pin
amrutajoshi13-Jun-05 20:36
amrutajoshi13-Jun-05 20:36 
AnswerRe: How to remove close button from window? Pin
Bob Stanneveld13-Jun-05 23:58
Bob Stanneveld13-Jun-05 23:58 
AnswerRe: How to remove close button from window? Pin
Stlan14-Jun-05 0:01
Stlan14-Jun-05 0:01 
GeneralFileSystemWatcher - File used by another process Pin
g3e13-Jun-05 23:36
g3e13-Jun-05 23:36 
Hi,
I've written a windows service to parse files.It uses the FileSystemWatcher class in C# to sniff a folder for particular type of files. But when the files were being processed, i repeatedly get the error "The process cannot access the file "AAA" because it is being used by another process". To overcome this problem, i added the following. lines of code
<br />
<br />
public bool ParseEnvFile(string strFilePath)<br />
{<br />
			try<br />
			{<br />
				using(FileStream fs = new FileStream(strFilePath, FileMode.Open, FileAccess.Read, FileShare.Read))<br />
				{<br />
					// Do some processing here<br />
					fs.Close();<br />
					m_nReadAttempts = 0;<br />
				}<br />
			}<br />
			catch(IOException ex)<br />
			{<br />
				if(m_nReadAttempts < 3)<br />
				{<br />
					Thread.Sleep(2000);<br />
					m_nReadAttempts++;<br />
					return ParseEnvFile(strFilePath);<br />
				}<br />
				else<br />
				{<br />
					throw ex;<br />
				}<br />
			}<br />
.....<br />
}<br />


But even this did not solve the problem. The exception still kept coming, though less frequently.
So I was forced to add a Timer event(runs every 5 mins) that would pick up all the files that were left over because of the exception.
Now, my problem is this:
When a file gets created in the folder, sometimes both the OnFileCreated event and the timer event try to access the file at the same time. Within my
service, I'm required to open the file in write mode and update some contents. I find that at times the file that gets created ends up as a 0KB file (Note: when it initially got created the file had some content in it)!!!!

Any ideas on why this happens?
Thanks for any help in resolving this problem.
Questionhow to change debug options? Pin
ThinkingPrometheus13-Jun-05 23:35
ThinkingPrometheus13-Jun-05 23:35 
GeneralExe to Dll Pin
Hemoji13-Jun-05 23:30
Hemoji13-Jun-05 23:30 
GeneralRe: Exe to Dll Pin
Rick York14-Jun-05 10:12
mveRick York14-Jun-05 10:12 
Generale trefreshes the BitMap image Pin
a_david12313-Jun-05 23:17
a_david12313-Jun-05 23:17 
GeneralRe: e trefreshes the BitMap image Pin
Christian Graus14-Jun-05 1:24
protectorChristian Graus14-Jun-05 1:24 
GeneralRe: e trefreshes the BitMap image Pin
a_david12315-Jun-05 20:27
a_david12315-Jun-05 20:27 
GeneralRe: e trefreshes the BitMap image Pin
Christian Graus16-Jun-05 12:08
protectorChristian Graus16-Jun-05 12:08 
General&quot;AfterEdit&quot; event not getting called Pin
Pazzuzu13-Jun-05 23:00
Pazzuzu13-Jun-05 23:00 

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.