我试了setwindowlong;不知是否没用对,打开DLL窗体再关闭,主窗体在任务栏上的标签就失效了。
我是这样写的代码:在DLL中
openform(ahandle:THandle);
begin
  application.handle:=ahandle//ahandle是主程序的HANDLE,在主程序中
                             //这样调用的:openform(application.handle);
  dllform:=tform1.create;
  dllform.showmodal;//在dllform的create事件中又用了setwindowlong函数
  dllform.free;
end;experts
  openform;
begin
end.
希望得到更好的有效的方法。

解决方案 »

  1.   

    传form的handle, openform(handle);
      

  2.   

    在 dll 中的窗體的 OnCreate事件用SetWindowLong(Handle, GWL_EXSTYLE, GetWindowLong(handle,GWL_EXSTYLE) or WS_EX_TOOLWINDOW
      

  3.   

    aiirii(ari-爱的眼睛):我是这么写的但不行,能讲讲这两个Handle分别是什么么?
      

  4.   

    应该把Application的Handle传递过去!
      

  5.   

    方法1
    protected
        procedure CreateParams(var Params: TCreateParams); override;//避免子窗体在任务栏出现
    procedure TfrmUserPdSt.CreateParams(var Params: TCreateParams);
    begin
      inherited;
      Params.ExStyle := Params.ExStyle or WS_EX_TOOLWINDOW;
    end;方法2
     SetWindowLong(Application.Handle, GWL_EXSTYLE, WS_EX_TOOLWINDOW);
      

  6.   

    >>我是这么写的但不行,能讲讲这两个Handle分别是什么么?那應該是你代碼有問題!
    一個是指主程序的handle, 一個是指本窗口的handle
      

  7.   

    openform(ahandle:THandle);
    begin
      application.handle:=ahandle//ahandle是主程序的HANDLE,在主程序中
                                 //这样调用的:openform(application.handle);
      dllform:=tform1.create(application);
      dllform.showmodal;//在dllform的create事件中又用了setwindowlong函数
      dllform.free;
    end;
      

  8.   

    openform(ahandle:THandle);
    begin
      application.handle:=ahandle//ahandle是主程序的HANDLE,在主程序中
                                 //这样调用的:openform(application.handle);
      dllform:=Application.createform(TForm1,DllForm) //tform1.create(application);
      dllform.showmodal;//在dllform的create事件中又用了setwindowlong函数
      dllform.free;
    end;