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的md2、md4、md5类

Delphi word转pdf两种方法

Delphi vcl 模式下和firemonkey 模式下的字符串

Delphi lastdelimiter:在字符串中查找选定的字符最后出现的位置

Delphi 判断一个数组的长度用 length 还是 sizeof ?

Delphi 判断目录是否存在,不存在则创建目录并打开,存在则直接打开

Delphi xe7 android 实现的在线更新app的一个程序

Delphi显示 jpg、png、gif 图片及 gif 动画

Delphi 操作sql 插入一万条数据 三种方式速度测试

Delphi datasnap 上传/下载大文件(本demo以图传片文件为例)

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



打赏

取消

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

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

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

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

评论

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