|
Cant tell from what you told us.
Some ideas/suggestions:
- maybe movie takes more than 30 seconds
- maybe you keep adding threads
- add a thread counter; increment it at the beginning of the threaded method (PlayCurWMP)
and decrement it at the end; show it all the time
- maybe you are exhausting the ThreadPool
- I would add logging in all relevant parts, so you get a history line of what is going
on;
- you even may try to correlate your CPU load (observed, or obtained programmatically) with
that time line.
|
|
|
|
|
hi,
Thanks for the reply.When I start the application I am adding control runtime.If I try to play the movie suddenly CPU usage become 100% & the application runs very slowly.
Can you suggest is it AxWMPLib.AxWindowsMediaPlayer taking the memory?
Every 30 seconds I am updating the screen using Threading.Timer & delegates.So id the screen changes I need to change all the videos.
Can you pls help me How I play video with out affecting my screen display & reduce the CPU usage?I am not good in threading.Please give the code...
Thanks a lot..
|
|
|
|
|
I dont have code for this.
I gave you suggestions and ideas, that will be it.
One more suggestion: make sure you dont have a thread touch a control it did not create
(on old .NET, before 2.0) that may cause almost any anomaly; on .NET >= 2.0 it should
give an InvalidOperationException with some cross-thread remark in the message.
Thats all I can do for you.
|
|
|
|
|
I developed a C# windows application in .net2003. What i need is how to start that application along with the windows. Is there any setting in the code to achieve this.
I am grateful if any one helps me.
Thanks in Advance.
Ramu
|
|
|
|
|
You can put the exe or Shortcut of the exe in windows startup
C:\Documents and Settings\Your Computer Name\Start Menu\Programs\Startup
Thanks
|
|
|
|
|
|
Ramu.M wrote: how to start that application along with the windows
Do you mean when Windows starts or when a user logs in? In the former case, you'll need to create a Windows service; for the latter, see this[^] link.
/ravi
|
|
|
|
|
Thank you very much for providing an excellent link.
Once again Thank You.
Ramu
|
|
|
|
|
Hi everybody,
I have a quick question about listboxes. I have a project where I want to take a string, and see if a Listbox full of substrings has any matches in it. So if the big string is "abcdefg" and the listbox has "arq", "bcd" and "qrs", then the answer is YES. For example:
//listbox is populated with "chunks" of data
string xyz;
foreach(string in the listbox)
{
//does this listbox string exist somewhere in the big string xyz?
if(true)
{
//do something
}
}
I have no idea how to do this. It seems simple enough but there doesn't seem to be the right method out there.
Thanks for your time,
Michael Fritzius
|
|
|
|
|
you iterate over the items collection of the listbox, and you use methods on the string class to see if one string contains another.
Christian Graus - Microsoft MVP - C++
"I am working on a project that will convert a FORTRAN code to corresponding C++ code.I am not aware of FORTRAN syntax" ( spotted in the C++/CLI forum )
|
|
|
|
|
Michael,
Something like this...
foreach (string item in sourceString)
if (sourceString.Contains(item))
{
}
"The clue train passed his station without stopping." - John Simmons / outlaw programmer
|
|
|
|
|
Hi,
I dont think your example makes much sense, unless you somehow specify the minimum
length required for the matching substring.
Without it, every string contains "" (that is the empty string)
and I expect most strings contain a vowel such as "e" or "a"
If that is nevertheless what you really want, then do what the other replies
indicate, but put it all in one more loop in which you generate all the valid
substrings of your "big string". You might want to fill a list with these
substrings once, any way you see fit.
|
|
|
|
|
Got it.
Here's how it worked out:
using System;<br />
using System.Collections.Generic;<br />
using System.ComponentModel;<br />
using System.Data;<br />
using System.Drawing;<br />
using System.Text;<br />
using System.Windows.Forms;<br />
<br />
namespace WindowsApplication1<br />
{<br />
public partial class Form1 : Form<br />
{<br />
public Form1()<br />
{<br />
InitializeComponent();<br />
}<br />
<br />
private void button1_Click(object sender, EventArgs e)<br />
{<br />
foreach(string item in listBox1.Items)<br />
{<br />
if (item.ToString().Contains(textBox1.Text))<br />
{<br />
textBox2.Text += ("Substring found in entry " + item.ToString() + "\r\n");<br />
}<br />
<br />
}<br />
}<br />
}<br />
}<br />
Thanks for your help guys, something about all three replies kind of "came together" for me
|
|
|
|
|
Dear All,
Is there any way that we can check if a specific variable is declared or not
Thank you!
M. Nauman Yousuf
"Mess with the Best, Die like the rest"
|
|
|
|
|
M. Nauman Yousuf wrote: Is there any way that we can check if a specific variable is declared or not
Perhaps using reflection.
However, if a solution contains the words "using reflection", it's usually an indication that you are thinking backwards somehow. What is it that you are trying to accomplish really?
---
single minded; short sighted; long gone;
|
|
|
|
|
I am designing a simple display / edit page, by passing a variable in the url of that page. On page load i check for the variable and populate the edit more form accordingly.
But always get an error if the variable is not present.
A simple technique of try catch would be my final option if no other alternative is available
Thank you!
M. Nauamn Yousuf
"Mess with the Best, Die like the rest"
|
|
|
|
|
I recommend reading the guide on how to ask questions, so they can be understood. Also, this is an ASP.NET question.
However, the answer to what you're asking now ( as opposed to what you asked before ) is that, trivially, the query string is available to you as part of the URL, or as a collection of variables. You can iterate through it for the value you need, or look for it within the string. This does not require reflection, in fact the query string variables do not exist as variables in your code, until you declare them and search for the values in the query string to set them.
Christian Graus - Microsoft MVP - C++
"I am working on a project that will convert a FORTRAN code to corresponding C++ code.I am not aware of FORTRAN syntax" ( spotted in the C++/CLI forum )
|
|
|
|
|
Cheers CG - that's twice you've just beaten me to it, but I'm not deleting my answer this time.
"More functions should disregard input values and just return 12. It would make life easier." - comment posted on WTF
|
|
|
|
|
Do you mean if the variable is part of the url...
http://www.mysite.com//myPage.aspx?MyVariable1=this&Variable2=that
And you want to check for MyVariable1 or MyVariable2 existing in the Request collection?
"More functions should disregard input values and just return 12. It would make life easier." - comment posted on WTF
|
|
|
|
|
yes Malcolm thats exactly the case
"Mess with the Best, Die like the rest"
|
|
|
|
|
if(string.IsNullOrEmpty(Request.QueryString["myVariable"]))
{
}
|
|
|
|
|
J4amieC wrote: if(string.IsNullOrEmpty(Request.QueryString["myVariable"]))
{
// the variable does not exist in the URL
}
Actually, if the string is an empty string, the variable does exist in the url.
if (Request.QueryString["myVariable"] == null) {
}
if (string.IsNullOrEmpty(Request.QueryString["myVariable"])) {
}
---
single minded; short sighted; long gone;
|
|
|
|
|
try-catch is two orders of magnitude easier than reflection !
|
|
|
|
|
You can use reflection, but it seems odd to me that you wouldn't know, that's a compile time thing.
Christian Graus - Microsoft MVP - C++
"I am working on a project that will convert a FORTRAN code to corresponding C++ code.I am not aware of FORTRAN syntax" ( spotted in the C++/CLI forum )
|
|
|
|
|
M. Nauman Yousuf wrote: Is there any way that we can check if a specific variable is declared or not
Yes. Use Reflection for that.
SSK.
|
|
|
|