Click here to Skip to main content
15,908,444 members
Home / Discussions / C#
   

C#

 
GeneralRe: Itembackground Color in ListBox Pin
Heath Stewart13-Feb-04 16:48
protectorHeath Stewart13-Feb-04 16:48 
GeneralInterfaces Pin
MrJJKoolJ13-Feb-04 7:21
MrJJKoolJ13-Feb-04 7:21 
GeneralRe: Interfaces Pin
Heath Stewart13-Feb-04 12:29
protectorHeath Stewart13-Feb-04 12:29 
GeneralRe: Interfaces Pin
MrJJKoolJ13-Feb-04 12:34
MrJJKoolJ13-Feb-04 12:34 
GeneralImplementing IDropTargetInterFace in C# Pin
vnutheti13-Feb-04 6:35
vnutheti13-Feb-04 6:35 
GeneralRe: Implementing IDropTargetInterFace in C# Pin
Heath Stewart13-Feb-04 12:20
protectorHeath Stewart13-Feb-04 12:20 
GeneralRe: Implementing IDropTargetInterFace in C# Pin
vnutheti13-Feb-04 13:44
vnutheti13-Feb-04 13:44 
GeneralRe: Implementing IDropTargetInterFace in C# Pin
Heath Stewart13-Feb-04 16:46
protectorHeath Stewart13-Feb-04 16:46 
Regardless of whether or not the ref was a problem, it still shouldn't be there. Now, if this was a pointer to a pointer (i.e., IDropTarget**), then you should use ref. A pointer to a value type (i.e., numeric, boolean, byte, char, struct, enum) would require ref or out.

As far as the error goes, let me introduce you to ildasm.exe - the IL disassembler that comes with the .NET Framework SDK. As I mentioned before - and which should be evident since .NET supports drag-n-drop with native Windows - .NET uses the OLE drag-n-drop internally. Logically, you should think to look into the assembly that would use it (just trying to introduce a thought process here). Logically, this is in the System.Windows.Forms.dll assembly.

So, run ildasm.exe and open that assembly (or use something like .NET Reflector). Find the UnsafeNativeMethods class (typical name in base class libraries). There'll you'll find the defnition used by Microsoft (which obviously works). you'll also find reference to IOleDropTarget, which is what they use internally for IDropTarget (the name doesn't matter - only the IID and methods / dispids depending on inheritence). If ever you have problems determining how something should be defined, changes are that the base class libraries are using them internally somewhere.

The method should be defined as:
[DllImport("ole32.dll", CallingConvention=CallingConvention.Winapi)]
static extern int RegisterDragDrop(HandleRef hWnd, IOleDropTarget target);
See nested interfaces for definitions of the interfaces, too. They use "Ole" in the interface name and prefix the method names with it (to help distinguish it from implementations), but it doesn't matter so long as the vtable order for IUnknown-inherited interfaces and DISPIDs for IDispatch-inherited interfaces remain the same (for dual interfaces, both order and DISPIDs should be the same).

 

Microsoft MVP, Visual C#
My Articles
GeneralRe: Implementing IDropTargetInterFace in C# Pin
vnutheti14-Feb-04 8:06
vnutheti14-Feb-04 8:06 
GeneralUsing and intercepting command line programs Pin
noahfields13-Feb-04 6:00
noahfields13-Feb-04 6:00 
GeneralRe: Using and intercepting command line programs Pin
Kentamanos13-Feb-04 7:12
Kentamanos13-Feb-04 7:12 
GeneralRe: Using and intercepting command line programs Pin
noahfields14-Feb-04 4:05
noahfields14-Feb-04 4:05 
GeneralDataset and Recordset Pin
ASGill13-Feb-04 5:11
ASGill13-Feb-04 5:11 
GeneralRe: Dataset and Recordset Pin
Heath Stewart13-Feb-04 5:28
protectorHeath Stewart13-Feb-04 5:28 
GeneralControlling Panels via RadioButtons Pin
srt713-Feb-04 4:47
srt713-Feb-04 4:47 
GeneralRe: Controlling Panels via RadioButtons Pin
Heath Stewart13-Feb-04 5:32
protectorHeath Stewart13-Feb-04 5:32 
Generaldocked controls snapping to grid in compiled app Pin
Nathan Ridley13-Feb-04 4:16
Nathan Ridley13-Feb-04 4:16 
GeneralRe: docked controls snapping to grid in compiled app Pin
leppie13-Feb-04 19:14
leppie13-Feb-04 19:14 
GeneralRe: docked controls snapping to grid in compiled app Pin
Nathan Ridley14-Feb-04 0:06
Nathan Ridley14-Feb-04 0:06 
AnswerRe: listView - is there a bug? Pin
thomasa13-Feb-04 1:54
thomasa13-Feb-04 1:54 
GeneralRe: listView - is there a bug? Pin
Andy H13-Feb-04 3:16
Andy H13-Feb-04 3:16 
GeneralRe: listView - is there a bug? Pin
Heath Stewart13-Feb-04 3:50
protectorHeath Stewart13-Feb-04 3:50 
GeneralRe: listView - is there a bug? Pin
Andy H13-Feb-04 9:55
Andy H13-Feb-04 9:55 
GeneralRe: listView - is there a bug? Pin
Heath Stewart13-Feb-04 12:07
protectorHeath Stewart13-Feb-04 12:07 
GeneralRe: listView - is there a bug? Pin
Andy H13-Feb-04 23:37
Andy H13-Feb-04 23:37 

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.