Click here to Skip to main content
16,004,806 members
Home / Discussions / C#
   

C#

 
GeneralRe: How to Print a form with controls in C# Pin
pahluwalia12-Dec-03 3:13
pahluwalia12-Dec-03 3:13 
GeneralISynchronizeInvoke Pin
LokiSD9-Dec-03 9:20
LokiSD9-Dec-03 9:20 
GeneralRe: ISynchronizeInvoke Pin
Heath Stewart9-Dec-03 9:49
protectorHeath Stewart9-Dec-03 9:49 
GeneralImage Colour Depth Problem Pin
Tristan Rhodes9-Dec-03 7:20
Tristan Rhodes9-Dec-03 7:20 
GeneralRe: Accessing variables from the code behind page Pin
Heath Stewart9-Dec-03 6:34
protectorHeath Stewart9-Dec-03 6:34 
GeneralFileStream question Pin
Tim Kohler9-Dec-03 6:16
Tim Kohler9-Dec-03 6:16 
GeneralRe: FileStream question Pin
Heath Stewart9-Dec-03 6:53
protectorHeath Stewart9-Dec-03 6:53 
GeneralRe: FileStream question Pin
Tim Kohler9-Dec-03 7:17
Tim Kohler9-Dec-03 7:17 
Thanks for the quick response Heath. Try adding a Thread.Sleep after you start that other thread so that the original thread still has the file open for writing. Before moving my stuff to the over simple example I submitted, I had it in different programs altogther. Any other suggestions?

I tried the exact same thing with CFile and it works:


try
{

//open for exclusive write
CStdioFile file;
BOOL bOpen1 = file.Open("C:\\timtest2.txt", CFile::modeWrite | CFile::modeCreate | CFile::shareDenyWrite);
file.WriteString("hi");
file.Flush();

//open a reader
CStdioFile f2;
BOOL bOpen2 = f2.Open("c:\\timtest2.txt", CFile::modeRead | CFile::shareDenyNone);
CString str;
f2.ReadString(str);

//try to open another writer --- this open fails
CStdioFile file3;
BOOL bOpen3 = file3.Open("C:\\timtest2.txt", CFile::modeWrite | CFile::modeCreate | CFile::shareDenyWrite);
file3.WriteString("hi");
file3.Flush();

}
catch (CFileException* pe)
{
pe->ReportError();
pe->Delete();
}


Argh!!

GeneralRe: FileStream question Pin
Heath Stewart9-Dec-03 7:28
protectorHeath Stewart9-Dec-03 7:28 
GeneralRe: FileStream question Pin
Tim Kohler9-Dec-03 7:37
Tim Kohler9-Dec-03 7:37 
GeneralRe: FileStream question Pin
Tim Kohler10-Dec-03 3:54
Tim Kohler10-Dec-03 3:54 
GeneralCreating XML Documents Pin
MrEyes9-Dec-03 5:28
MrEyes9-Dec-03 5:28 
GeneralRe: Creating XML Documents Pin
MrEyes9-Dec-03 6:02
MrEyes9-Dec-03 6:02 
GeneralRe: Creating XML Documents Pin
Heath Stewart9-Dec-03 6:24
protectorHeath Stewart9-Dec-03 6:24 
Generallong path to short path Pin
elena123459-Dec-03 5:12
elena123459-Dec-03 5:12 
GeneralRe: long path to short path Pin
Heath Stewart9-Dec-03 6:20
protectorHeath Stewart9-Dec-03 6:20 
GeneralRe: long path to short path Pin
Stephane Rodriguez.9-Dec-03 21:24
Stephane Rodriguez.9-Dec-03 21:24 
GeneralNew to C# Question Pin
Larry J. Siddens9-Dec-03 4:07
Larry J. Siddens9-Dec-03 4:07 
GeneralRe: New to C# Question Pin
Colin Angus Mackay9-Dec-03 4:35
Colin Angus Mackay9-Dec-03 4:35 
GeneralRe: New to C# Question Pin
Heath Stewart9-Dec-03 6:10
protectorHeath Stewart9-Dec-03 6:10 
GeneralRe: New to C# Question Pin
Larry J. Siddens9-Dec-03 11:29
Larry J. Siddens9-Dec-03 11:29 
GeneralRe: New to C# Question Pin
Heath Stewart9-Dec-03 11:33
protectorHeath Stewart9-Dec-03 11:33 
GeneralRe: New to C# Question Pin
Huseyin Altindag9-Dec-03 10:57
Huseyin Altindag9-Dec-03 10:57 
GeneralFirst Call to Function does nothing: c# Pin
Goodspeed20029-Dec-03 3:50
Goodspeed20029-Dec-03 3:50 
GeneralRe: First Call to Function does nothing: c# Pin
Heath Stewart9-Dec-03 6:08
protectorHeath Stewart9-Dec-03 6:08 

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.