Click here to Skip to main content
15,889,528 members
Home / Discussions / C#
   

C#

 
GeneralRe: Making a single control as Windows Forms Control and Web Forms Control Pin
Heath Stewart20-Oct-03 11:47
protectorHeath Stewart20-Oct-03 11:47 
GeneralRe: Making a single control as Windows Forms Control and Web Forms Control Pin
igor196020-Oct-03 8:27
igor196020-Oct-03 8:27 
GeneralRe: Making a single control as Windows Forms Control and Web Forms Control Pin
Judah Gabriel Himango20-Oct-03 8:30
sponsorJudah Gabriel Himango20-Oct-03 8:30 
GeneralRe: Making a single control as Windows Forms Control and Web Forms Control Pin
igor196020-Oct-03 8:45
igor196020-Oct-03 8:45 
GeneralRe: Making a single control as Windows Forms Control and Web Forms Control Pin
Judah Gabriel Himango20-Oct-03 11:15
sponsorJudah Gabriel Himango20-Oct-03 11:15 
GeneralRe: Making a single control as Windows Forms Control and Web Forms Control Pin
igor196020-Oct-03 11:18
igor196020-Oct-03 11:18 
GeneralClipboard and IStorage Pin
Oleksandr Kucherenko20-Oct-03 0:12
Oleksandr Kucherenko20-Oct-03 0:12 
GeneralRe: Clipboard and IStorage Pin
Heath Stewart20-Oct-03 6:16
protectorHeath Stewart20-Oct-03 6:16 
This really requires quite a bit of knowledge of OLE/COM. Remember that the .NET clipboard (and drag and drop functions) are just wrappers for their Win32 counterparts. The same stuff is possible, but in many cases you have to recreate some structs, enums, and interface definitions for stuff that is already in Win32. For example, the System.Runtime.InteropServices.UCOMISTream interface already exists, but an equivalent for IStorage does not. You'll have to create an interface with the proper GuidAttribute and interface methods (taking into account marshaling parameters).

To do this correctly, you'll have to implement .NET's IDataObject yourself and recreate structures for FORMATETC and STGMEDIUM. .NET's IDataObject is created specifically for .NET, using objects instead of structs and interface pointers. You'll have to override it to make it work more like COM's IDataObject interface.

After that, simply call Clipboard.SetDataObject(object) or Clipboard.SetDataObject(object,bool) in your client code.

My recommendations, make your IDataObject implementation class take an object (perhaps of a specific type) and some other parameter to dictate whether the implementaiton itself should wrap it up in an IStorage or IStream object.

So, I'm sorry there isn't example code like you asked, but this is actually a very big problem to solve and requires that you read-up on COM to understand it. Be sure to look at FORMATETC and STDMEDIUM. Both contains links to other material that should be helpful.

 

-----BEGIN GEEK CODE BLOCK-----
Version: 3.21
GCS/G/MU d- s: a- C++++ UL@ P++(+++) L+(--) E--- W+++ N++ o+ K? w++++ O- M(+) V? PS-- PE Y++ PGP++ t++@ 5 X+++ R+@ tv+ b(-)>b++ DI++++ D+ G e++>+++ h---* r+++ y+++
-----END GEEK CODE BLOCK-----
GeneralRe: Clipboard and IStorage Pin
Oleksandr Kucherenko20-Oct-03 21:09
Oleksandr Kucherenko20-Oct-03 21:09 
GeneralRe: Clipboard and IStorage Pin
Heath Stewart21-Oct-03 3:01
protectorHeath Stewart21-Oct-03 3:01 
GeneralRemoting on .NET Framework 1.1 Pin
KC Ooi19-Oct-03 23:14
KC Ooi19-Oct-03 23:14 
GeneralRe: Remoting on .NET Framework 1.1 Pin
Jeffry van de Vuurst20-Oct-03 1:51
Jeffry van de Vuurst20-Oct-03 1:51 
GeneralTake the "real" time an application has been used Pin
Braulio Dez19-Oct-03 23:05
Braulio Dez19-Oct-03 23:05 
GeneralRe: Take the "real" time an application has been used Pin
Marc Clifton20-Oct-03 1:13
mvaMarc Clifton20-Oct-03 1:13 
GeneralRe: Take the "real" time an application has been used Pin
Braulio Dez20-Oct-03 2:20
Braulio Dez20-Oct-03 2:20 
GeneralRe: Take the "real" time an application has been used Pin
Corinna John20-Oct-03 1:35
Corinna John20-Oct-03 1:35 
GeneralRe: Take the "real" time an application has been used Pin
Braulio Dez20-Oct-03 2:21
Braulio Dez20-Oct-03 2:21 
GeneralRe: Take the "real" time an application has been used Pin
Andrew Torrance22-Oct-03 22:33
Andrew Torrance22-Oct-03 22:33 
GeneralTables in a DataSet Pin
Mazdak19-Oct-03 22:44
Mazdak19-Oct-03 22:44 
GeneralRe: Tables in a DataSet Pin
Heath Stewart20-Oct-03 5:29
protectorHeath Stewart20-Oct-03 5:29 
Generalgui behavior Pin
Roger Alsing19-Oct-03 22:30
Roger Alsing19-Oct-03 22:30 
GeneralRe: gui behavior Pin
Heath Stewart20-Oct-03 5:32
protectorHeath Stewart20-Oct-03 5:32 
GeneralRe: gui behavior Pin
DesertLarry21-Oct-03 5:04
DesertLarry21-Oct-03 5:04 
GeneralDll free problem Pin
andyniyong19-Oct-03 22:22
andyniyong19-Oct-03 22:22 
GeneralRe: Dll free problem Pin
leppie20-Oct-03 7:12
leppie20-Oct-03 7:12 

General General    News News    Suggestion Suggestion    Question Question    Bug Bug    Answer Answer    Joke Joke    Praise Praise    Rant Rant    Admin Admin   

Use Ctrl+Left/Right to switch messages, Ctrl+Up/Down to switch threads, Ctrl+Shift+Left/Right to switch pages.