Home | Contact Us | FAQ | Search & Site Map | Link to Us
Sign In | Join | Other 45 Sites in Network
HomeAnnouncementsFree MagazinesWhite PapersSubmit Content
Discussion GroupsASP.NETWindows FormsLanguages.NET FrameworkVisual Studio.NET
Articles.NET FrameworkASP.NETToolsWindows Forms
.NET DirectoryOpen Source ProjectsUser GroupsWeb Resources
Related Topics
Visual Basic 6SQL ServerMS AccessOther DB ProductsMS Server ProductsMore Topics ...

.NET Forum / Windows Forms / WinForm General / February 2006

Tip: Looking for answers? Try searching our database.

Implement a link source (or at least part of one)

Thread view: 
Enable EMail Alerts  Start New Thread
Thread rating: 
Stephen Walch - 03 Feb 2006 14:54 GMT
I want to be able to drag objects from a third-party product to my .NET
Winforms app.   If I look at the clipboard formats, there is nothing useful
except CF_LINKSOURCE, so I deduce that I need to do some OLE handshaking
(OleCreateLinkFromData, IPersistStorage, etc.).  Does anyone have any
pointers as to how to do this from C# (.NET 1.1 preferred, .NET 2.0
acceptable).  Thanks in advance!
Michael Phillips, Jr. - 03 Feb 2006 16:45 GMT
I wanted to pull image data out of a CF_LINKSOURCE.

Below is my approach using Platform Invoke:
1) Use OleGetClipboard to obtain a IOleDataObject interface.
2) Use OleGetData to obtain the IStream interface for the embedded link
data.
3) Use OleLoadFromStream to obtain the required IMoniker interface.
4) Create an IStorage interface to transfer the data
   Use CreateILockBytesOnHGlobal and StgCreateDocfileOnILockBytes.
5) Use OleCreateLink to obtain the IDataObject for the data that is embedded
in the link.
6) Use OleRun to run OLE for the IDataObject
7) Pull the image data or Rtf and/or any other data that can be rendered
from the IDataObject.

Since IStorage is not represented in .Net 1.1, you must create an assembly
from a type library
for all the needed interfaces used by the OLE Platform Invoked functions.

>I want to be able to drag objects from a third-party product to my .NET
>Winforms app.   If I look at the clipboard formats, there is nothing useful
>except CF_LINKSOURCE, so I deduce that I need to do some OLE handshaking
>(OleCreateLinkFromData, IPersistStorage, etc.).  Does anyone have any
>pointers as to how to do this from C# (.NET 1.1 preferred, .NET 2.0
>acceptable).  Thanks in advance!
"TerryFei" - 09 Feb 2006 04:39 GMT
Hi Stephen,

I just wanted to check how things are going and whether Michael's
suggestion is useful for you. If there is any question, please feel free to
join the community and we are here to support you at your convenience.
Thanks for your understanding!

Best Regards,

Terry Fei[MSFT]
Microsoft Community Support
Signature

Get Secure! www.microsoft.com/security
(This posting is provided "AS IS", with no warranties, and confers no
rights.)


--------------------
>From: "Stephen Walch" <swalch@online.nospam>
>Subject: Implement a link source (or at least part of one)
[quoted text clipped - 10 lines]
>Path: TK2MSFTNGXA02.phx.gbl!TK2MSFTNGP08.phx.gbl!TK2MSFTNGP15.phx.gbl
>Xref: TK2MSFTNGXA02.phx.gbl
microsoft.public.dotnet.framework.windowsforms:93822
>X-Tomcat-NG: microsoft.public.dotnet.framework.windowsforms
>
[quoted text clipped - 4 lines]
>pointers as to how to do this from C# (.NET 1.1 preferred, .NET 2.0
>acceptable).  Thanks in advance!

Rate this thread:







Free Magazines

Get these publications absolutely FREE for up to 12 months. There are no hidden fees and no obligation. Simply choose a title, complete the application form and submit it. Read more ...

Oracle MagazineNetwork ComputingComputer WorldBio-IT WorldeWeekInformation WeekInfosecurity
 
Sign In
Join
My Latest Posts
My Monitored Threads
My Blog
My Photo Gallery
My Profile
My Homepage

Start New Thread
Enable EMail Alerts
Rate this Thread



©2008 Advenet LLC   Privacy Policy - Terms of Use
This website includes both content owned or controlled by Advenet as well as content owned or controlled by third parties.