delphi 在线程中运行窗体


本文整理自网络,侵删。

 -------------------------

var
wClass: TWndClass;
Msg: TMsg;

function WindowProc(hWnd,Msg,wParam,lParam:Integer):Integer; stdcall;
begin
if Msg = WM_DESTROY then PostQuitMessage(0)
else if Msg = WM_lBUTTONDOWN then DoSomething;
Result := DefWindowProc(hWnd,Msg,wParam,lParam);
end;

function MyWindow(Ptr: Pointer):Longint;stdcall;
begin
wClass.lpszClassName:= 'CN';
wClass.lpfnWndProc := @WindowProc;
wClass.hInstance := hInstance;
wClass.hbrBackground:= 1;

RegisterClassA(wClass);

CreateWindow(wClass.lpszClassName,'My Window',
WS_OVERLAPPEDWINDOW or WS_VISIBLE,
10,10,530,100,0,0,hInstance,nil);
while GetMessage(Msg,0,0,0) do
DispatchMessage(Msg);
end;

begin
CreateThread(nil, 0, @MyWindow, nil, 0, thrID);
end.

相关阅读 >>

Delphi 获得网页乱码

Delphi 关于datetimepicker的一点问题(同时修改日期和时间的实现)

Delphi使用tclientdataset�r不携带midas.dll的方法

Delphi从dbgrid导出数据保存成excel文件

Delphi xe android 程序切换到后台及从后台切换到前台实现

Delphi 计算加班时间工时的函数

Delphi判断字符串是否是数字、字母、大小写字母

Delphi firedac 连接access mdb数据库的方法

Delphi延时4种方法

Delphi 系统托盘组件 ttrayicon 简介

更多相关阅读请进入《Delphi》频道 >>



打赏

取消

感谢您的支持,我会继续努力的!

扫码支持
扫码打赏,您说多少就多少

打开支付宝扫一扫,即可进行扫码打赏哦

分享从这里开始,精彩与您同在

评论

管理员已关闭评论功能...