在Windows服务程序中可以显示窗体吗?

gfiop 2004-09-29 06:02:17
谢谢./...
...全文
311 7 打赏 收藏 转发到动态 举报
写回复
用AI写文章
7 条回复
切换为时间正序
请发表友善的回复…
发表回复
Yanglintao 2005-04-05
  • 打赏
  • 举报
回复
明月清风的方法不错,但是能不能在vc#代码中把“允许服务与桌面交互”这项功能添加上?
盗奶的夜猫 2005-03-17
  • 打赏
  • 举报
回复
mark
syj00700 2005-02-03
  • 打赏
  • 举报
回复
可以!

方法是:
在Windows服务管理器中,把相应服务的"登录"身份改为"本地帐户",然后把"允许服务与桌面交互"前的复选框打上钩,再重新启动该服务即可!
zhouboss 2004-12-15
  • 打赏
  • 举报
回复
关注中
windinwing 2004-09-30
  • 打赏
  • 举报
回复
不过可以用托盘来管理服务的,类似serv_u
还有看过如下写法的,用参数启动窗口

static void Main(string[] args)
{
if(args.Length > 0){
if(args[0].ToLower() == "trayapp"){
System.Windows.Forms.Application.Run(new wfrm_Tray());
}
}
else{
System.ServiceProcess.ServiceBase[] ServicesToRun;

// More than one user Service may run within the same process. To add
// another service to this process, change the following line to
// create a second service object. For example,
//
// ServicesToRun = New System.ServiceProcess.ServiceBase[] {new Service1(), new MySecondUserService()};
//
ServicesToRun = new System.ServiceProcess.ServiceBase[] { new MailServer() };

System.ServiceProcess.ServiceBase.Run(ServicesToRun);
}
}
webserv2 2004-09-29
  • 打赏
  • 举报
回复
应该不可以吧!
就相webserveice一样!没有窗体的
popcorn 2004-09-29
  • 打赏
  • 举报
回复
No

110,535

社区成员

发帖
与我相关
我的任务
社区描述
.NET技术 C#
社区管理员
  • C#
  • Web++
  • by_封爱
加入社区
  • 近7日
  • 近30日
  • 至今
社区公告

让您成为最强悍的C#开发者

试试用AI创作助手写篇文章吧