Click here to Skip to main content
15,887,683 members
Home / Discussions / C#
   

C#

 
GeneralRe: How to dynamically convert between Types? Pin
Subrahmanyam K2-May-07 4:37
Subrahmanyam K2-May-07 4:37 
QuestionAuthenticating the Windows username and password Pin
Dotnetkanna1-May-07 20:56
Dotnetkanna1-May-07 20:56 
AnswerRe: Authenticating the Windows username and password Pin
stancrm1-May-07 22:32
stancrm1-May-07 22:32 
GeneralRe: Authenticating the Windows username and password Pin
Dotnetkanna1-May-07 23:59
Dotnetkanna1-May-07 23:59 
GeneralRe: Authenticating the Windows username and password Pin
stancrm2-May-07 0:17
stancrm2-May-07 0:17 
AnswerRe: Authenticating the Windows username and password Pin
Pete O'Hanlon2-May-07 0:56
mvePete O'Hanlon2-May-07 0:56 
QuestionEvents in web service.... Pin
Mandaar Kulkarni1-May-07 20:50
Mandaar Kulkarni1-May-07 20:50 
QuestionCross Thread Operation Pin
kraj991-May-07 19:53
kraj991-May-07 19:53 
Hi,

I am facing a cross-thread communication problem in my application.

Let me explain in detail:
My application runs on a third party software. On the click of a button on the third party GUI, I need to open and play MediaPlayer and on the click of another button, I need to Stop the MediaPlayer.
After lot of research, the only way I found to play and control a mediaplayer was by adding the wmplayer control on to a window form and control it using ctlcontrol method of wmplayer component.
Now to instantiate this form class, I need to open a new thread from the main thread of my application. I am doing this in the 'Play' button click handler.
Now on the click of 'Stop' button on the thrid party GUI, I need to close this particular form and close the thread. Here, I am getting the CROSS THREAD OPERATION EXCEPTION. Can someone tell me how can I close this form on click of Stop button on the third party GUI?




Here's the sample Code:

public void OnPlay(TrtReceiveData receiveData)
{
Thread startModulesThread = new Thread(new ThreadStart(this.videoAlbum.VideoPlay));
startModulesThread.SetApartmentState(ApartmentState.STA);
startModulesThread.IsBackground = true;
startModulesThread.Start();
}

void VideoPlay()
{
String videoThumbnailPath = @"c:\ch1_video_08.mpg";
Application.Run(playBack = new PlayBack(videoThumbnailPath));
}

void StopPlayback()
{
//WHAT NEEDS TO WRITTEN HERE TO CLOSE AND EXIT THE FORM??
}

public partial class PlayBack : Form
{
public PlayBack(String path)
{
InitializeComponent();
axWindowsMediaPlayer1.URL = path;
axWindowsMediaPlayer1.Ctlcontrols.play();
}
}


Thanks,
Kraj
AnswerRe: Cross Thread Operation Pin
Mandaar Kulkarni1-May-07 21:02
Mandaar Kulkarni1-May-07 21:02 
Questionhelp here... square program Pin
Missy Glory1-May-07 19:24
Missy Glory1-May-07 19:24 
AnswerRe: help here... square program Pin
stancrm1-May-07 19:40
stancrm1-May-07 19:40 
AnswerRe: help here... square program Pin
Michael1011-May-07 19:40
Michael1011-May-07 19:40 
AnswerRe: help here... square program Pin
Guffa1-May-07 22:27
Guffa1-May-07 22:27 
QuestionC# ASP.NET Printing Puzzle!! Pin
Michael1011-May-07 18:11
Michael1011-May-07 18:11 
AnswerRe: C# ASP.NET Printing Puzzle!! Pin
Christian Graus1-May-07 19:17
protectorChristian Graus1-May-07 19:17 
GeneralRe: C# ASP.NET Printing Puzzle!! Pin
Michael1011-May-07 19:38
Michael1011-May-07 19:38 
QuestionDeserialize an object with XML tags Pin
gsteingr1231-May-07 17:49
gsteingr1231-May-07 17:49 
AnswerRe: Deserialize an object with XML tags Pin
PIEBALDconsult1-May-07 17:55
mvePIEBALDconsult1-May-07 17:55 
AnswerRe: Deserialize an object with XML tags Pin
LongRange.Shooter2-May-07 5:18
LongRange.Shooter2-May-07 5:18 
Questionobject reference not set to an instance of an object Pin
Latheesan1-May-07 16:44
Latheesan1-May-07 16:44 
AnswerRe: object reference not set to an instance of an object Pin
PIEBALDconsult1-May-07 17:08
mvePIEBALDconsult1-May-07 17:08 
GeneralRe: object reference not set to an instance of an object Pin
Latheesan1-May-07 17:23
Latheesan1-May-07 17:23 
GeneralRe: object reference not set to an instance of an object Pin
PIEBALDconsult1-May-07 17:53
mvePIEBALDconsult1-May-07 17:53 
GeneralRe: object reference not set to an instance of an object Pin
Latheesan1-May-07 18:07
Latheesan1-May-07 18:07 
GeneralRe: object reference not set to an instance of an object Pin
PIEBALDconsult1-May-07 18:23
mvePIEBALDconsult1-May-07 18:23 

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.