word and the clipboard viewer chain

T

Tom

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 received 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
 
P

Peter Huang [MSFT]

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.

--------------------
 
T

Tom

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!TK2MSFTNGP08
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 received 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
 
P

Peter Huang [MSFT]

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 received 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
 
T

Tom

Hi Peter,

Unfortunately the code in question is copyrighted material and can't be
posted.

We have two components in our system, one of which is a Word add-in, and one
of which is a separate program that registers itself in the Windows
clipboard viewer chain. We had a problem with Word crashing when we accessed
the global Windows clipboard in the viewer application, while Word was
carrying out a Paste operation. When Word performs a paste it triggers a
"clipboard change" event that propagates down the Windows clipboard viewer
chain - hence causing our application to read the new clipboard contents.

What we need is a way to directly manipulate the Office clipboard manager
(the one that can hold up to 12 items). Do you know of a way to do this?

Regards,
Tom



Peter Huang said:
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
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top