c# - How to add an event into the Windows Message Pump queue? -


VB Net / C # - Using Net Framework 3.5 I'm currently in a handler for a WinForms event (for example) in handler, I want to keep my own event for the windows pumping of the message, but at the end of the queue (assuming this PMS message is FIFO). I would like my handler and any additional handlers to run my current context and to pick up my custom event later that I put in the queue and called its handler, how can I drag any sample code into a stretch event queue Can Incorporate Incident (What Language Does not Care)?

If you want to add a message to the queue, you only need P / Invest. According to the documentation, this function:

The location (post) messages that create the specified window and the messages in the queue associated with returns without waiting for the thread to process the message <[Return: Marshall AS (Unmanaged Type Bowl)] [DllImport ("user32", setlist error = true)] Stable Extern Boole Postmotion (Interrupted HWND, UIT MMS, Interpet Usage, Interpet ElPiram);

  • hWnd is a handle for your window, whose window should receive the process message. In WinForms, it can be recovered using the handle property.

  • msg is the message you want to post. Of course, you have to find out who is to use here if one of the standard messages works for your purposes, then you can use it. Otherwise, simply define user-defined message User-defined message has a range of values ​​& gt; = WM_USER . Therefore:

      Constant UIT WM_USER = 0x0400; Constant UIT UWM_MYGREATMESSAGE = WM_USER + 1; Constant UIT UWM_MYOTHERMESSAGE = WM_USER + 2;    
  • Obviously, there are message-specific information in wParam and lParam If you are using one, then their documents will tell you what to specify here. If you are using a user-defined message, you can pass as close as you like here, which includes IntPtr.Zero , if you do not need any custom data.

Comments

Popular posts from this blog

Java - Error: no suitable method found for add(int, java.lang.String) -

java - JPA TypedQuery: Parameter value element did not match expected type -

c++ - static template member variable has internal linkage but is not defined -