Click here to Skip to main content
15,886,873 members
Home / Discussions / C#
   

C#

 
GeneralRe: RealTime Pin
arkiboys16-May-11 9:58
arkiboys16-May-11 9:58 
GeneralRe: RealTime Pin
Keith Barrow16-May-11 10:25
professionalKeith Barrow16-May-11 10:25 
AnswerRe: RealTime [modified] Pin
dan!sh 16-May-11 10:28
professional dan!sh 16-May-11 10:28 
GeneralRe: RealTime Pin
Keith Barrow16-May-11 10:56
professionalKeith Barrow16-May-11 10:56 
GeneralRe: RealTime Pin
dan!sh 16-May-11 11:04
professional dan!sh 16-May-11 11:04 
AnswerRe: RealTime Pin
AspDotNetDev16-May-11 10:30
protectorAspDotNetDev16-May-11 10:30 
AnswerRe: RealTime Pin
Luc Pattyn16-May-11 12:10
sitebuilderLuc Pattyn16-May-11 12:10 
QuestionThreadPool don't work Pin
abbd16-May-11 5:24
abbd16-May-11 5:24 
Hello,

I would use a ThreadPool like this :

public void TEST()
        { 
            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;
                }

            }
            Object oSaveAsFile = "./2.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);

            oWordDoc.Close(ref oFalse, ref  oMissing, ref oMissing);
            oWord.Quit(ref oMissing, ref oMissing, ref oMissing);
        }

        static void Main(string[] args)
        {
           

                Program test = new Program();
                ThreadPool.QueueUserWorkItem(o => test.TEST());
        }



Unfortunatly it don't work.

Thank you verry mutch.
AnswerRe: ThreadPool don't work Pin
Pete O'Hanlon16-May-11 5:46
mvePete O'Hanlon16-May-11 5:46 
QuestionRe: ThreadPool don't work Pin
abbd16-May-11 5:55
abbd16-May-11 5:55 
AnswerRe: ThreadPool don't work Pin
Ian Shlasko16-May-11 6:12
Ian Shlasko16-May-11 6:12 
GeneralRe: ThreadPool don't work Pin
Luc Pattyn16-May-11 12:12
sitebuilderLuc Pattyn16-May-11 12:12 
AnswerRe: ThreadPool don't work Pin
SledgeHammer0116-May-11 6:17
SledgeHammer0116-May-11 6:17 
QuestionRe: ThreadPool don't work Pin
abbd16-May-11 6:21
abbd16-May-11 6:21 
AnswerRe: ThreadPool don't work Pin
Pete O'Hanlon16-May-11 6:20
mvePete O'Hanlon16-May-11 6:20 
QuestionRe: ThreadPool don't work Pin
abbd16-May-11 6:36
abbd16-May-11 6:36 
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 
AnswerRe: ThreadPool don't work Pin
BobJanova16-May-11 22:37
BobJanova16-May-11 22:37 

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.