Click here to Skip to main content
15,920,896 members
Home / Discussions / C#
   

C#

 
AnswerRe: reducing image file size Pin
Christian Graus20-Sep-09 19:41
protectorChristian Graus20-Sep-09 19:41 
AnswerRe: reducing image file size Pin
Luc Pattyn21-Sep-09 1:01
sitebuilderLuc Pattyn21-Sep-09 1:01 
Questionhow to count printed total pages [modified] Pin
scoket20-Sep-09 17:48
scoket20-Sep-09 17:48 
QuestionThread scheduling [modified] Pin
Kwonhyung Roh20-Sep-09 16:58
Kwonhyung Roh20-Sep-09 16:58 
AnswerRe: Thread scheduling Pin
Dave Kreskowiak20-Sep-09 17:02
mveDave Kreskowiak20-Sep-09 17:02 
GeneralRe: Thread scheduling Pin
Kwonhyung Roh20-Sep-09 18:15
Kwonhyung Roh20-Sep-09 18:15 
GeneralRe: Thread scheduling Pin
Dave Kreskowiak21-Sep-09 2:11
mveDave Kreskowiak21-Sep-09 2:11 
GeneralRe: Thread scheduling Pin
Kwonhyung Roh21-Sep-09 17:31
Kwonhyung Roh21-Sep-09 17:31 
Thanks.

With your help, I can go back to my original problem.
Please refer to the code snippet below.

private void button2_Click(object sender, EventArgs e)
     {
         filename = listBox1.SelectedItem.ToString();
         path = directory + "\\" + filename;


         // Play()
         player.controls.stop();
         player.currentMedia = player.newMedia(path);
         player.controls.play();


         // DoSomething()
         int z = 1;
         for(int i=0; i<1000000; i++) {
             z = i + 1000;
             z = z - 1000;
             string str = "Test String";
             str = str + " What's up?";
         }
         MessageBox.Show("Iteration Ends");
     }


This code snippet is processed in the order
1. Do for-block first (for about 4 seconds)
2. Show MessageBox
3. And then play sound.

But what I expected and wanted is the order
1. Play sound/Do for-block at the same time
2. Show MessageBox while the sound is being played

If I put another MessageBox just before the for block like
MessageBox.Show("Now Starting...");
int z = 1;
for(int i=0; i<1000000; i++) {
   // do the same as above code block
}
MessageBox.Show("Iteration Ends");

The result order (of processing) is
1. Play sound/Show the first MessageBox at the same time (maybe not exactly the same time but I felt it was Smile | :) )
2. Do for-block (for about 4 seconds)
3. Show the second MessageBox while the sound is being played

I wanted to know where all of these differences come from.
Thanks.
GeneralRe: Thread scheduling Pin
Dave Kreskowiak22-Sep-09 4:30
mveDave Kreskowiak22-Sep-09 4:30 
GeneralRe: Thread scheduling Pin
Kwonhyung Roh22-Sep-09 16:14
Kwonhyung Roh22-Sep-09 16:14 
QuestionError using tao framework Pin
billy_iii20-Sep-09 11:42
billy_iii20-Sep-09 11:42 
AnswerRe: Error using tao framework Pin
Henry Minute20-Sep-09 12:40
Henry Minute20-Sep-09 12:40 
GeneralRe: Error using tao framework Pin
billy_iii20-Sep-09 13:23
billy_iii20-Sep-09 13:23 
GeneralRe: Error using tao framework Pin
Dave Kreskowiak20-Sep-09 16:59
mveDave Kreskowiak20-Sep-09 16:59 
AnswerRe: Error using tao framework Pin
carlecomm29-Sep-09 1:25
carlecomm29-Sep-09 1:25 
QuestionCorsor position Pin
Muammar©20-Sep-09 10:29
Muammar©20-Sep-09 10:29 
AnswerRe: Corsor position Pin
Abhishek Sur20-Sep-09 10:32
professionalAbhishek Sur20-Sep-09 10:32 
AnswerRe: Corsor position Pin
Luc Pattyn20-Sep-09 11:01
sitebuilderLuc Pattyn20-Sep-09 11:01 
GeneralRe: Corsor position Pin
Muammar©20-Sep-09 11:18
Muammar©20-Sep-09 11:18 
GeneralRe: Corsor position Pin
Daniel Grunwald20-Sep-09 13:19
Daniel Grunwald20-Sep-09 13:19 
GeneralRe: Corsor position Pin
Luc Pattyn20-Sep-09 13:54
sitebuilderLuc Pattyn20-Sep-09 13:54 
QuestionNullReferenceException untraceable Pin
akhanal20-Sep-09 10:10
akhanal20-Sep-09 10:10 
AnswerRe: NullReferenceException untraceable Pin
Abhishek Sur20-Sep-09 10:31
professionalAbhishek Sur20-Sep-09 10:31 
GeneralRe: NullReferenceException untraceable [modified] Pin
akhanal20-Sep-09 10:37
akhanal20-Sep-09 10:37 
GeneralRe: NullReferenceException untraceable Pin
akhanal20-Sep-09 10:44
akhanal20-Sep-09 10:44 

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.