Click here to Skip to main content
15,900,461 members
Home / Discussions / C#
   

C#

 
AnswerRe: ThreadPool don't work Pin
Daniel Scott16-May-11 6:46
Daniel Scott16-May-11 6:46 
GeneralRe: ThreadPool don't work Pin
abbd16-May-11 6:47
abbd16-May-11 6:47 
GeneralRe: ThreadPool don't work Pin
Pete O'Hanlon16-May-11 6:58
mvePete O'Hanlon16-May-11 6:58 
AnswerRe: ThreadPool don't work Pin
Mark Salsbery16-May-11 6:55
Mark Salsbery16-May-11 6:55 
GeneralRe: ThreadPool don't work Pin
abbd16-May-11 6:58
abbd16-May-11 6:58 
GeneralRe: ThreadPool don't work Pin
Pete O'Hanlon16-May-11 7:01
mvePete O'Hanlon16-May-11 7:01 
GeneralRe: ThreadPool don't work Pin
Luc Pattyn16-May-11 12:16
sitebuilderLuc Pattyn16-May-11 12:16 
QuestionRe: ThreadPool don't work Pin
abbd16-May-11 22:27
abbd16-May-11 22:27 
Hello,

I try for :

Object oMissing = System.Reflection.Missing.Value;
            Object oTrue = true;
            Object oFalse = false;
            Microsoft.Office.Interop.Word.Application oWord = new Microsoft.Office.Interop.Word.Application();
            Microsoft.Office.Interop.Word.Document oWordDoc = new Microsoft.Office.Interop.Word.Document();
            oWord.Visible = true;
            oWord.Visible = false;
            Object oTemplatePath = @".\1.doc";
            oWordDoc = oWord.Documents.Add(ref oTemplatePath, ref oMissing, ref oMissing, ref oMissing);         
            
            foreach (Microsoft.Office.Interop.Word.Range range in oWordDoc.Words)
            {
                if (range.Text.Trim().Contains("P"))
                {
                    int pos = range.Text.Trim().IndexOf("P");
                    string str = range.Text.Trim().Replace("P", "");
                    range.Text = str;
                }

            }
            Directory.CreateDirectory(@"F:\PS-IN\"+threadContext);
            Object oSaveAsFile = @"F:\PS-IN\" + threadContext+"\\" + threadContext + ".doc";
            oWordDoc.SaveAs(ref oSaveAsFile, ref oMissing, ref oMissing, ref oMissing,
            ref oMissing, ref oMissing, ref oMissing, ref oMissing, ref oMissing,
            ref oMissing, ref oMissing, ref oMissing, ref oMissing, ref oMissing,
            ref oMissing, ref oMissing);
            Console.WriteLine(threadContext+" "+DateTime.Now.ToShortTimeString());
            oWordDoc.Close(ref oFalse, ref  oMissing, ref oMissing);
            oWord.Quit(ref oMissing, ref oMissing, ref oMissing);
        }

        static void Main(string[] args)
        {

            const int FibonacciCalculations = 50;

            // One event is used for each Fibonacci object.
            ManualResetEvent[] doneEvents = new ManualResetEvent[FibonacciCalculations];
            Program[] fibArray = new Program[FibonacciCalculations];
            Random r = new Random();

            // Configure and start threads using ThreadPool.
            Console.WriteLine("launching {0} tasks...", FibonacciCalculations);
            for (int i = 0; i < FibonacciCalculations; i++)
            {
                doneEvents[i] = new ManualResetEvent(false);
                Program f = new Program();
                fibArray[i] = f;
                ThreadPool.QueueUserWorkItem(f.TEST,i);
            }

            // Wait for all threads in pool to calculate.
            WaitHandle.WaitAll(doneEvents);
            Console.WriteLine("All calculations are complete.");

}



it generate the 50 word files, but he never leaves the wait, thank you for your help.
AnswerRe: ThreadPool don't work Pin
BobJanova16-May-11 22:37
BobJanova16-May-11 22:37 
NewsRe: ThreadPool don't work Pin
abbd16-May-11 22:45
abbd16-May-11 22:45 
GeneralRe: ThreadPool don't work [modified] Pin
abbd16-May-11 23:30
abbd16-May-11 23:30 
QuestionDivide width of row datagrid in C# with screen specification ???? Pin
aa_zz16-May-11 0:53
aa_zz16-May-11 0:53 
GeneralRe: Divide width of row datagrid in C# with screen specification ???? Pin
Programm3r16-May-11 3:54
Programm3r16-May-11 3:54 
AnswerRe: Divide width of row datagrid in C# with screen specification ???? Pin
Dave Kreskowiak16-May-11 4:02
mveDave Kreskowiak16-May-11 4:02 
Questionhow to find out installed MS-office is 64-bit or 32-bit via registry? Pin
SRKSHOME15-May-11 23:17
SRKSHOME15-May-11 23:17 
AnswerRe: how to find out installed MS-office is 64-bit or 32-bit via registry? Pin
Programm3r16-May-11 2:38
Programm3r16-May-11 2:38 
GeneralRe: how to find out installed MS-office is 64-bit or 32-bit via registry? Pin
SRKSHOME16-May-11 3:36
SRKSHOME16-May-11 3:36 
GeneralRe: how to find out installed MS-office is 64-bit or 32-bit via registry? Pin
Programm3r16-May-11 3:51
Programm3r16-May-11 3:51 
GeneralRe: how to find out installed MS-office is 64-bit or 32-bit via registry? Pin
markovl16-May-11 4:39
markovl16-May-11 4:39 
GeneralRe: how to find out installed MS-office is 64-bit or 32-bit via registry? Pin
SRKSHOME17-May-11 3:53
SRKSHOME17-May-11 3:53 
AnswerRe: how to find out installed MS-office is 64-bit or 32-bit via registry? Pin
markovl16-May-11 4:43
markovl16-May-11 4:43 
QuestionStart application at specific time Pin
Pranit Kothari15-May-11 22:01
Pranit Kothari15-May-11 22:01 
AnswerRe: Start application at specific time Pin
Richard MacCutchan15-May-11 22:13
mveRichard MacCutchan15-May-11 22:13 
GeneralRe: Start application at specific time Pin
Programm3r16-May-11 2:51
Programm3r16-May-11 2:51 
AnswerRe: Start application at specific time Pin
Thomas Krojer16-May-11 21:25
Thomas Krojer16-May-11 21:25 

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.