DLLEntryPoint 方法在哪个单无,怎样用?

解决方案 »

  1.   

    DllEntryPoint函数为一个入口方法,如果使用者在DLL被系统初始化或者注销时被调用,用来写入对DLL的初始化程序和卸载程序
    用于区别多线程单线程对DLL的调用、创建、卸载DLL; 
    BOOL WINAPI DllEntryPoint(
        HINSTANCE hinstDLL,  //参数:hinstDLL用来指示DLL的基地址;
        DWORD fdwReason,         // fdwReason用来指示DLL的调用方式,
        LPVOID lpvReserved 
       );
      

  2.   

    procedure DllEntryPoint(dwReason : DWORD);
    begin
     case dwReason of
       Dll_Process_Attach : begin
        {If we are getting mapped into a process, then get}
        {a pointer to our process wide memory mapped variable}
         hObjHandle := 0;
         lpHookRec := NIL;
         MapFileMemory(sizeof(lpHookRec^));
       end;
       Dll_Process_Detach : begin
        {If we are getting unmapped from a process then, remove}
        {the pointer to our process wide memory mapped variable}
         UnMapFileMemory;
       end;
     end;
    end;
    begin
     DLLProc := @DllEntryPoint;
     DllEntryPoint(Dll_Process_Attach);
    end;
      

  3.   

    谢谢大家,不过我想问的是,DllEntryPoint,是再哪个单元中声明
      

  4.   

    就用 hongqi162(失踪的月亮) 的方法就可以了。。