DLLProc和ExitProc有什么区别???  
DLLProc中有个  
DLL_PROCESS_DETACH值,是DLL死亡的时候执行的。那和执行ExitProc指向的函数有什么区别???

解决方案 »

  1.   

    var
      lpExitCode : DWORD ;..................
     
    GetExitCodeProcess(Application.Handle, lpExitCode) ;
    Windows.ExitProcess(lpExitCode) ;        //  JackyPoints to a program's exit procedure.UnitSystemCategorytermination procedure supportvar ExitProc: Pointer;DescriptionThe ExitProc pointer variable enables you to install an exit procedure. The exit procedure always gets called as part of a program's termination. ExitProc should only be used when generating .EXE files. Do not use ExitProc within a dynamically loaded package.An exit procedure takes no parameters and must be compiled with a far procedure directive to force it to use the far call model.When implemented properly, an exit procedure actually becomes part of a chain of exit procedures. The procedures on the exit chain get executed in reverse order of installation. All ExitProc calls belong in the finalization section.To keep the exit chain intact, you need to save the current contents of ExitProc before changing it to the address of your own exit procedure.The first statement in your exit procedure must reinstall the saved value of ExitProc. ........................................
    Points to a procedure invoked by a DLL entry point.UnitSystemCategorymiscellaneous routinesvar DLLProc: Pointer;DescriptionDLLProc is used to specify a procedure that is invoked every time a DLL's entry point is called. A procedure assigned to DLLProc must take one parameter of type Integer. For example,procedure LibraryProc(Reason: Integer);When the procedure is invoked, this single parameter contains a value between 0 and 3 as defined by the following group of constants in the Windows unit.const  DLL_PROCESS_DETACH = 0;
      DLL_PROCESS_ATTACH = 1;
      DLL_THREAD_ATTACH  = 2;
      DLL_THREAD_DETACH  = 3;For further details on the meaning of these constants, refer to the description of the DllEntryPoint function in the Win32 API online help.Note: DLL_PROCESS_ATTACH is passed to the procedure only if the DLL抯 initialization code calls the procedure and specifies DLL_PROCESS_ATTACH as a parameter.这里说的够清楚了吧