PC Review


Reply
Thread Tools Rate Thread

Accessing the underlying OLE data

 
 
abhimanyu
Guest
Posts: n/a
 
      28th Feb 2007
I am creating an AddIn for Excel 2002+ using C# 2005.
I can access the OLEObject within Excel using interop but I dont know
how can I access the data inside it ("Native"). I tried using
OLEObject::Copy() and then using OleOpenClipboard() to get
IDataObject
pointer and it worked. But I don;t want to use clipboard during this
operation

this is what I did :

///////////////////////////////////////////////////////////////////////////*///////////////////////////////////////////////////////////////////////////*/////////////
Guid guidDataObject = new Guid("0000010E-0000-0000-
C000-000000000046"); // Guid for IDataObject
IntPtr pUnknown = Marshal.GetIUnknownForObject(oleObject);

IntPtr pDataObject = IntPtr.Zero;
int hr = Marshal.QueryInterface(pUnknown, ref guidDataObject, out
pDataObject);
///////////////////////////////////////////////////////////////////////////*///////////////////////////////////////////////////////////////////////////*/////////////

But the HRESULT says "Specified cast is not valid"
I also tried using OleRun() before QueryInterface(...), but it didnt
work.


thanks

 
Reply With Quote
 
 
 
Reply

Thread Tools
Rate This Thread
Rate This Thread:

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are Off


Similar Threads
Thread Thread Starter Forum Replies Last Post
reflect changes in data bound control when underlying data tablechanges Ashutosh Microsoft C# .NET 4 7th Nov 2008 09:14 AM
reflect changes in data bound control when underlying data tablechanges Ashutosh Microsoft Dot NET Framework 0 5th Nov 2008 06:55 AM
Accessing the text of a form command button from underlying macro Chrisso Microsoft Excel Programming 6 15th Sep 2007 03:02 PM
accessing URLs outside firewall with WebClient? error: The underlying connection was closed Mad Scientist Jr Microsoft ASP .NET 1 8th Dec 2006 12:25 AM
separated from its underlying RCW when accessing a chat frame. Andla Rand Microsoft C# .NET 2 14th Feb 2004 08:00 PM


Features
 

Advertising
 

Newsgroups
 


All times are GMT +1. The time now is 07:48 PM.