473,654 Members | 3,096 Online
Bytes | Software Development & Data Engineering Community
+ Post

Home Posts Topics Members FAQ

Am I the only one having problems due to lack of OLE support?


It seems that all of the interfaces, such as IDataObject etc. from basic OLE
are no longer supported in .NET, although they are implemented
(differently). I have an OLE object type and am having to make lots of
detours and compromises (and, to be frank, hacks) to get my .NET code to
work with it. For example, because I can't get an IDataObject interface
from my basic OLE object (even though it implements IDataObject), I'm having
to write out temporary files and mess around with a hacked automation
interface instead.

It would have been better, in my opinion, for .NET interop to have supported
vanilla OLE interfaces as well as purely automation interfaces. There are
many instances where one wishes to use OLE but doesn't have a convienient
type library or automation interface.

Rant over.

(p.s. When we have time, we are going to implement a proper Automation
interface for the objects I'm trying to use, but they already work fine
using basic OLE!).
Nov 20 '05 #1
3 2122
Robin,
How are you using IDataObject, that the built-in .NET support for the COM
version of IDataObject is not working for you?

If you using the System.Windows. Forms.Clipboard or Windows Forms Drag &
Drop, .NET will translate the COM IDataObject into
System.Windows. Forms.IDataObje ct, I suspect via a Proxy pattern internal to
the System.Windows. Forms assembly.
It would have been better, in my opinion, for .NET interop to have supported vanilla OLE interfaces as well as purely automation interfaces. I suspect you are missing something, as the entire point of .NET interop is
to support all vanilla OLE interfaces, scientifically better then VB6 can.

I have used .NET interop on both IStorage & Extended MAPI, both vanilla OLE
interfaces.

Granted you may have to sit down and write the interface & helper functions
yourself. I find using Adam Nathan's book ".NET and COM - The Complete
Interoperabilit y Guide" from SAMS press to be invaluable in this regard.

Hope this helps
Jay

"Robin Tucker" <id************ *************@r eallyidont.com> wrote in
message news:bn******** ***********@new s.demon.co.uk.. .
It seems that all of the interfaces, such as IDataObject etc. from basic OLE are no longer supported in .NET, although they are implemented
(differently). I have an OLE object type and am having to make lots of
detours and compromises (and, to be frank, hacks) to get my .NET code to
work with it. For example, because I can't get an IDataObject interface
from my basic OLE object (even though it implements IDataObject), I'm having to write out temporary files and mess around with a hacked automation
interface instead.

It would have been better, in my opinion, for .NET interop to have supported vanilla OLE interfaces as well as purely automation interfaces. There are
many instances where one wishes to use OLE but doesn't have a convienient
type library or automation interface.

Rant over.

(p.s. When we have time, we are going to implement a proper Automation
interface for the objects I'm trying to use, but they already work fine
using basic OLE!).

Nov 20 '05 #2
Thanks for the reply Jay.

Well, I've got an object supporting IDataObject, but sure as hell I cannot
get an interface object for it from VB.

I load the object like this:

Dim theObject As Object = GetObject ( "helloworld.tgw " )

The object loads - its container application is running - now without a type
library I'm somewhat screwed. I know it supports IDataObject, I know it
embeds with Office documents (and anything else supporting OLE), but how the
hell do I get an IDataObject interface pointer? I've tried various methods
including QueryInterface etc. - but I always get exceptions. I don't have a
type library (well I do now, but its a hack and doesn't provide me with
features such as IDataObject would - for example, I've written a DLL to pass
me in HGLOBALS etc, which seems to work, but is very inefficient.

"Jay B. Harlow [MVP - Outlook]" <Ja********@ema il.msn.com> wrote in message
news:Oq******** ******@tk2msftn gp13.phx.gbl...
Robin,
How are you using IDataObject, that the built-in .NET support for the COM
version of IDataObject is not working for you?

If you using the System.Windows. Forms.Clipboard or Windows Forms Drag &
Drop, .NET will translate the COM IDataObject into
System.Windows. Forms.IDataObje ct, I suspect via a Proxy pattern internal to the System.Windows. Forms assembly.
It would have been better, in my opinion, for .NET interop to have supported
vanilla OLE interfaces as well as purely automation interfaces.

I suspect you are missing something, as the entire point of .NET interop

is to support all vanilla OLE interfaces, scientifically better then VB6 can.

I have used .NET interop on both IStorage & Extended MAPI, both vanilla OLE interfaces.

Granted you may have to sit down and write the interface & helper functions yourself. I find using Adam Nathan's book ".NET and COM - The Complete
Interoperabilit y Guide" from SAMS press to be invaluable in this regard.

Hope this helps
Jay

"Robin Tucker" <id************ *************@r eallyidont.com> wrote in
message news:bn******** ***********@new s.demon.co.uk.. .

It seems that all of the interfaces, such as IDataObject etc. from basic

OLE
are no longer supported in .NET, although they are implemented
(differently). I have an OLE object type and am having to make lots of
detours and compromises (and, to be frank, hacks) to get my .NET code to
work with it. For example, because I can't get an IDataObject interface
from my basic OLE object (even though it implements IDataObject), I'm

having
to write out temporary files and mess around with a hacked automation
interface instead.

It would have been better, in my opinion, for .NET interop to have

supported
vanilla OLE interfaces as well as purely automation interfaces. There are many instances where one wishes to use OLE but doesn't have a convienient type library or automation interface.

Rant over.

(p.s. When we have time, we are going to implement a proper Automation
interface for the objects I'm trying to use, but they already work fine
using basic OLE!).


Nov 20 '05 #3
Robin,
Sorry for the delay, I was hoping to try and find time to come up with a
more complete example...

You do know that you can define the COM IDataObject interface directly in
VB.NET instead of using type library?

With something like (just a start):

Option Strict On
Option Explicit On

Imports System.Runtime. InteropServices

< _
ComImport(), _
Guid("00000000-0000-0000-0000-000000000000"), _
InterfaceType(C omInterfaceType .InterfaceIsIUn known) _
_ Public Interface IDataObject

Sub GetData( _
<[In]()> ByRef ciidExclude As FORMATETC, _
<[Out]()> ByRef pmedium As STGMEDIUM)

...

End Interface

Because it has the InterfaceType attribute, .NET will treat it as an IUnkown
interface, the Sub will automatically convert HRESULT into exceptions. You
will need to define FORMATETC & STGMEDIUM structures. Within the
System.Runtime. InteropServices the MarshalAs attribute is invaluable as it
indicates what type to marshal a field as (such as strings). Also the
Marshal class is invaluable as it has functions to convert HGLOBAL handles
into .NET objects.

Once you have the above interface fully defined, you can simply assign (with
DirectCast) theObject to a variable of the IDataObject type.

Don't forgot to supply the actual IDataObject quid in the above Guid
attribute.

The In & Out before the two parameters above tell the marshaller that the
structures are to be treated as input & output respectively, rather than as
both ways...

As I stated in my earlier email Adam's book is invaluable for implementing
the above.
I find using Adam Nathan's book ".NET and COM - The Complete
Interoperabilit y Guide" from SAMS press to be invaluable in this regard.


Hope this helps
Jay

"Robin Tucker" <id************ *************@r eallyidont.com> wrote in
message news:bn******** ***********@new s.demon.co.uk.. . Thanks for the reply Jay.

Well, I've got an object supporting IDataObject, but sure as hell I cannot
get an interface object for it from VB.

I load the object like this:

Dim theObject As Object = GetObject ( "helloworld.tgw " )

The object loads - its container application is running - now without a type library I'm somewhat screwed. I know it supports IDataObject, I know it
embeds with Office documents (and anything else supporting OLE), but how the hell do I get an IDataObject interface pointer? I've tried various methods
including QueryInterface etc. - but I always get exceptions. I don't have a type library (well I do now, but its a hack and doesn't provide me with
features such as IDataObject would - for example, I've written a DLL to pass me in HGLOBALS etc, which seems to work, but is very inefficient.

<<snip>>
Nov 20 '05 #4

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

9
2955
by: Francesco Moi | last post by:
Hello. I'm trying to build a RSS feed for my website. It starts: ----------------//--------------------- <?xml version="1.0" encoding="ISO-8859-1"?> <!DOCTYPE rss PUBLIC "-//Netscape Communications//DTD RSS 0.91//EN" "http://my.netscape.com/publish/formats/rss-0.91.dtd"> <rss version="0.91"> ----------------//----------------------
1
354
by: malcolm | last post by:
Hello, We have a small team building a project that involves some 30 or so c# assembly dlls. It is a client server application with 1 exe as the starting point. The dlls and exe are sharing an assemblyinfo file that has a strong name and version assiciated with it. We are having problems in the way we have been developing. We have made two attempts at this. Attempt 1) In our first attempt, we basically had 1 folder that
385
17140
by: Xah Lee | last post by:
Jargons of Info Tech industry (A Love of Jargons) Xah Lee, 2002 Feb People in the computing field like to spur the use of spurious jargons. The less educated they are, the more they like extraneous jargons, such as in the Unix & Perl community. Unlike mathematicians, where in mathematics there are no fewer jargons but each and every one are
4
2745
by: don | last post by:
I have two existing interfaces having methods with same names. Now I have to implement both intrfaces in one class. Is there any way I could implement methods with same names in both interfaces without getting errors from the compiler?
4
3178
by: Rob Schieber | last post by:
I am pretty frustrated with Microsoft and their lack of support with the Sproxy.exe tool included with VS.Net. Im using VS.Net EA and I wanted to create a C++ webreference to the Amazon.com web service: http://webservices.amazon.com/AWSECommerceService/AWSECommerceService.wsdl Now Sproxy.exe blows errors left and right when you try to add this. It seems that Sproxy doesn't now how to interpret attributes, lists, annotations etc... ...
0
935
by: batista | last post by:
Hello, I have a web service that i created in IIS 5.1,on windows xp. it has a method "stopservice" in which im stopping the aspnet_wp.exe,to clean all resources.And im using a boolean set to true so that after that if anyone access the service, it will give an error that service needs to start again.I also have a "startservice" method in which all necessary initialization occurs. The boolean is initialized to false in global.ascx file...
12
2692
by: Edward Diener | last post by:
Given value class X { public: // Not allowed: X():i(100000),s(10000) { } // Allowed void InitializeDefaults() { i = 100000; s = 10000; } private: int i;
10
4776
by: Henrik Dahl | last post by:
Hello! I have an xml schema which has a date typed attribute. I have used xsd.exe to create a class library for XmlSerializer. The result of XmlSerializer.Serialize(...) should be passed as the value for the parameter of an SqlCommand for inserting the xml document in a column of a table where the column is typed to be of the same xml schema. This all sounds simple, but SQL Server REQUIRES the timezone to be specified for date values....
12
2148
by: Amer Neely | last post by:
I'm trying to nail down a 3-column layout but there is a slight discrepancy in how IE 6 and Seamonkey renders a border. View my attempt at http://www.softouch.on.ca/scratch/3-columns.html The problem is that SM does not seem to render the border in the outer DIV correctly. IE displays 'what I want' but then I'm not sure if that's because I'm doing something right, or found an artifact that works. Is SM broken regarding borders, or am...
0
8290
by: Hystou | last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can effortlessly switch the default language on Windows 10 without reinstalling. I'll walk you through it. First, let's disable language synchronization. With a Microsoft account, language settings sync across devices. To prevent any complications,...
0
8815
Oralloy
by: Oralloy | last post by:
Hello folks, I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>". The problem is that using the GNU compilers, it seems that the internal comparison operator "<=>" tries to promote arguments from unsigned to signed. This is as boiled down as I can make it. Here is my compilation command: g++-12 -std=c++20 -Wnarrowing bit_field.cpp Here is the code in...
0
8708
jinu1996
by: jinu1996 | last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven tapestry of website design and digital marketing. It's not merely about having a website; it's about crafting an immersive digital experience that captivates audiences and drives business growth. The Art of Business Website Design Your website is...
1
8489
by: Hystou | last post by:
Overview: Windows 11 and 10 have less user interface control over operating system update behaviour than previous versions of Windows. In Windows 11 and 10, there is no way to turn off the Windows Update option using the Control Panel or Settings app; it automatically checks for updates and installs any it finds, whether you like it or not. For most users, this new feature is actually very convenient. If you want to control the update process,...
0
8594
tracyyun
by: tracyyun | last post by:
Dear forum friends, With the development of smart home technology, a variety of wireless communication protocols have appeared on the market, such as Zigbee, Z-Wave, Wi-Fi, Bluetooth, etc. Each protocol has its own unique characteristics and advantages, but as a user who is planning to build a smart home system, I am a bit confused by the choice of these technologies. I'm particularly interested in Zigbee because I've heard it does some...
0
7307
agi2029
by: agi2029 | last post by:
Let's talk about the concept of autonomous AI software engineers and no-code agents. These AIs are designed to manage the entire lifecycle of a software development project—planning, coding, testing, and deployment—without human intervention. Imagine an AI that can take a project description, break it down, write the code, debug it, and then launch it, all on its own.... Now, this would greatly impact the work of software developers. The idea...
0
5622
by: conductexam | last post by:
I have .net C# application in which I am extracting data from word file and save it in database particularly. To store word all data as it is I am converting the whole word file firstly in HTML and then checking html paragraph one by one. At the time of converting from word file to html my equations which are in the word document file was convert into image. Globals.ThisAddIn.Application.ActiveDocument.Select();...
1
2716
by: 6302768590 | last post by:
Hai team i want code for transfer the data from one system to another through IP address by using C# our system has to for every 5mins then we have to update the data what the data is updated we have to send another system
2
1596
bsmnconsultancy
by: bsmnconsultancy | last post by:
In today's digital era, a well-designed website is crucial for businesses looking to succeed. Whether you're a small business owner or a large corporation in Toronto, having a strong online presence can significantly impact your brand's success. BSMN Consultancy, a leader in Website Development in Toronto offers valuable insights into creating effective websites that not only look great but also perform exceptionally well. In this comprehensive...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.