RegisterServerProcess这个函数没有公开,要用动态加载的方法,我现在手头没有资料,你要的话给我来信。easy得很

解决方案 »

  1.   

    【呵呵,应该是RegisterServiceProcess吧】    The RegisterServiceProcess function registers or unregisters a service process. A service process continues to run after the user logs off. 
        To call RegisterServiceProcess, retrieve a function pointer using GetProcAddress on KERNEL32.DLL. Use the function pointer to call RegisterServiceProcess. 
    【注意,RegisterServiceProcess在2000下无效】
    调用示例如下:
    typedef UINT (CALLBACK* LPFNDLLFUNC1)(DWORD, DWORD);
    ............
    ............
    HINSTANCE hDLL;               // Handle to DLL
    LPFNDLLFUNC1 lpfnDllFunc1;    // Function pointer

    hDLL = LoadLibrary("kernel32.dll");
    if (hDLL != NULL)
    {
       lpfnDllFunc1 = (LPFNDLLFUNC1)GetProcAddress(hDLL, "RegisterServiceProcess");
       if (!lpfnDllFunc1)
       {
    // handle the error
    FreeLibrary(hDLL);       
    // return error_num;
       }
       else
      {
    // call the function
    lpfnDllFunc1(a, 1);
      }
    }