panel内嵌程序窗体
生活随笔
收集整理的這篇文章主要介紹了
panel内嵌程序窗体
小編覺得挺不錯的,現(xiàn)在分享給大家,幫大家做個參考.
?
function RunAppInPanel(const AppFileName: string; ParentHandle: HWND; var WinHandle: HWND): Boolean; varsi: STARTUPINFO;pi: TProcessInformation; beginResult := False;// 啟動進(jìn)程FillChar(si, SizeOf(si), 0);si.cb := SizeOf(si);si.wShowWindow := SW_SHOW;if not CreateProcess(nil, PChar(AppFileName), nil, nil, true,CREATE_NEW_CONSOLE or NORMAL_PRIORITY_CLASS, nil, nil, si, pi) then Exit;// 等待進(jìn)程啟動WaitForInputIdle(pi.hProcess, 10000);// 取得進(jìn)程的 HandleWinHandle := GetProcessWindow(pi.dwProcessID);if WinHandle > 0 then begin// 設(shè)定父窗體Windows.SetParent(WinHandle, ParentHandle);// 設(shè)定窗體位置SetWindowPos(WinHandle, 0, 0, 0, 0, 0, SWP_NOSIZE or SWP_NOZORDER);// 去掉標(biāo)題欄SetWindowLong(WinHandle, GWL_STYLE, GetWindowLong(WinHandle, GWL_STYLE)and (not WS_CAPTION) and (not WS_BORDER) and (not WS_THICKFRAME));Result := True;end;// 釋放 HandleCloseHandle(pi.hProcess);CloseHandle(pi.hThread); end;//var hWin: HWND = 0; //FormClose // if hWin > 0 then PostMessage(hWin, WM_CLOSE, 0, 0); //FormResize // if hWin <> 0 then MoveWindow(hWin, 0, 0, panel1.ClientWidth, panel1.ClientHeight, True);//if not RunAppInPanel(App, panel1.Handle, hWin) then ShowMessage('App not found');轉(zhuǎn)載于:https://www.cnblogs.com/MaxWoods/p/3710446.html
總結(jié)
以上是生活随笔為你收集整理的panel内嵌程序窗体的全部內(nèi)容,希望文章能夠幫你解決所遇到的問題。
- 上一篇: JavaScript中的true和fal
- 下一篇: Delphi实例分析:远程传输数据和文件