在线程中使用SendMessage发送消息到主窗口
表示进度的数字标识做为SendMesage的lParam或wParam参数发过去.主窗口重载WndProc进行该消息处理. 示例如下const //自定义消息
MSG_MYPROGRESS= $0400 + 100;type
TForm1 = class(TForm)
private
procedure WndProc(var Message: TMessage); override; //重载TForm的WndProc
end;procedure TForm1.WndProc(var Message: TMessage);
var h: hwnd;
begin
inherited; //继续TForm原来的方法
if Message.Msg = MSG_MYPROGRESS then begin
ProgressBar1.Position := Message.LParam;
end;
end;线程中发送消息, mainhand需要你创建线程时传进去
for i:=0 to n do begin
//.........
SendMessage(mainHand , MSG_MYPROGRESS, i, i);
end;
表示进度的数字标识做为SendMesage的lParam或wParam参数发过去.主窗口重载WndProc进行该消息处理. 示例如下const //自定义消息
MSG_MYPROGRESS= $0400 + 100;type
TForm1 = class(TForm)
private
procedure WndProc(var Message: TMessage); override; //重载TForm的WndProc
end;procedure TForm1.WndProc(var Message: TMessage);
var h: hwnd;
begin
inherited; //继续TForm原来的方法
if Message.Msg = MSG_MYPROGRESS then begin
ProgressBar1.Position := Message.LParam;
end;
end;线程中发送消息, mainhand需要你创建线程时传进去
for i:=0 to n do begin
//.........
SendMessage(mainHand , MSG_MYPROGRESS, i, i);
end;
解决方案 »
- 如何得到windows系统的句柄???大侠支招
- C语言中“char * params[]”的参数在delphi中该如何定义?100分求解决放过。
- 急,为什么我的参数会莫名其妙的改变?
- 100分!RichEdit控件如何设置上下标?
- 请您帮忙,怎样实现类似CAD或protel似的作图方式,可以画完后再编辑那些线、圆……等,谢谢.
- 这句更新sql语句提示"试图执行查询中不包含作为合计函数一部分的特定表达式'price'。错在哪
- 请问我的Delphi6。0的帮助是不是不全?为什么我查不到MessageDlg().IntToStr().Format()等常用函数?
- QRPreview上怎样显示数据?
- 讨论进程与线程的不同之处
- 不能使用TClientDataSet的ApplyUpdates?
- 如何在表单1中隐藏表单1,然后启动表单2
- 一个非常简单的动态建立窗体的问题
Readbuffer、writebuffer
我发送用的是myfile:tfilestream;
myfile:=tfilestream.create(‘xxxxx’,fmopen);
我发送用的是myfile:tfilestream;
myfile:=tfilestream.create(‘xxxxx’,fmopen);