Google Groups no longer supports new Usenet posts or subscriptions. Historical content remains viewable.
Dismiss

adding custom verb to OLE object that changes its appearance

10 views
Skip to first unread message

Przemyslaw Dzierzak

unread,
May 17, 2007, 11:18:00 AM5/17/07
to
I have posted the question with the same subject and similar content to
microsoft.public.vc.mfcole . There I was said that my problem appears to be a
bug in Excel. I was suggested that I could post the mail here also. I got no
response from MS since then and when I try to contact Charles Wang (who I
mailed with) the mail is undeliverible. Could anybody help me? That's the
problem:

I've added new OLE verb to Scribble App, named it 'Add Random Triangle'. The
problem is that I don't know how to make Excel refresh scribble object in all
cases. The verb works fine with Word and PowerPoint, but it doesn't work in
Excel in the following scenario:

1. Add a Scribble object to new Excel spreadsheet, draw a line inside.
2. save & close xls file.
3. Open saved file.
4. right-click on it and run 'Add Random Triangle' verb
5. NOTHING HAPPENS
6. if you open the Scribble object you will find there is a triangle added
7. close Scribble object edition, and add another random triangle - now it
shows up.

So my question is how should I correctly update the object when it changes
as a result on nonstandard verb?


Changes I made to scribble:

1. add new verb - scribble.cpp, InitInstance method, line 143:
VERIFY( CRegKey::SetValue( HKEY_CLASSES_ROOT,
"CLSID\\{7559FD90-9B93-11CE-B0F0-00AA006C28B3}\\verb\\2", "Add Random
&Triangle,0,2" ) == ERROR_SUCCESS );

2. add new verb implementation - overriden CScribbleItem::OnDoVerb:

#define SIZE 200

void CScribbleItem::OnDoVerb(LONG iVerb)
{
// "Add Random Triangle" verb implementation
if( iVerb == 2 )
{
CScribbleDoc *pDoc = GetDocument();
srand( (unsigned int)time(NULL) );
CStroke *pStroke = pDoc->NewStroke();
CPoint p1( (int)( rand()*(double)SIZE/RAND_MAX),
-(int)(rand()*(double)SIZE/RAND_MAX) );
pStroke->m_pointArray.Add( p1 );
pStroke->m_pointArray.Add( CPoint( (int)(rand()*(double)SIZE/RAND_MAX),
-(int)(rand()*(double)SIZE/RAND_MAX) ) );
pStroke->m_pointArray.Add( CPoint( (int)(rand()*(double)SIZE/RAND_MAX),
-(int)(rand()*(double)SIZE/RAND_MAX) ) );
pStroke->m_pointArray.Add( p1 );
pStroke->FinishStroke();

// question: How should I save changes so that Excel (and all other OLE
clients) both save & redraw the object (and close it)?
pDoc->SetModifiedFlag();
pDoc->NotifyChanged();
pDoc->SaveEmbedding();
pDoc->NotifyClosed();
}
else
COleServerItem::OnDoVerb(iVerb);
}


3. stdafx.h :
#include <atlbase.h> // CRegKey class

Steven Cheng[MSFT]

unread,
May 18, 2007, 5:35:04 AM5/18/07
to
Hi przemekd,

Regarding on this issue, I saw that you've originally discussed with
Charles in a former thread:

http://groups.google.com/group/microsoft.public.vc.mfcole/browse_thread/thre
ad/c1b626ea657fd2fc/5fbd115f19679ccd

actually, Charles has done some local research and repro the behavior.
We've discussed on this together and it is likely a bug of the excel
program, that's why we recommend you post the issue in some excel specific
non-developing newsgroups:

microsoft.public.excel
microsoft.public.excel.123quattro
microsoft.public.excel.charting
microsoft.public.excel.crashesgpfs
microsoft.public.excel.datamap
microsoft.public.excel.interopoledde
microsoft.public.excel.links
microsoft.public.excel.macintosh
microsoft.public.excel.misc
microsoft.public.excel.newusers
microsoft.public.excel.printing
microsoft.public.excel.querydao
microsoft.public.excel.setup
microsoft.public.excel.templates
microsoft.public.excel.worksheet.functions
microsoft.public.excel.worksheetfunctions

In addition, since the problem also related to a sdk sample, I think it
would be better to contact CSS for direcctly support as some further
communication channel with product team would be available.

http://msdn.microsoft.com/subscriptions/support/default.aspx

Sincerely,

Steven Cheng

Microsoft MSDN Online Support Lead

This posting is provided "AS IS" with no warranties, and confers no rights.

0 new messages