怎么样设置两个进程的窗体父子关系? ( 积分: 5 )

  • 主题发起人 主题发起人 juexing
  • 开始时间 开始时间
J

juexing

Unregistered / Unconfirmed
GUEST, unregistred user!
怎么样设置两个进程的窗体父子关系?<br>我下面的代码是要将mapinfo应用程序装载到form1的pnl:&nbsp;Tpanel里.<br><br>procedure&nbsp;TForm1.btn1Click(Sender:&nbsp;TObject);<br>var<br>&nbsp;&nbsp;HW:&nbsp;HDC;<br>&nbsp;&nbsp;H:&nbsp;THandle;<br>&nbsp;&nbsp;J:&nbsp;THandle;<br>&nbsp;&nbsp;Pid:&nbsp;DWORD;<br>&nbsp;&nbsp;Pid1:&nbsp;DWORD;<br>begin<br>&nbsp;&nbsp;WinExec('D:/Program&nbsp;Files/MapInfo/Professional/MAPINFOW.EXE',WM_SHOWWINDOW);<br>&nbsp;&nbsp;hw&nbsp;:=&nbsp;Findwindow(nil,'MapInfo&nbsp;Professional');<br>&nbsp;&nbsp;if&nbsp;hw&nbsp;=&nbsp;0&nbsp;then&nbsp;showmessage('&amp;Auml;&amp;atilde;&amp;Atilde;&amp;raquo;&amp;Oacute;&amp;ETH;°&amp;sup2;×°mapinfo')<br>&nbsp;&nbsp;else<br>&nbsp;&nbsp;showmessage('&amp;Otilde;&amp;Ograve;&amp;micro;&amp;frac12;&amp;Aacute;&amp;Euml;mapinfo');<br>&nbsp;&nbsp;GetWindowThreadProcessId(hw,Pid);<br>&nbsp;&nbsp;H&nbsp;:=&nbsp;OpenProcess(PROCESS_ALL_ACCESS,&nbsp;false,&nbsp;pid);<br>&nbsp;&nbsp;j&nbsp;:=&nbsp;OpenProcess(PROCESS_ALL_ACCESS,&nbsp;false,&nbsp;Cardinal(Form1));<br>&nbsp;&nbsp;TControl(HW).Parent&nbsp;:=&nbsp;pnl1;<br>end;
 
后退
顶部