delphi 在单独线程中运行窗体


本文整理自网络,侵删。

 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 10.3.2 社区版的安装

Delphi实现的sunday字符串搜索算法

cnpack sqlite tool 2.04

Delphi vclskin 5.40在2010安装方法

Delphi 获取窗体坐标触发事件

Delphi与汇编杂谈

Delphi远程开机再配合远程控制

Delphi 操作“任务栏”

Delphi formactivate与formshow事件有什么区别

Delphi idftp 使用被动连接

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



打赏

取消

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

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

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

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

评论

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