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

又来请教问题了,求问题解决思路。。
程序需要开机启动,显示一个消息框,或者窗体,这个程序并不会结束, 用户也关不掉的(这部分我实现了),然后这个程序有一个网络的服务,这个服务等待接收消息,接收到消息后,窗口关掉,或者隐藏,但是这个应用程序后台的网络部分还要继续运行的,等到下一个消息过来的时候,再弹出这个消息框或者窗体。

不知道说明白了没有。先谢谢大家了。

------解决方案--------------------
应为你没说明白啊 
------解决方案--------------------
主线程显示窗口不关闭。
在程序中启动一个后台线程,等待接收消息,如果关闭,则隐藏窗口,哪果启动则显示窗口。

------解决方案--------------------
病毒??不想让用户关掉 

------解决方案--------------------
程序和服务分离。通过内存共享或者进程间通信应该可以解决你这个问题吧。
------解决方案--------------------
是我没理解什么意思么?
不就是ShowWindow()么?

------解决方案--------------------
主窗口隐藏不就完了?
------解决方案--------------------
引用:
我想问问这个如何交互的问题。如果是在java中,那么这个我很快就能实现了。


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

------解决方案--------------------
服务程序通常默认禁止交互也就是禁止显示窗口。
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后需要重启系统才生效