views:

55

answers:

1

I am trying to allow drag&drop from my program (winforms) to windows 7 taskbar (pin my program), without success.

What am I doing wrong?

DataObject objData = new DataObject();
objData.SetData(DataFormats.FileDrop, true, new string[] { Application.ExecutablePath });
((Control)sender).DoDragDrop(objData, DragDropEffects.Link);
+1  A: 

I read Here and Here that programicly pinning items to the taskbar has been disabled intentionaly (Due to programic-spamming of the bar)

I also read Here how this can be circumvented using the shell (And you can write code that executed shell script)

Now all you need is to write the code to execute the script

edit: this is all the information I've found that strongly relates to your corrent problem. I can't say it'll be enought, but I'm curtain it's enough to get you started (or at least enough to help you find more information).

A post containing code for drag&drop from application to desktop (from there it should be easy to move onto the taskbar) MSDN information about DataObject (related to drag&drop

Neowizard
DxCK
Neowizard