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.

相关阅读 >>

Delphi2010 关于record类型rtti反射的用途和方法

Delphi 获取其它软件的tlistbox句柄,怎么取得listbox中的数据

Delphi xe 安卓开发黑屏的另一种解决办法

Delphi xe10 对 json的解析应用

Delphi编程之系统oem diy

Delphi xe5实现按android的back键无法退出关闭程序

Delphi xe 枚举指定目录及子目录下的所有文件

Delphi 将图片压缩后转base64函数

Delphi实现tedit控件的外观只有一条下划线

Delphi debug release区别是什么?

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



打赏

取消

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

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

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

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

评论

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