473,386 Members | 1,842 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,386 software developers and data experts.

Hooking IDataObject.GetData in .Net

Sorry for the cross-posting. I am having a hard time trying to classify
exactly what group this question would apply to.

I had posted an earlier message to
microsoft.public.dotnet.framework.windowsforms trying to find a way to
access the lindex member of the FORMATETC structure for a
CFSTR_FILECONTENTS callback request under C#. After some experimenting
I was able to come up with the following code snippet that receives the
callback with a filled in FORMATETC and allows me to save the lindex
value. Unfortunately, I am now stumped at how to forward the callback
to the .Net framework copy of IDataObject.GetData so that the request
can be processed by the framework and ultimately forwarded to my
override of DataObject.GetData. The location that I would want to
forward the request is marked as "TODO:". Can this be done or do have I
have fully implement my own IDataObject.GetData routine?

internal class DataObjectEx : DataObject,
System.Runtime.InteropServices.ComTypes.IDataObjec t
{
private Int32 m_lindex;

void
System.Runtime.InteropServices.ComTypes.IDataObjec t.GetData(ref
System.Runtime.InteropServices.ComTypes.FORMATETC formatetc, out
System.Runtime.InteropServices.ComTypes.STGMEDIUM medium)
{
if (formatetc.cfFormat ==
DataFormats.GetFormat(NativeMethods.CFSTR_FILECONT ENTS).Id)
m_lindex = formatetc.lindex;
// TODO: Forward request on to .Net framework
IDataObject.GetData
}

public override object GetData(string format, bool autoConvert)
{
// Handle requests for certain formats and then...
return base.GetData(format, autoConvert);
}
}
Jan 19 '08 #1
0 2747

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

Similar topics

1
by: EHuq | last post by:
Hi there I am facing a problem. When I include my unmanaged header file in my form1.h file, I am facing the compile error with the following messag C:\Program Files\Microsoft Visual Studio .NET...
0
by: Krunoslav Ostrouska | last post by:
ArrayList included in object is not saved at clippboard copy in Win98 (Clipboard.SetDataObject() and IDataObject.GetData()) ! In WinXP, framework calls GetObjectData() and...
3
by: JP | last post by:
I have an app that represents ShellFolder Items as a visual element (listview item, etc). The code correctly performs Drag&Drop operations EXCEPT in the case when the item being dragged is from a...
1
by: Robin Tucker | last post by:
I have an existing COM object that supports IDataObject (written in C++). I want to use GetFormats and GetData on this object in VB.NET, but I blooming well can't. If I write: Dim theObject...
7
by: **Developer** | last post by:
Although the code is VB I believe the question is OOP I tried the VB NG but no answer. I suspect the c# programmer is more apt to be aware of these kinds of subtleties so I', trying here. I do...
4
by: Bob Staheli | last post by:
The .Net DataObject class implements the COM/OLE IDataObject interface , so how do I get it. I have tried this, but it does not work : // Declare the COM/OLE IDataObject interface public...
3
by: nicolas.hilaire | last post by:
Hi group, when using unmanaged class with my managed app, I've seen errors when including (for example) <windows.h>. One of theses erros is : IDataObject : ambiguous symbol error I've seen...
1
by: Rick | last post by:
Error 2 error C2872: 'IDataObject' : ambiguous symbol C:\Archivos de programa\Microsoft Visual Studio 8\VC\PlatformSDK\include\objidl.h 7408 this is the error i got by mix managed and unmanaged...
3
by: dmeglio | last post by:
I have the following code: foreach (System.Type type in this.slideModules.Values) { IDataObject ido = Clipboard.GetDataObject(); if (ido.GetDataPresent(type)) { slide = ido.GetData(type) as...
0
by: taylorcarr | last post by:
A Canon printer is a smart device known for being advanced, efficient, and reliable. It is designed for home, office, and hybrid workspace use and can also be used for a variety of purposes. However,...
0
by: ryjfgjl | last post by:
If we have dozens or hundreds of excel to import into the database, if we use the excel import function provided by database editors such as navicat, it will be extremely tedious and time-consuming...
0
by: ryjfgjl | last post by:
In our work, we often receive Excel tables with data in the same format. If we want to analyze these data, it can be difficult to analyze them because the data is spread across multiple Excel files...
1
by: nemocccc | last post by:
hello, everyone, I want to develop a software for my android phone for daily needs, any suggestions?
1
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...
0
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...
0
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...
0
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,...
0
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...

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.