本文整理自网络,侵删。
-------------------------
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 xe 跨平台(windows、android安卓、苹果macos、苹果ios)写法
Delphi xe(indy10)tidbytes转ansistring的实现
Delphi xe使用tjsonobject解析json数据
更多相关阅读请进入《Delphi》频道 >>