惯性聚合 高效追踪和阅读你感兴趣的博客、新闻、科技资讯
阅读原文 在惯性聚合中打开

推荐订阅源

The Register - Security
The Register - Security
Cisco Talos Blog
Cisco Talos Blog
P
Proofpoint News Feed
Vercel News
Vercel News
Microsoft Security Blog
Microsoft Security Blog
GbyAI
GbyAI
C
Check Point Blog
Cyber Security Advisories - MS-ISAC
Cyber Security Advisories - MS-ISAC
Y
Y Combinator Blog
V
Visual Studio Blog
H
Help Net Security
H
Hackread – Cybersecurity News, Data Breaches, AI and More
Stack Overflow Blog
Stack Overflow Blog
The Cloudflare Blog
The Last Watchdog
The Last Watchdog
博客园 - 司徒正美
freeCodeCamp Programming Tutorials: Python, JavaScript, Git & More
Apple Machine Learning Research
Apple Machine Learning Research
SecWiki News
SecWiki News
博客园 - 叶小钗
V
Vulnerabilities – Threatpost
cs.CL updates on arXiv.org
cs.CL updates on arXiv.org
IT之家
IT之家
cs.AI updates on arXiv.org
cs.AI updates on arXiv.org
罗磊的独立博客
C
CXSECURITY Database RSS Feed - CXSecurity.com
V2EX - 技术
V2EX - 技术
T
The Blog of Author Tim Ferriss
小众软件
小众软件
The GitHub Blog
The GitHub Blog
钛媒体:引领未来商业与生活新知
钛媒体:引领未来商业与生活新知
D
DataBreaches.Net
L
LINUX DO - 热门话题
大猫的无限游戏
大猫的无限游戏
V
V2EX
Latest news
Latest news
NISL@THU
NISL@THU
Last Week in AI
Last Week in AI
Spread Privacy
Spread Privacy
云风的 BLOG
云风的 BLOG
S
Secure Thoughts
W
WeLiveSecurity
S
Security @ Cisco Blogs
C
CERT Recently Published Vulnerability Notes
AWS News Blog
AWS News Blog
I
InfoQ
A
About on SuperTechFans
K
Kaspersky official blog
Security Latest
Security Latest
P
Proofpoint News Feed

博客园 - Allen Zhang

oracle数据库的字符集更改 用SQL server导出到oracle,查询时提示“表或视图不存在ORA-00942”错误 由于无法创建应用程序域,因此未能执行请求。错误: 0x80070002 系统找不到指定的文件 导出Excel时发生COM组件失败的解决方案 jquery下一个空格带来的血案 C++数据类型与C#对应关系 c#调用WINDWOS API时,非常有用(转) 水晶报表的交叉表中增加超级链接 JavaScript和ExtJS的继承 Ext.extend Ext.applyIf (转) SQL SERVER 2000数据库置疑处理 ScriptX控件部分参数说明 - Allen Zhang - 博客园 给ASP.net程序配置代理服务器 使用jQuery的validation后,无法引发asp.net按钮的事件处理程序 使用代码模拟请求和提交网页数据 - Allen Zhang - 博客园 C#调用Delphi写的动态链接库 - Allen Zhang - 博客园 近期一些超值文章及工具收集 用STSADM工具全自动备份sharepoint站点 创建MOSS网站下的新闻 SQL Server Reporting Services与MOSS集成资料汇总 修复MOSS2007备份还原后搜索服务出现的问题(续) - Allen Zhang - 博客园
Web应用系统中关闭Excel进程
Allen Zhang · 2011-10-31 · via 博客园 - Allen Zhang

在Web系统中调用Excel操作后,关闭Excel进程是个老问题

试了几种方法都无效,最后还是得采用kill进程的方案,不过跟强行kill所有Excel进程相比,下面的方案更为合理。

程序只kill当前对象相应的Excel进程。

[DllImport("user32.dll", SetLastError = true)]
static extern int GetWindowThreadProcessId(IntPtr hWnd, out int lpdwProcessId);

int lpdwProcessId;
GetWindowThreadProcessId(new IntPtr(app.Hwnd), out lpdwProcessId);
System.Diagnostics.Process.GetProcessById(lpdwProcessId).Kill();

特此备忘,省得以后碰到同类问题,又是一通google。