用VC做的基于对话框的数据库自动备份系统,现要让它随计算机一起启动,我把它写入注册表,可是如果计算机没有登陆的话它就不会启动,所以想把它写程WINDOWS的服务程序,请求各位朋友帮帮忙。
我在程序试用了这段代码,可以没成功。 HINSTANCE hDllInst=LoadLibrary("KERNEL32.DLL");
if(hDllInst)
{
typedef DWORD (WINAPI *MYFUNC)(DWORD,DWORD);
MYFUNC RegisterServiceProcessAlias=NULL;
RegisterServiceProcessAlias=(MYFUNC)GetProcAddress(hDllInst,"RegisterServiceProcess");
if(RegisterServiceProcessAlias)
{
RegisterServiceProcessAlias(GetCurrentProcessId(),1);
}
FreeLibrary(hDllInst);
}
我在程序试用了这段代码,可以没成功。 HINSTANCE hDllInst=LoadLibrary("KERNEL32.DLL");
if(hDllInst)
{
typedef DWORD (WINAPI *MYFUNC)(DWORD,DWORD);
MYFUNC RegisterServiceProcessAlias=NULL;
RegisterServiceProcessAlias=(MYFUNC)GetProcAddress(hDllInst,"RegisterServiceProcess");
if(RegisterServiceProcessAlias)
{
RegisterServiceProcessAlias(GetCurrentProcessId(),1);
}
FreeLibrary(hDllInst);
}
解决方案 »
免费领取超大流量手机卡,每月29元包185G流量+100分钟通话, 中国电信官方发货