|
Looks like you could really use some study on threading since you seem to not understand what the others are telling you.
There's lots of books on the subject, but for free there's always the documentation at MSDN: Managed Threading[^]
Mark Salsbery
Microsoft MVP - Visual C++
|
|
|
|
|
i would usoont the threading pool because there ara many advantages, like the memory using, i dont have visual studio 2010, i work with 2008, thank you for answhering me.
|
|
|
|
|
abbd wrote: i would usoont the threading pool because there ara many advantages, like the
memory using
Eh? What memory advantages?
abbd wrote: i dont want using thread
Ultimately, if you are using the ThreadPool, you are using threading. It's just that the gory details are hidden from you - as is the fine grained control you get if you manage the threading yourself. Seriously, read up on threading. It's a tricky concept to master, and you are just storing up trouble for yourself if you attempt to use it without a detailed understanding of it.
|
|
|
|
|
you don't need .NET 4.0 to get good multi-threading, you can do it easily since 2.0, provided you understand how it works. Hit the books and study. Now stop asking to be spoon fed.
Warning: I'm not sure the Office PIA behaves well in multi-threading of any kind, I'm not saying it won't, I'm saying I have some doubts.
Luc Pattyn [Forum Guidelines] [My Articles] Nil Volentibus Arduum
Please use <PRE> tags for code snippets, they preserve indentation, improve readability, and make me actually look at the code.
modified on Monday, May 16, 2011 6:25 PM
|
|
|
|
|
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;
ManualResetEvent[] doneEvents = new ManualResetEvent[FibonacciCalculations];
Program[] fibArray = new Program[FibonacciCalculations];
Random r = new Random();
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);
}
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.
|
|
|
|
|
Do you ever set doneEvents members to true? If not, how can you expect the wait to ever succeed?
Please think about what you're doing before posting a code dump here. If you don't understand how threading and wait handles work, please read up on them before trying to use them.
|
|
|
|
|
i find the solution, we must add doneEvents[int.Parse(threadContext.ToString())].Set(); after the and of generation.
modified on Tuesday, May 17, 2011 5:05 AM
|
|
|
|
|
I need to pass parameters (like arraylist,...) to the TEST method, how i can do this ?
I don't understand whay the test methode must have juste the object parameters.
modified on Tuesday, May 17, 2011 5:45 AM
|
|
|
|
|
hi all.
I divide width of row datagridview in c# .
when i set columnHeaderVisible = true: OK
but i set columnHeaderVisible = false: it have been wrong 1 desert = width of row header.
question : when set columnHeaderVisible = false. how i do to width of rows in datagrid not wrong ???
please help me.
code
dataGridView.Height = h*12;
dataGridView.RowTemplate.Height = h;
if dataGridView.columnHeaderVisible = true ==> ok
but : dataGridView.columnHeaderVisible = false ==> not ok
nothing
|
|
|
|
|
Hi,
Okay, I read your question a couple of times, and I have no idea what you just said / asked? Could you please try and be more specific about the problem?
Kind regards,
|
|
|
|
|
You're going to have to define what a correct column width should be for anyone to answer this.
What do you mean by "not wrong"??
|
|
|
|
|
Hi,
How to find out installed MS office 2010 is 32-bit or 64-bit from the registry?
googled and fouind couple of links...but seems not working or do not have the registry key.
thanks.
|
|
|
|
|
Hi,
Have a look at the following key:
[HKEY_LOCAL_MACHINE\SOFTWARE\Microsoft\Office\14.0\Outlook] -> Bitness=x86
Kind regards,
|
|
|
|
|
I also got the same when I googled it.This registry key is not there in my machine.
|
|
|
|
|
Hmm....
What type of OS are you using?
You can always check in your program files. If Outlook was installed in the 'Program Files (x86)', when it should be 32-bit otherwise it's a 64-bit installation?
|
|
|
|
|
Although this is the general case, the user may have installed the app in a custom folder - and this check will fail.
@OP: If the OS is x64 there should be HKEY_LOCAL_MACHINE\SOFTWARE\Wow6432Node node and under it, if there's an Office x86 product install, there should be a HKEY_LOCAL_MACHINE\SOFTWARE\Wow6432Node\Microsoft\Office\14.0\Common\InstallRoot Key with a Path value set. (substitute "14.0" with the appropriate version.)
If it's x64 bit version, HKEY_LOCAL_MACHINE\SOFTWARE\Microsoft\Office\14.0\Common\InstallRoot Key should be present.
2A
|
|
|
|
|
|
I posted my answer here.
I hope this helps.
2A
|
|
|
|
|
Hello,
I wanted to create an application in which I wanted to start my application at specific time, say I wanted to start my application at every 3 PM. If my computer is not on at 3 PM, I must be able to start it on later time as well.
I am using C#.Net.
Happy Programming.
|
|
|
|
|
According to this message[^] you are using C++/MFC. Please do not post the same question in multiple forums.
The best things in life are not things.
|
|
|
|
|
Busted ...
|
|
|
|
|
Task scheduler in Windows?
I cannot remember: What did I before google?
|
|
|
|
|
I am talking about adding my Task to Control Panel -> Scheduled Tasks.
|
|
|
|
|
|
i create report rdlc and pass to it datasource ana add it in Microsoft report viewer
and on this report i add image from toolbox i need to pass image from DB in this image box
|
|
|
|