Click here to Skip to main content
15,891,657 members
Home / Discussions / C#
   

C#

 
GeneralRe: Object disposing and using keyword Pin
N a v a n e e t h4-Sep-07 3:59
N a v a n e e t h4-Sep-07 3:59 
GeneralRe: Object disposing and using keyword Pin
Christian Graus4-Sep-07 4:07
protectorChristian Graus4-Sep-07 4:07 
GeneralRe: Object disposing and using keyword Pin
Urs Enzler4-Sep-07 4:59
Urs Enzler4-Sep-07 4:59 
GeneralRe: Object disposing and using keyword Pin
Christian Graus4-Sep-07 5:13
protectorChristian Graus4-Sep-07 5:13 
AnswerRe: Object disposing and using keyword Pin
Steve Hansen4-Sep-07 4:25
Steve Hansen4-Sep-07 4:25 
GeneralRe: Object disposing and using keyword Pin
Christian Graus4-Sep-07 4:44
protectorChristian Graus4-Sep-07 4:44 
AnswerRe: Object disposing and using keyword Pin
Scott Dorman4-Sep-07 7:37
professionalScott Dorman4-Sep-07 7:37 
QuestionNew to events in c#, how to wait for an event? Pin
ioctl514-Sep-07 3:29
ioctl514-Sep-07 3:29 
Hello, iv recently started to use C#, and now iv found i want to wait for an event. Im writing an application that reacts to diffrent Windows Live Messenger events. For instance, plays a sound when a message is receieved.
Im using the IMessengerAPI by adding a com reference to it in my project. I don't really need to do anything in my applications unless there is an event to react to. So i just want it to Sleep(); while there are no events, and then when an event arrives, handle it, and then go back to sleep.

So i need to create a function, WaitForAnyOfTheMsnAPIEvents(); or something like that. That Sleeps the application while it listens for events. How do i do this?


<br />
static class Program<br />
    {<br />
        static MessengerAPI.Messenger MSN = new MessengerAPI.Messenger();<br />
<br />
        [STAThread]<br />
        static void Main()<br />
        {<br />
            MSN.OnIMWindowDestroyed += new MessengerAPI.DMessengerEvents_OnIMWindowDestroyedEventHandler(MSN_OnIMWindowDestroyed);<br />
<br />
            while(true)<br />
            {<br />
                WaitForAnyOfTheMsnAPIEvents(); /// <-- how do i do this.<br />
            }<br />
        }<br />
<br />
       static void MSN_OnIMWindowDestroyed(object pIMWindow);<br />
}<br />


Sorry if im stupid, im very new to C#, but i think this should be possible, in C++ you could do something similiar for events, WaitForMultipleObjects() etc..

Thanks in advance.
AnswerRe: New to events in c#, how to wait for an event? Pin
Christian Graus4-Sep-07 3:33
protectorChristian Graus4-Sep-07 3:33 
GeneralRe: New to events in c#, how to wait for an event? Pin
ioctl514-Sep-07 3:36
ioctl514-Sep-07 3:36 
GeneralRe: New to events in c#, how to wait for an event? Pin
Christian Graus4-Sep-07 3:49
protectorChristian Graus4-Sep-07 3:49 
AnswerRe: New to events in c#, how to wait for an event? Pin
mav.northwind4-Sep-07 19:27
mav.northwind4-Sep-07 19:27 
QuestionMessage box from the Windows Service Pin
M. J. Jaya Chitra4-Sep-07 3:00
M. J. Jaya Chitra4-Sep-07 3:00 
AnswerRe: Message box from the Windows Service Pin
Colin Angus Mackay4-Sep-07 3:20
Colin Angus Mackay4-Sep-07 3:20 
GeneralRe: Message box from the Windows Service Pin
M. J. Jaya Chitra4-Sep-07 3:33
M. J. Jaya Chitra4-Sep-07 3:33 
GeneralRe: Message box from the Windows Service Pin
Christian Graus4-Sep-07 3:35
protectorChristian Graus4-Sep-07 3:35 
GeneralRe: Message box from the Windows Service Pin
originSH4-Sep-07 3:36
originSH4-Sep-07 3:36 
Questionhow to give white spaces? Pin
Situ144-Sep-07 2:42
Situ144-Sep-07 2:42 
AnswerRe: how to give white spaces? Pin
Luc Pattyn4-Sep-07 3:04
sitebuilderLuc Pattyn4-Sep-07 3:04 
AnswerRe: how to give white spaces? Pin
Christian Graus4-Sep-07 3:10
protectorChristian Graus4-Sep-07 3:10 
AnswerRe: how to give white spaces? Pin
Thomas Stockwell4-Sep-07 6:03
professionalThomas Stockwell4-Sep-07 6:03 
QuestionNewInspector event doesn´t Fire when Excel - File - Send To - EMail Pin
EisMayer4-Sep-07 2:40
EisMayer4-Sep-07 2:40 
QuestionCalculate subitems? Pin
andredani4-Sep-07 2:31
andredani4-Sep-07 2:31 
AnswerRe: Calculate subitems? Pin
Colin Angus Mackay4-Sep-07 3:22
Colin Angus Mackay4-Sep-07 3:22 
GeneralRe: Calculate subitems? Pin
andredani4-Sep-07 3:27
andredani4-Sep-07 3:27 

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.