在WebApplication中使用API FindWindow得不到句柄问题

chdan 2003-08-19 10:17:04
[DllImport("User32.dll")]
public static extern Int32 FindWindow(String lpClassName,String lpWindowName);
通过该方法在WebApplication中得到得句柄都是0,但在其它应用中是可以的。
而且我把它封装成COM组件,然后在WebApplication中使用也同样得不到,想不明白,请教各位高手。
谢谢!
...全文
31 6 打赏 收藏 转发到动态 举报
写回复
用AI写文章
6 条回复
切换为时间正序
请发表友善的回复…
发表回复
lyhold 2004-02-02
  • 打赏
  • 举报
回复
[DllImport("User32.dll")]
public static extern Int32 FindWindow(String lpClassName,String lpWindowName);

问题我解决啦。你是试试这个


FindWindow(null,yourwindowname)

一定要null,而不是""
lyhold 2004-01-16
  • 打赏
  • 举报
回复
是的,我以前也没有的到
chdan 2003-08-20
  • 打赏
  • 举报
回复
非常感谢各位的回答。
按saucer的方法试过了,不行。我想这个API跟运行的用户是无关的,估计跟Application的环境相关,能否有一个能直接通过程序(而不是改变系统配置)解决这个问题的途径。
希望各位继续支持!
horsewww 2003-08-20
  • 打赏
  • 举报
回复
WebApplication中的窗口是浏览器解释形成的,不同于一般的WinForm,所以得不到句柄
仅供参考
saucer 2003-08-19
  • 打赏
  • 举报
回复
normally, aspnet_wp.exe is created in a different workstation from the interactive user's workstation

if you insist, go to Control Panel->Administrative Tools->Services, right click on World Wide Web Publishing Service to open its Properties page, go to Log On tab, check "service to interact with Desktop".., restart your web server....
维她奶 2003-08-19
  • 打赏
  • 举报
回复
在winFrom中我就试过,不过在webForm就没有试过了(虽然现在我是做web开发的^^)
帮楼主顶一下。

110,534

社区成员

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

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

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