积极答复者
asp.net findwindow 总是找不到窗口用getlasterror()=1008

问题
-
我用findwindow主要是找到一个在服务器上运行的窗口然后给窗口发送消息完成相应操作。
我用findwindow(null,"窗口标题")总是返回为0,用Marshal.GetLastWin32Error()捕获错误显示为1008,,意思“试图引用不存在的令牌”。我在服务器上用winform程序调用findwindow就成功,无法理解。
要命的是,在本地调试ASP.NET的时候findwindow成功,放到服务器上是才出现上述这个现象。
我这个是在一个web服务里面使用的,不过用的是国产的PHPRPC这个轻量级的WEB服务,主要方便在手机里调用。
看到CSDN上有人说在可以调用的,他给出的源码是web服务的,可惜手机无法使用web服务,所以我也没测他的代码。
望有高手解决,谢谢。
2010年3月26日 15:48
答案
-
服务默认是不和桌面交互的,找不到桌面上的窗口很正常。重写你的桌面程序,使得你的服务可以使用其他方式控制,比如socket、remoting、WCF、命名管道等等
The following is signature, not part of post
Please mark the post answered your question as the answer, and mark other helpful posts as helpful.
Visual C++ MVP- 已建议为答案 Weng Yuli 2010年3月27日 13:38
- 已标记为答案 KeFang Chen 2010年4月1日 4:08
2010年3月26日 17:09版主
全部回复
-
服务默认是不和桌面交互的,找不到桌面上的窗口很正常。重写你的桌面程序,使得你的服务可以使用其他方式控制,比如socket、remoting、WCF、命名管道等等
The following is signature, not part of post
Please mark the post answered your question as the answer, and mark other helpful posts as helpful.
Visual C++ MVP- 已建议为答案 Weng Yuli 2010年3月27日 13:38
- 已标记为答案 KeFang Chen 2010年4月1日 4:08
2010年3月26日 17:09版主