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

C#

 
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 
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 
Actually, such a call will work if you take something into account that I forgot to mention (sorry). If the data object implements System.Windows.Forms.UnsafeNativeMethods.IOleDataObject, it does work. Unfortunatel, it is a nested interface of an internal class, but the System.Windows.Forms.DataObject does. You can use reflection to set the FORMATETC and STGMEDIUM structs. Calling Clipboard.SetDataObject does, in fact, call OleSetClipboard.

You should try downloading .NET Reflector and take a look at how Clipboard.SetDataObject is done. Like I said, everything you need is already there. You may have to use Reflection to do get at it or you could redefine your own structs and interfaces in the same way it does (except that your IOleDataObject won't be the same Type as theirs, but you can at least make your call to OleSetClipboard work the same).

With that, I can understand how your interface methods aren't always correct. This happens often. I had a custom IClassFactory method with the same params. When I tried a trick where you write IDL, compile it with midl.exe to a typelib, then use tlbimp.exe to import that, the method had a mysterious third parameter. Using Reflector (that can disassemble in a much easier-to-follow way than ildasm.exe, and can also decompile), you can see how MS defined their interfaces and match them. Once you get your IOleDataObject interface defined correctly (remember, don't forget the GuidAttribute), you can pass the object directly into a correctly imported call to OleSetClipboard.

 

-----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-----
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 
GeneralRe: Dll free problem Pin
andyniyong21-Oct-03 16:04
andyniyong21-Oct-03 16:04 
Questionneed help... Listview drag drop algorithm? Pin
azusakt19-Oct-03 22:04
azusakt19-Oct-03 22:04 

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.