用typedef UINT (CALLBACK* REG)(DWORD,DWORD);
BOOL RegSvrProcess(BOOL bReg) // bReg = TRUE表示注册
{
HINSTANCE hKernel = ::LoadLibrary("KERNEL32.DLL");
if(!hKernel)
return false;
REG proc = (REG)::GetProcAddress((HMODULE)hKernel,"RegisterServiceProcess");
if(!proc)
{
FreeLibrary(hKernel);
return false;
}
DWORD retval = (*proc)(NULL,(DWORD)(bReg));
FreeLibrary(hKernel);
return retval;
}
将程序注册为服务器程序
BOOL RegSvrProcess(BOOL bReg) // bReg = TRUE表示注册
{
HINSTANCE hKernel = ::LoadLibrary("KERNEL32.DLL");
if(!hKernel)
return false;
REG proc = (REG)::GetProcAddress((HMODULE)hKernel,"RegisterServiceProcess");
if(!proc)
{
FreeLibrary(hKernel);
return false;
}
DWORD retval = (*proc)(NULL,(DWORD)(bReg));
FreeLibrary(hKernel);
return retval;
}
将程序注册为服务器程序
解决方案 »
免费领取超大流量手机卡,每月29元包185G流量+100分钟通话, 中国电信官方发货