|
paul9038 wrote: To stop the video I abort the thread and kill the seperate window
paul9038 wrote: Is it possible to control threads where they can be stopped and restarted.
I imagine so. I have never implemented an approach that aborts threads since virtually all the documentation you read warns against aborting threads. You should use thread communications techniques to control the operations of the thread internally. The result is that the code executing in the thread has an alternate path that causes the thread procedure to return which ends the thread in a proper controlled fashion.
public static void ThreadProcedure(...)
{
while ( IShouldContinuePlayingRecording() )
PlayRecording();
}
So to cause a thread to end looks like this:
1) parent thread communicates with child thread telling it to end
2) child thread receives the message and alters it's flow of control resulting in the thread procedure returning.
is that what you were asking?
|
|
|
|
|
paul9038 wrote: If, however the video plays to the end I can't restart the player as the previous thread doesn't seem to have terminated properly.
This should provide some clue as to what's going on. First, you should allow the thread to exit if playback completes (I can infer that you're doing this, I'm just making sure). While you could probably manage to keep the thread alive and consume new playback requests, it is probably much easier to simply let the thread exit and create a new thread when you want to start a new playback.
With that in mind, if your thread is using any unmanaged resources that it doesn't release when the thread exits, the thread will hang when it attempts to exit. I've run into this on multiple occasions. If your thread doesn't seem to be terminating properly, I would look at the resources you're using in that thread and make sure any objects you use are properly Dispose()'d if their documentation says to do so.
It has become appallingly obvious that our technology has exceeded our humanity. - Albert Einstein
|
|
|
|
|
Hi,
I am trying to access to the click event of the controlbox item close 'X'
my form has a container ,,i have written a validation in the validating event of the container..
When i click the 'X'of form, the container validating event fires before the window_closing event... therefore i would like to access the click event of the 'X'..
pls suggest..
thanks
|
|
|
|
|
I don't understand the problem. Handle the closing event ??
only two letters away from being an asset
|
|
|
|
|
Basicaly i am looking for a event prior to the form_closing event, when i click X in that form.
|
|
|
|
|
|
You might want to ask this in the Mobile Development forum
only two letters away from being an asset
|
|
|
|
|
Hi All,
I am working on the project using c# 2.0. I need to get the contents of window.status bar and save into string variable. Please help if you can.
Thanks in advance.
A.Asif
|
|
|
|
|
What window are you talking about? The web browser's status bar?
|
|
|
|
|
yes web browser window. I am using the following code but doesn't work.
string result = LPBrowser.Document.Window.StatusBarText;
Thanks.
A.Asif
|
|
|
|
|
I'm sorry, I still don't understand. Is LPBrowser something in ASP.NET? Or is this a Windows Forms web browser control?
If it's a Windows Forms web browser, have you looked at browser.StatusText property?
If this is something in ASP.NET, I recommend you post your question in the ASP.NET forum.
|
|
|
|
|
Hi,
LPBrowser is just the name I gave to browser control. Currently I am using following code but for some reason these codes not working,
string result;
string someVar;
some Var = LPBrowser.StatusBarText //This line doesn't work
result = LPBrowser.StatusText; ///This line doesn't work
A.Asif
|
|
|
|
|
Hi everyone.
I have got some VB6 code i need to translate to C#, but i really cant understand the VB code.
The program is something that communicates with a serial dervice.
I do not know how much of the code I need to get translated, so it is possible that I will post more code later.
Until now i've got this code:
Private Sub Command1_Click()
Dim CheckSum As Byte, x, Tid
MSComm1.Settings = "1200,N,8,1"
Buffer = "GET" + vbCr
CheckAndSum Buffer ' add Checksum and Length of string
Buffer = Buffer + SumStr
'For x = 1 To Len(Buffer)
' Tid = Timer
' Do
' DoEvents
' Loop Until (Timer - Tid > 0.01)
' MSComm1.Output = Mid(Buffer, x, 1)
'Next x
MSComm1.Output = Buffer
End Sub
This should write some code to the Serial Port.
I have already got the code for creating the checksum.
When my device receives the GET command with vbCr (Carridge return), the checksum and the string Length, it should return 10 characters an example could be c=02345"Carrigde return"Checksum1Checksum2
I do not think you need more code that i pasted to do this. But I am not sure..
It would really be a great help if you could help me with this..
|
|
|
|
|
|
I already had looked at MSDN.. I have tried make some code.. But no matter what i do it doesn't seem to work..
|
|
|
|
|
Wow, one of the reasons I am out of VB6.
Need a C# Consultant? I'm available.
Happiness in intelligent people is the rarest thing I know. -- Ernest Hemingway
|
|
|
|
|
Ennis Ray Lynch, Jr. wrote: one of the reasons I am out of VB6
One of the reasons I never adopted it in my shop
"Any sort of work in VB6 is bound to provide several WTF moments." - Christian Graus
|
|
|
|
|
haolan wrote: Private Sub Command1_Click()
Dim CheckSum As Byte, x, Tid
MSComm1.Settings = "1200,N,8,1"
Buffer = "GET" + vbCr
CheckAndSum Buffer ' add Checksum and Length of string
Buffer = Buffer + SumStr
'For x = 1 To Len(Buffer)
' Tid = Timer
' Do
' DoEvents
' Loop Until (Timer - Tid > 0.01)
' MSComm1.Output = Mid(Buffer, x, 1)
'Next x
MSComm1.Output = Buffer
End Sub
A few questions...
Which serial port? How do you know this does not work? Where is code to listen for the result your program is expecting? What is the specification of the device that needs this input? Maybe the port parameters do not match up?
|
|
|
|
|
I want to create a Xml editor.I have added a Richtextbox control named as "editor" on the form as to enter text(Elements and attributes).Please tell me I have done right or not????
Now I want to read the text on the RichtextBox and make an Dtd or Xsd file by using the property "edtor.text".How can I create those files??.
1.By conventional/ordinary method and just set the file extension to that(Xsd/Dtd)???.
2.Is there any special method to write/create those files???.
Please urgent!!
Thanks in Advance.
Regards,
chanzeb chaudhary.
|
|
|
|
|
Does this article[^] help? It shows how to create an XSD file from a class.
Also, there is an XSD.exe utility in the .NEt framework SDK that may help you out.
|
|
|
|
|
Hi all,
I'm trying to show a tooltip for a button.
I have a StopWatch,
the purpose is to show the elapsed Time into the tooltip string. and to get the refreshed value each time the mouse is under the button
I'm doing like that
this.toolTip1.SetToolTip(button1, Stopwatch.Elapsed.ToString());
but the tooltip shown have always the same value
How can I update this value ?
Thanks for help
|
|
|
|
|
I think you may have to hide the tool tip and reshow it again.
That, or use a custom tooltip that lets you set the text while it's visible.
|
|
|
|
|
Hi,
I have a problem to understand one thing concerning structs.
It is said that structs are value types. But what happens when a Reference Type member is defined for a struct? Because it is a member of a struct does it behave like a value type -meaning both its value and reference address are stroed in the stack together?
Thanks!
|
|
|
|
|
Then, the struct still behaves as a value type; every time you pass it to a function, the struct will be copied.
The reference contained in it is just a pointer to a location in memory where the real object resides. Thus, when the struct is copied, the pointer is copied; but big deal, the real object exists just once and still remains there.
Make sense?
|
|
|
|
|
Definetly makes sense;
Thanks a lot!
|
|
|
|