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 xe ioutils tpath(结构体) 的方法与属性

Delphi内存对齐

Delphi tstream 详细介绍

Delphi 对汉字字符串的截取问题

Delphi 防止刷新时闪烁的终极解决办法

dbgrid的cellclick事件,单击当前行记录的那一行时,不发生

Delphi 强制删除文件 zwdeletefile

Delphi fmx 获取系统版本 android ios通用

Delphi请求http接口中文乱码问题

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



打赏

取消

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

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

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

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

评论

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