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

C#

 
GeneralWindows Messag handling in C# Pin
Vini Deep1-May-04 0:21
Vini Deep1-May-04 0:21 
Hi,

Is there any C# equivalent for SDK function 'MsgWaitForMultipleObjects()'? I want to implement this following c++ code in c#. Which is the right path to follow.
bool CMyClass::MyFun()
{
 unsigned  threadID;
 DWORD     waitResult;
 MSG       msg;
   

 writeSuccess = false;
 hThread = (HANDLE)_beginthreadex(NULL, 0,writeThread, NULL,0,&threadID);

 if (!hThread)
  return false;

 waitResult = MsgWaitForMultipleObjects(1, &hThread, FALSE, INFINITE, QS_ALLINPUT);
 while (waitResult != WAIT_OBJECT_0)
 {
  if (waitResult == WAIT_OBJECT_0 + 1)
   while (PeekMessage(&msg, NULL,0,0,PM_REMOVE))
   {
    TranslateMessage(&msg);
    DispatchMessage(&msg);
   }
  if (waitResult == WAIT_FAILED)
  {
   //An error occured, we need to handle it here
   break;
  }
   
  waitResult = MsgWaitForMultipleObjects(1, &hThread, FALSE, INFINITE, QS_ALLINPUT);
 }
 CloseHandle(hThread);

 hThread = NULL;

 return writeSuccess;
}


I have read about the IMessageFilter interface of Microsoft.Win32 namespace. Is this the right way to proceed on this.

Kindly advise.


Vini
GeneralRe: Windows Messag handling in C# Pin
scadaguy1-May-04 8:33
scadaguy1-May-04 8:33 
GeneralWeb Service from Java Pin
Member 1697730-Apr-04 19:35
Member 1697730-Apr-04 19:35 
GeneralRe: Web Service from Java Pin
Mazdak30-Apr-04 19:57
Mazdak30-Apr-04 19:57 
GeneralRe: Web Service from Java Pin
Heath Stewart2-May-04 6:09
protectorHeath Stewart2-May-04 6:09 
GeneralCapturing mouse movement while transparent Pin
bennyrascal30-Apr-04 19:18
bennyrascal30-Apr-04 19:18 
GeneralRe: Capturing mouse movement while transparent Pin
Heath Stewart2-May-04 6:05
protectorHeath Stewart2-May-04 6:05 
GeneralRe: Capturing mouse movement while transparent Pin
bennyrascal2-May-04 19:39
bennyrascal2-May-04 19:39 
GeneralDocking Dilemma Pin
gUrM33T30-Apr-04 15:48
gUrM33T30-Apr-04 15:48 
GeneralRe: Docking Dilemma Pin
Mazdak30-Apr-04 18:47
Mazdak30-Apr-04 18:47 
GeneralRe: Docking Dilemma Pin
gUrM33T30-Apr-04 19:46
gUrM33T30-Apr-04 19:46 
GeneralRe: Docking Dilemma Pin
Mazdak30-Apr-04 19:55
Mazdak30-Apr-04 19:55 
GeneralRe: Docking Dilemma Pin
Heath Stewart2-May-04 6:00
protectorHeath Stewart2-May-04 6:00 
GeneralRe: Docking Dilemma Pin
gUrM33T2-May-04 7:27
gUrM33T2-May-04 7:27 
GeneralRe: Docking Dilemma Pin
Heath Stewart2-May-04 7:47
protectorHeath Stewart2-May-04 7:47 
GeneralMultimedia Keys Pin
Member 87406830-Apr-04 14:31
Member 87406830-Apr-04 14:31 
GeneralRe: Multimedia Keys Pin
Mazdak30-Apr-04 19:02
Mazdak30-Apr-04 19:02 
GeneralRe: Multimedia Keys Pin
Heath Stewart2-May-04 5:57
protectorHeath Stewart2-May-04 5:57 
GeneralRe: Multimedia Keys Pin
Member 8740682-May-04 21:09
Member 8740682-May-04 21:09 
Questionremoting : object reference not set to an instance of an object ??? Pin
youssef30-Apr-04 13:45
youssef30-Apr-04 13:45 
AnswerRe: remoting : object reference not set to an instance of an object ??? Pin
Heath Stewart30-Apr-04 13:54
protectorHeath Stewart30-Apr-04 13:54 
GeneralRe: remoting : object reference not set to an instance of an object ??? Pin
youssef30-Apr-04 14:06
youssef30-Apr-04 14:06 
GeneralRe: remoting : object reference not set to an instance of an object ??? Pin
Heath Stewart30-Apr-04 14:13
protectorHeath Stewart30-Apr-04 14:13 
GeneralRe: remoting : object reference not set to an instance of an object ??? Pin
youssef30-Apr-04 15:06
youssef30-Apr-04 15:06 
GeneralForms Pin
mookeroo30-Apr-04 12:47
mookeroo30-Apr-04 12:47 

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.