procedure adPumpMessage (hWnd: HWND); {消息泵(消息循环)} 
var 
stmsg: MSG; 
begin 
while GetMessage(stmsg, hWnd, 0, 0) do 
begin 
TranslateMessage (stmsg) ; 
DispatchMessage (stmsg) ; 
end; {关闭窗口时卡在这里了} 
end; 
 我想用这个过程。
hMainWnd := CreateWindowEx (0, 'MyClass', 'First Window', WS_OVERLAPPEDWINDOW, 
200, 200, 600, 400, 0, 0, hMod, nil) ; ShowWindow (hMainWnd, SW_SHOW) ; 
UpdateWindow (hMainWnd) ; 
adPumpMessage (hMainWnd) 
把其中的HMAINWND改变成DLL窗体的创建可以吗?
其实我想实现在的功能主是。让DLL窗体一直处于激活状态。这样就不会造成。主调用窗体在处理大量数据时。DLL窗体会暂时停滞不知道我的想法可以实现吗?

解决方案 »

  1.   

    Type 
        Tdllform = class(TThread) 
      private 
          T_AHandle:THandle; T_ACaption:Pchar  ; 
      protected 
        procedure Execute; override;   public 
        constructor Create(AHandle:THandle;ACaption:Pchar); 
      end; constructor  TdllForm.Create(AHandle:THandle;ACaption:Pchar); 
    begin 
        T_AHandle :=  AHandle  ; 
        T_ACaption  :=  ACaption; 
        inherited Create(False); 
    end;   procedure    TdllForm.Execute ; 
          var AForm:TForm_main;AMsg :Tmsg; 
      begin 
          AForm:=TForm_main.Create(nil); 
          Aform.Caption:=T_ACaption; 
          AForm.Show; 
            while GetMessage(AMsg, 0, 0, 0) do begin 
                TranslateMessage(AMsg); 
                DispatchMessage(AMsg); 
          end; 
      end; 
    Function ShowForm(AHandle:THandle;ACaption:Pchar):Boolean;StdCall; 
    begin 
        TdllForm.Create(Ahandle,Acaption); 
        Result:=true; 
    end;