续:http://community.csdn.net/expert/Topicview2.asp?id=3682808 问.uses shellapi;
procedure TForm1.Button2Click(Sender: TObject);
var hSndrec32: HWND;
begin
  hSndrec32 := WIndows.FindWindow(nil, '声音 - 录音机');
  if hSndrec32<>0 then
  begin
  Windows.SetParent(hSndrec32, Panel1.Handle);
  Windows.MoveWindow(hSndrec32, 0, 0,panel1.Width,panel1.Height,true);
  end
  else
  showmessage('未发现该程序!');
end;procedure TForm1.FormCreate(Sender: TObject);
begin
   shellexecute(handle,'open','sndrec32.exe',nil,nil,sw_shownormal);
end;这段程序运行时,录音机的窗口是可以在pannel 中移动,我希望它不能移动.录音机的程序我不能改,我只有此窗口的句柄,如何实现?thkz!

解决方案 »

  1.   

    1:禁止鼠标拖动标题栏
    在private部分加入
    procedure WMNCLBUTTONDOWN(var msg:TMessage);message WM_NCLBUTTONDOWN;
    在实现部分加入:
    procedure TForm1.WMNCLBUTTONDOWN(var msg: TMessage);
    begin
      if msg.WParam= HTCAPTION  then
        SendMessage(self.Handle,WM_LBUTTONUP,0,0)
      else
        inherited;
    end;
      

  2.   

    这个问题……可能需要用Hook了。WH_GETMESSAGE不知道行不行?让高手回答吧……
      

  3.   

    使用SetWindowLong 去掉外部程序窗体的标题栏
      

  4.   

    恩……
    使用SetWindowLong 去掉外部程序窗体的标题栏
    ------------------------------
    SetWindowLong(handle,GWL_STYLE,GetWindowLong(handle,GWL_STYLE) and not WS_CAPTION)
      

  5.   

    问题解决  谢谢  flyforlove(为情飞)和Kevin_Lmx(繁华阅尽);