求教Document.Activate这句话是什么意思???

不懂装懂 2012-02-06 02:54:03
这是我上一个帖子,里面说word打印时,就一直停在那里

其中源代码里面有一句doc.Activate();当我注掉这句话之后word打印恢复正常了。。。o(╯□╰)o


public void PrintWord(string path)
{
Object nothing = Missing.Value;
Object falseValue = false;
Object trueValue = true;
Object pages = 1;
Object paths = path;
MSWord.ApplicationClass app = new Microsoft.Office.Interop.Word.ApplicationClass();
app.Visible = false;
MSWord.Document doc = app.Documents.Open(ref paths, ref nothing, ref nothing, ref nothing, ref nothing, ref nothing, ref nothing, ref nothing, ref nothing, ref nothing, ref nothing, ref trueValue, ref nothing, ref nothing, ref nothing, ref nothing);
// doc.Activate();<-------------------------------------这里
doc.PrintOut(ref trueValue, ref nothing, ref nothing, ref nothing, ref nothing, ref nothing, ref nothing, ref pages, ref nothing, ref nothing, ref falseValue, ref nothing, ref nothing, ref nothing, ref nothing, ref nothing, ref nothing, ref nothing);
doc.Close(ref falseValue, ref nothing, ref nothing);
app.Quit(ref nothing, ref nothing, ref nothing);
GC.Collect();
}

看了msdn的Document.Activate 方法,备注里面只有调用 Activate 时,就好像用户单击该项一样,但不发生 Click 事件。这一句话

求教这句话为什么会导致我打印时打印队列停止,无法打印??????????????
...全文
138 6 打赏 收藏 转发到动态 举报
写回复
用AI写文章
6 条回复
切换为时间正序
请发表友善的回复…
发表回复
不懂装懂 2012-02-07
  • 打赏
  • 举报
回复
联系csdn的GLYmm多和她聊天逛街就好了。。。另外看我问题回答下先[Quote=引用 5 楼 happy09li 的回复:]
LZ的结贴率是怎么弄的?
[/Quote]
熙风 2012-02-07
  • 打赏
  • 举报
回复
LZ的结贴率是怎么弄的?
不懂装懂 2012-02-07
  • 打赏
  • 举报
回复
回答问题前请先看我问的什么[Quote=引用 3 楼 sinitek123 的回复:]
为当前活动项,类似tab换活动标签了
[/Quote]
sinitek123 2012-02-07
  • 打赏
  • 举报
回复
为当前活动项,类似tab换活动标签了
不懂装懂 2012-02-07
  • 打赏
  • 举报
回复
problc 2012-02-06
  • 打赏
  • 举报
回复
难道doc.Activate();的执行是阻塞的?

110,538

社区成员

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

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

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