又来请教问题了,求问题解决思路。。

大_爱 2011-12-05 10:31:55
程序需要开机启动,显示一个消息框,或者窗体,这个程序并不会结束, 用户也关不掉的(这部分我实现了),然后这个程序有一个网络的服务,这个服务等待接收消息,接收到消息后,窗口关掉,或者隐藏,但是这个应用程序后台的网络部分还要继续运行的,等到下一个消息过来的时候,再弹出这个消息框或者窗体。

不知道说明白了没有。先谢谢大家了。
...全文
223 20 打赏 收藏 转发到动态 举报
AI 作业
写回复
用AI写文章
20 条回复
切换为时间正序
请发表友善的回复…
发表回复
exercisebook 2013-01-06
  • 打赏
  • 举报
回复
请问你做出来了没啊?
bobye1230 2011-12-05
  • 打赏
  • 举报
回复
病毒??不想让用户关掉
大_爱 2011-12-05
  • 打赏
  • 举报
回复
[Quote=引用 5 楼 dahuaixiaohuai 的回复:]

主线程显示窗口不关闭。
在程序中启动一个后台线程,等待接收消息,如果关闭,则隐藏窗口,哪果启动则显示窗口。
[/Quote]

哦!貌似这样不好哟
一叶之舟 2011-12-05
  • 打赏
  • 举报
回复
主线程显示窗口不关闭。
在程序中启动一个后台线程,等待接收消息,如果关闭,则隐藏窗口,哪果启动则显示窗口。
大_爱 2011-12-05
  • 打赏
  • 举报
回复
我就想问问要做个这样的程序,怎么设计了,
  • 打赏
  • 举报
回复
应为你没说明白啊
大_爱 2011-12-05
  • 打赏
  • 举报
回复
哎,都没人来了。。。
大_爱 2011-12-05
  • 打赏
  • 举报
回复
[Quote=引用 18 楼 zhao4zhong1 的回复:]

服务程序通常默认禁止交互也就是禁止显示窗口。
the service application must be marked as "interactive". This allows your service to interact with the desktop.
This requires modifying a registry key: you must bitwise-or th……
[/Quote]

谢谢,结贴了!
赵4老师 2011-12-05
  • 打赏
  • 举报
回复
服务程序通常默认禁止交互也就是禁止显示窗口。
the service application must be marked as "interactive". This allows your service to interact with the desktop.
This requires modifying a registry key: you must bitwise-or the type entry for your service with 0x100 (this is the value for SERVICE_INTERACTIVE_PROCESS according to Winnt.h). The exact location and name of this registry entry varies. For example:

HKEY_LOCAL_MACHINE\SYSTEM\CurrentControlSet\Services\YourServiceKey

You need to adjust the service application timeout. Otherwise, the service application will be killed within 20 seconds after starting. Adjusting the timeout involves setting an entry in the following registry key:

HKEY_LOCAL_MACHINE\SYSTEM\CurrentControlSet\Control


Under this key, create a DWORD data value called ServicesPipeTimeout. Set this entry to the amount of time in milliseconds that you want the service to wait before timing out. For example, 60,000 is one minute, while 86,400,000 is 24 hours.

设置ServicesPipeTimeout后需要重启系统才生效
大_爱 2011-12-05
  • 打赏
  • 举报
回复
[Quote=引用 15 楼 mymixing 的回复:]

引用 14 楼 beefcattlexiaoyang 的回复:
我想问问这个如何交互的问题。如果是在java中,那么这个我很快就能实现了。


你都说了,这个服务等待接收消息,接收到消息后,窗口关掉,或者隐藏。
这不就交互过程么?
收到指定的消息后处理函数中,显示当时候用ShowWindow(hwnd,SW_SHOW);
隐藏的时候用ShowWindow(hwnd,SW_HIDE)……
[/Quote]

是代码中可以如何表示,不是说让他显示,让他隐藏啦.
大_爱 2011-12-05
  • 打赏
  • 举报
回复
[Quote=引用 15 楼 mymixing 的回复:]

引用 14 楼 beefcattlexiaoyang 的回复:
我想问问这个如何交互的问题。如果是在java中,那么这个我很快就能实现了。


你都说了,这个服务等待接收消息,接收到消息后,窗口关掉,或者隐藏。
这不就交互过程么?
收到指定的消息后处理函数中,显示当时候用ShowWindow(hwnd,SW_SHOW);
隐藏的时候用ShowWindow(hwnd,SW_HIDE)……
[/Quote]

这个能实现么?
Enter空格 2011-12-05
  • 打赏
  • 举报
回复
[Quote=引用 14 楼 beefcattlexiaoyang 的回复:]
我想问问这个如何交互的问题。如果是在java中,那么这个我很快就能实现了。
[/Quote]

你都说了,这个服务等待接收消息,接收到消息后,窗口关掉,或者隐藏。
这不就交互过程么?
收到指定的消息后处理函数中,显示当时候用ShowWindow(hwnd,SW_SHOW);
隐藏的时候用ShowWindow(hwnd,SW_HIDE);
大_爱 2011-12-05
  • 打赏
  • 举报
回复
[Quote=引用 11 楼 mymixing 的回复:]

是我没理解什么意思么?
不就是ShowWindow()么?
[/Quote]

我想问问这个如何交互的问题。如果是在java中,那么这个我很快就能实现了。
大_爱 2011-12-05
  • 打赏
  • 举报
回复
[Quote=引用 12 楼 zhao4zhong1 的回复:]

主窗口隐藏不就完了?
[/Quote]

windows的服务可以调用这个窗口么,这个窗口只是显示一些内容,并不需要交互什么。
赵4老师 2011-12-05
  • 打赏
  • 举报
回复
主窗口隐藏不就完了?
Enter空格 2011-12-05
  • 打赏
  • 举报
回复
是我没理解什么意思么?
不就是ShowWindow()么?
大_爱 2011-12-05
  • 打赏
  • 举报
回复
[Quote=引用 9 楼 morrist1987 的回复:]

程序和服务分离。通过内存共享或者进程间通信应该可以解决你这个问题吧。
[/Quote]

这个不是很明白哟,如何共享啦?:
morrist1987 2011-12-05
  • 打赏
  • 举报
回复
程序和服务分离。通过内存共享或者进程间通信应该可以解决你这个问题吧。
大_爱 2011-12-05
  • 打赏
  • 举报
回复
[Quote=引用 7 楼 bobye1230 的回复:]

病毒??不想让用户关掉
[/Quote]

不是病毒啦!我还没到那个级别的。

65,198

社区成员

发帖
与我相关
我的任务
社区描述
C++ 语言相关问题讨论,技术干货分享,前沿动态等
c++ 技术论坛(原bbs)
社区管理员
  • C++ 语言社区
  • encoderlee
  • paschen
加入社区
  • 近7日
  • 近30日
  • 至今
社区公告
  1. 请不要发布与C++技术无关的贴子
  2. 请不要发布与技术无关的招聘、广告的帖子
  3. 请尽可能的描述清楚你的问题,如果涉及到代码请尽可能的格式化一下

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