Hi Tom,
If a clipboard application works well with your word, or just the addin has
problem.
Here is my sample code. You may have a try to see if the problem persists.
Word.Application wdApp = new Word.ApplicationClass();
private void button1_Click(object sender, System.EventArgs e)
{
IDataObject iData = Clipboard.GetDataObject();
string str=string.Empty;;
if(iData.GetDataPresent(DataFormats.Text))
{
str = (string)iData.GetData(DataFormats.Text);
}
wdApp.ActiveDocument.Content.Text= str+"world";
}
private void button2_Click(object sender, System.EventArgs e)
{
wdApp.Visible=true;
object o = Missing.Value;
wdApp.Documents.Add(ref o,ref o,ref o,ref o);
wdApp.ActiveDocument.Content.Text="Hello";
string str = wdApp.ActiveDocument.Content.Text;
Clipboard.SetDataObject(str,true);
}
private void button3_Click(object sender, System.EventArgs e)
{
object o = Missing.Value;
wdApp.ActiveDocument.Saved=true;
wdApp.Quit(ref o,ref o,ref o);
wdApp=null;
}
Did I misunderstand your meaning?
If possible, I hope you can post some code, I just need the code that is
necessary for me to reproduce the problem.
I look forward to hearing from you.
Regards,
Peter Huang
Microsoft Online Partner Support
Get Secure!
www.microsoft.com/security
This posting is provided "as is" with no warranties and confers no rights.
--------------------
Subject: Re: word and the clipboard viewer chain
Date: Tue, 16 Sep 2003 19:04:16 +1000
Lines: 87
X-Priority: 3
X-MSMail-Priority: Normal
X-Newsreader: Microsoft Outlook Express 6.00.2800.1158
X-MimeOLE: Produced By Microsoft MimeOLE V6.00.2800.1165
Message-ID: <OdEP#
[email protected]>
Newsgroups: microsoft.public.office.developer.com.add_ins
NNTP-Posting-Host: adsl-8-78.swiftdsl.com.au 218.214.8.78
Path:
cpmsftngxa07.phx.gbl!cpmsftngxa10.phx.gbl!TK2MSFTNGXA05.phx.gbl!TK2MSFTNGP08
phx.gbl!TK2MSFTNGP09.phx.gbl
Xref: cpmsftngxa07.phx.gbl microsoft.public.office.developer.com.add_ins:4509
X-Tomcat-NG: microsoft.public.office.developer.com.add_ins
We've checked all the usual stuff. Our viewer works perfectly except with
Word (we're testing on Word 2000). During a paste, Word seems to be causing
a clipboard change event and is then unable to process the data request
messages from the clipboard system while it finishes off its paste process
(at least that's our best guess). It crashes instead (consistently).
We have come up with a workaround, however the workaround doesn't ensure
that we get opportunity to filter all data before it reaches the Office
clipboard manager. We need to be able to "approve" data copied to the
clipboard. Is there a way to ensure that the Office clipboard only contains
specific data that our monitor has approved?
Regards,
Tom
Peter Huang said:
Hi Tom,
Did the problem consistent?
Did the clipboard viewer program works alone?[not as an addin]
Try to copy and paste simple data format. e.g. text to see if the problem
persists.
I look forward to hearing from you.
Regards,
Peter Huang
Microsoft Online Partner Support
Get Secure!
www.microsoft.com/security
This posting is provided "as is" with no warranties and confers no rights.
--------------------
From: "Tom" <
[email protected]>
Subject: word and the clipboard viewer chain
Date: Mon, 15 Sep 2003 18:14:58 +1000
Lines: 25
X-Priority: 3
X-MSMail-Priority: Normal
X-Newsreader: Microsoft Outlook Express 6.00.2800.1158
X-MimeOLE: Produced By Microsoft MimeOLE V6.00.2800.1165
Message-ID: <
[email protected]>
Newsgroups: microsoft.public.office.developer.com.add_ins
NNTP-Posting-Host: adsl-8-78.swiftdsl.com.au 218.214.8.78
Path:
cpmsftngxa07.phx.gbl!cpmsftngxa10.phx.gbl!TK2MSFTNGXA05.phx.gbl!TK2MSFTNGP0
8
phx.gbl!TK2MSFTNGP09.phx.gbl
Xref: cpmsftngxa07.phx.gbl
microsoft.public.office.developer.com.add_ins:4506
X-Tomcat-NG: microsoft.public.office.developer.com.add_ins
Hi,
We are attempting to write a clipboard viewer program (in C#) that will
store the raw data associated with all clipboard formats whenever a
clipboard change event occurs. This project forms part of a Word add-in
that
we are constructing. Unfortunately Word seems to spontaneously crash during
paste operations (not copy/cut) while our viewer is running. The paste
generates a clipboard change event, which leads to us pulling all the
clipboard data (successfully) and to the aforementioned crash.
The crash occurs after all clipboard viewers in the chain have receive
d
and
processed the change event.
Has anyone had any experience with this behaviour? We are assuming that
accessing one or more of the clipboard formats is causing Word to receive
messages from the clipboard system asking for data. Could this be a
bug
in
Word?
We have tried a few freely available clipboard viewer/management programs
and experienced similar problems.
Regards,
Tom