WinForm什么时间启动消息循环?如何一步一步处理?消息处理机制是什么?谢谢!
解决方案 »
- 2011年第341天,是几月几日?
- DataGridView自定义TextBox列为什么不不能输入点(.)
- 请问下 writefile函数是不是有这样的限制?
- 问一个比较弱的问题:我怎样才能在程序中运行一个Sql server的脚本文件
- 仅有四行代码的小小问题就给20分哦~
- 文本框透明,不能被选中
- 共享配件(assembly)和私有配件究竟有什么区别呢
- .net中的程序用CSC命令在命令提示副中,应该是生成MSIL代码的,严格的说并没有生成机器骂,执行时为什么不需要。NET 的支持
- 后缀名为pdg的文件怎么打开,哪里有相关软件?
- EF6 怎么实现外键表关联查询
- 限制文件下载速度(请高手帮忙)
- 如何得到线程号?
Imports System.Runtime.InteropServicesModule Module1 Public Const MyMsgID As Integer = &H8FB Public WithEvents MyTest As New clsRefresh Public Structure StructMsg
Dim MsgIndex As Integer
Dim MsgInfo As String
Dim MsgMemo As String
End Structure Private Sub MyTest_NowCount(ByVal i As Integer) Handles MyTest.NowCount
Call SetOpenFormTitles(i.ToString)
End Sub Private Sub SetOpenFormTitles(ByVal Titles As String)
Try
For Each f As Form In My.Application.OpenForms
Call SetFormTitle(f, Titles)
Next
Catch ex As Exception
MsgBox(ex.Message)
End Try
End Sub Private Delegate Sub SetFormTitleDelegate(ByVal f As Form, ByVal Titles As String) Private Sub SetFormTitle(ByVal f As Form, ByVal Titles As String)
If Not f.InvokeRequired Then
Call SendMsg(f, Titles)
Else
Dim del As SetFormTitleDelegate = AddressOf SetFormTitle
Dim param As Object() = {f, Titles} f.Invoke(del, param)
End If
End Sub Private Sub SendMsg(ByVal f As Form, ByVal titles As String)
Dim mMsg As New StructMsg
With mMsg
.MsgIndex = 1
.MsgInfo = "12345678901234567890" + Space(2) + titles
.MsgMemo = "none"
End With Dim hWnd As IntPtr
Dim msg As Integer = MyMsgID
Dim wparam As IntPtr
Dim lparam As IntPtr = Marshal.AllocHGlobal(17) 'mMsg.MsgInfo.Length + mMsg.MsgMemo.Length + 4) Marshal.StructureToPtr(mMsg, lparam, True)
Dim WinMsg As System.Windows.Forms.Message= Message.Create(hWnd, msg, wparam, lparam) f.PreProcessMessage(WinMsg)
Marshal.FreeHGlobal(lparam)
End SubEnd Module
[email protected]
谢谢!
Public Sub main()
While (...)
Try
Application.DoEvents()
Catch ex As Exception
'Throw ex
End Try
End While
End Sub