c#中有没有和MFC中PeekMessage的函数啊
解决方案 »
- 如何在CellValidating对girdview中的cell设置背景色和输入字符全选。。。
- 这样要用到哪方面的技术
- VS2005里面的DataGridView没有像VS2003里面的TableStyles属性怎么办?
- 如何获取网卡收发字节数
- 尝试读取或写入受保护的内存。这通常指示其他内存已损坏。 -----在线等,急啊,顶者有分!
- 怎么更换visual studio.net中的framework版本?
- 关于WebForm中如何替代winform中的BindingManagerBase的问题
- 如何在 其它窗体 和 类中 更改另一个窗体内控件的属性?
- use reader read string from oracle but '\0' appear to replace char in string!! why???
- vc#中开发ASP.NET怎么看后台出错的信息!!
- C#中如何用Javascript 控制控件的enable属性?
- 关于一个复杂的datagirdview
MSDN是这么说的:
Many applications perform lengthy processing "in the background." Sometimes performance considerations dictate using multithreading for such work. Threads involve extra development overhead, so they are not recommended for simple tasks like the idle-time work that MFC does in the OnIdle function. This article focuses on idle processing. For more information about multithreading, see Multithreading Topics. Some kinds of background processing are appropriately done during intervals that the user is not otherwise interacting with the application. In an application developed for the Microsoft Windows operating system, an application can perform idle-time processing by splitting a lengthy process into many small fragments. After processing each fragment, the application yields execution control to Windows using a PeekMessage loop.This article explains two ways to do idle processing in your application: Using PeekMessage in MFC's main message loop.Embedding another PeekMessage loop somewhere else in the application.PeekMessage in the MFC Message Loop
In an application developed with MFC, the main message loop in the CWinThread class contains a message loop that calls the PeekMessage Win32 API. This loop also calls the OnIdle member function of CWinThread between messages. An application can process messages in this idle time by overriding the OnIdle function. Note
Run, OnIdle, and certain other member functions are now members of class CWinThread rather than of class CWinApp. CWinApp is derived from CWinThread.
public class NativeMethods
{
/**//// <summary>Windows Message</summary>
[StructLayout(LayoutKind.Sequential)]
public struct Message
{
public IntPtr hWnd;
public uint msg;
public IntPtr wParam;
public IntPtr lParam;
public uint time;
public System.Drawing.Point p;
} [System.Security.SuppressUnmanagedCodeSecurity]
[DllImport("User32.dll", CharSet = CharSet.Auto)]
public static extern bool PeekMessage(out Message msg, IntPtr hWnd, uint messageFilterMin, uint messageFilterMax, uint flags);
}