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!). 3 2112
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.IDataObject, 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
Interoperability Guide" from SAMS press to be invaluable in this regard.
Hope this helps
Jay
"Robin Tucker" <id*************************@reallyidont.com> wrote in
message news:bn*******************@news.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!).
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********@email.msn.com> wrote in message
news:Oq**************@tk2msftngp13.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.IDataObject, 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 Interoperability Guide" from SAMS press to be invaluable in this regard.
Hope this helps Jay
"Robin Tucker" <id*************************@reallyidont.com> wrote in message news:bn*******************@news.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!).
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(ComInterfaceType.InterfaceIsIUnknown ) _ _
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 Interoperability Guide" from SAMS press to be invaluable in this regard.
Hope this helps
Jay
"Robin Tucker" <id*************************@reallyidont.com> wrote in
message news:bn*******************@news.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>> This thread has been closed and replies have been disabled. Please start a new discussion. Similar topics
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...
|
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...
|
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...
|
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...
|
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...
|
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...
|
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;
|
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...
|
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...
|
by: Charles Arthur |
last post by:
How do i turn on java script on a villaon, callus and itel keypad mobile phone
|
by: BarryA |
last post by:
What are the essential steps and strategies outlined in the Data Structures and Algorithms (DSA) roadmap for aspiring data scientists? How can individuals effectively utilize this roadmap to progress...
|
by: Sonnysonu |
last post by:
This is the data of csv file
1 2 3
1 2 3
1 2 3
1 2 3
2 3
2 3
3
the lengths should be different i have to store the data by column-wise with in the specific length.
suppose the i have to...
|
by: Hystou |
last post by:
There are some requirements for setting up RAID:
1. The motherboard and BIOS support RAID configuration.
2. The motherboard has 2 or more available SATA protocol SSD/HDD slots (including MSATA, M.2...
|
by: marktang |
last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However,...
|
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...
|
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,...
|
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...
|
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...
| |