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

推荐订阅源

Forbes - Security
Forbes - Security
The Hacker News
The Hacker News
V
Vulnerabilities – Threatpost
C
CXSECURITY Database RSS Feed - CXSecurity.com
Spread Privacy
Spread Privacy
P
Proofpoint News Feed
AWS News Blog
AWS News Blog
S
Securelist
S
Security @ Cisco Blogs
Cloudbric
Cloudbric
T
Troy Hunt's Blog
SecWiki News
SecWiki News
cs.CL updates on arXiv.org
cs.CL updates on arXiv.org
K
KPMG report finds enterprise disconnect between AI and its ROI | CIO
Security Latest
Security Latest
C
Cyber Attacks, Cyber Crime and Cyber Security
AI
AI
Threat Intelligence Blog | Flashpoint
Threat Intelligence Blog | Flashpoint
Stack Overflow Blog
Stack Overflow Blog
I
Intezer
I
InfoQ
Attack and Defense Labs
Attack and Defense Labs
H
Hackread – Cybersecurity News, Data Breaches, AI and More
Recent Commits to openclaw:main
Recent Commits to openclaw:main
T
The Exploit Database - CXSecurity.com
Cyber Security Advisories - MS-ISAC
Cyber Security Advisories - MS-ISAC
N
News | PayPal Newsroom
云风的 BLOG
云风的 BLOG
S
Secure Thoughts
T
The Blog of Author Tim Ferriss
Martin Fowler
Martin Fowler
L
LINUX DO - 最新话题
Exploit-DB.com RSS Feed
Exploit-DB.com RSS Feed
D
Darknet – Hacking Tools, Hacker News & Cyber Security
A
About on SuperTechFans
Hacker News - Newest:
Hacker News - Newest: "LLM"
TaoSecurity Blog
TaoSecurity Blog
www.infosecurity-magazine.com
www.infosecurity-magazine.com
Webroot Blog
Webroot Blog
L
LangChain Blog
MyScale Blog
MyScale Blog
Recent Announcements
Recent Announcements
P
Privacy & Cybersecurity Law Blog
Vercel News
Vercel News
Engineering at Meta
Engineering at Meta
C
Cybersecurity and Infrastructure Security Agency CISA
Y
Y Combinator Blog
L
Lohrmann on Cybersecurity
B
Blog RSS Feed
The Last Watchdog
The Last Watchdog

博客园 - 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。