zoukankan      html  css  js  c++  java
  • Dll方式的线程,需要引用这个

    {== D6DLLSynchronizer =================================================}
    {: This unit handles the D6 synchronize problem in DLLs
    @author Dr. Peter Below
    @desc   Version 1.0 created 3 November 2001<BR>
            Current revision 1.0<BR>
            Last modified       3 November 2001<P>
    Usage: <BR>
    Just add this unit to the DLL project, make sure you do not modify
    the WakeMainThread global event yourself elsewhere. }
    {======================================================================}
    Unit DLLSynchronizer;
    
    Interface
    
    Implementation
    Uses Windows, Messages, classes;
    
    Type
      TSyncHelper = Class
      Private
        wnd: HWND;
        Procedure MsgProc( Var msg: TMessage );
        Procedure Wakeup( sender: TObject );
      Public
        Constructor Create;
        Destructor Destroy; override;
      End;
    
    Var
      helper: TSyncHelper = nil;
    
    { TSyncHelper }
    
    Constructor TSyncHelper.Create;
    Begin
      inherited;
      wnd:= AllocateHWnd( msgproc );
      WakeMainThread := Wakeup;
    End;
    
    Destructor TSyncHelper.Destroy;
    Begin
      WakeMainThread := nil;
      DeallocateHWnd( wnd );
      inherited;
    End;
    
    Procedure TSyncHelper.MsgProc(Var msg: TMessage);
    Begin
      If msg.Msg = WM_USER Then
        CheckSynchronize
      Else
        msg.result := DefWindowProc( wnd, msg.msg, msg.WParam, msg.LParam );
    End;
    
    Procedure TSyncHelper.Wakeup(sender: TObject);
    Begin
      PostMessage( wnd, WM_USER, 0, 0 );
    End;
    
    Initialization
      helper:= TSyncHelper.Create;
    Finalization
      helper.free;
    End.
    View Code

  • 相关阅读:
    《深入浅出WPF》4.0x名称空间
    《深入浅出WPF》3.0 XAML语法
    DataGridview 自动切换到 下一行
    C# 生成条形码图片,效果不错
    将DataTable 导出为csv
    DataTable,DataGridVIew转换到xls 方法 (转)
    NPOI读取Excel 数据 转。。。
    修改 字段大小
    VC
    统计每天 指定 时间段内 的数据
  • 原文地址:https://www.cnblogs.com/key-ok/p/3380551.html
Copyright © 2011-2022 走看看