Drag-n-drop windows shell namespace extension

cs_khelifaoui Messages postés 35 Date d'inscription dimanche 5 novembre 2006 Statut Membre Dernière intervention 1 décembre 2007 - 23 oct. 2007 à 11:03
ShareVB Messages postés 2676 Date d'inscription vendredi 28 juin 2002 Statut Membre Dernière intervention 13 janvier 2016 - 28 nov. 2007 à 11:42
salut tout le monde, j'ai cree une extension de l'explorateure de windows il apparait comme un disque dure dans le poste de travaille (comme gmaildrivedrive ) j'ai implimenter les interface et leur implimentation pour faire dra-ndrop mais  j'ai pas riussir a faire cette operation;
asque quelqu'un peut m'aider?
MERCI.

8 réponses

cs_khelifaoui Messages postés 35 Date d'inscription dimanche 5 novembre 2006 Statut Membre Dernière intervention 1 décembre 2007
27 oct. 2007 à 16:06
personne ne connait la programmation system ?
0
ShareVB Messages postés 2676 Date d'inscription vendredi 28 juin 2002 Statut Membre Dernière intervention 13 janvier 2016 26
20 nov. 2007 à 00:47
salut,

dit déjà quels interface tu as implémentées...normalement il doit y avoir l'interface idroptarget .?

ShareVB
0
cs_khelifaoui Messages postés 35 Date d'inscription dimanche 5 novembre 2006 Statut Membre Dernière intervention 1 décembre 2007
21 nov. 2007 à 14:33
oui j'ai les trois interface Idroptrajet; idropsource , idataobject; si tu peut m'aider ?
0
ShareVB Messages postés 2676 Date d'inscription vendredi 28 juin 2002 Statut Membre Dernière intervention 13 janvier 2016 26
27 nov. 2007 à 00:40
salut,

tu es sûr des GUID de la déclaration de IdropTarget ?

sinon donne un bout de code de l'implémentation de IDropTarget

ShareVB
0

Vous n’avez pas trouvé la réponse que vous recherchez ?

Posez votre question
cs_khelifaoui Messages postés 35 Date d'inscription dimanche 5 novembre 2006 Statut Membre Dernière intervention 1 décembre 2007
27 nov. 2007 à 10:39
j'ai reussir a implimenter l'interface IdropTarget et maintenant je suis entrain d'implimenter Idataobject et j'ai beucoup des probleme avec cette iumplientation , si tu veut je tu montre le code sources;
0
ShareVB Messages postés 2676 Date d'inscription vendredi 28 juin 2002 Statut Membre Dernière intervention 13 janvier 2016 26
27 nov. 2007 à 23:11
salut,

je ne suis pas sur que tu aies besoin d'implémenter idataobject...sinon montre le bout de code qui te pose prb...

ShareVB
0
cs_khelifaoui Messages postés 35 Date d'inscription dimanche 5 novembre 2006 Statut Membre Dernière intervention 1 décembre 2007
28 nov. 2007 à 08:59
voila l'implimantation de Idataobject , l'explorateur de windows appel la fonction "getdata " danc que je doit mettre dans cette fonction ! et les autres fonction ?

using



System;


using



System.Windows.Forms;


using



WindowsShell.Interop;


using



System.Runtime.InteropServices;


using



System.Runtime.InteropServices.ComTypes; 



namespace



WindowsShell.Nspace{










internal



class



DataObjectImpl
: WindowsShell.Interop.

IDataObject

{







IFolderObject
Root;[


DllImport
(

"user32"
, EntryPoint =

"RegisterClipboardFormat"
)]


public



static



extern



short
RegisterClipboardFormatA(

string
lpString); 

[


DllImport
(

"user32"
, EntryPoint =

"GetClipboardFormatName"
)]


public



static



extern



int
GetClipboardFormatNameA(

int
wFormat,

out



string
lpString,

int
nMaxCount); 


string
CFSTR_PREFERREDDROPEFFECT = (

"Preferred DropEffect"
);


string
CFSTR_SHELLIDLIST =

"Shell IDList Array"
;

// CF_IDLIST






string
CFSTR_FILECONTENTS =

"FileContents"
;

// CF_FILECONTENTS






string
CFSTR_NSEDRAGDROP =

"NSEDRAGDROP"
;


string
CFSTR_FILEDESCRIPTOR =

"FileGroupDescriptor"
;


// This is my custom FOrmat...






string
CFSTR_CWEXTENSIONDATA =

"CWExtensionFormat"



short
m_PreferredDropEffect;


short
m_ShellIdList;


short
m_CWExtensionData;


short
m_FileDescriptor;


short
m_FileContents;


short
m_iCurrent = 0;


short
m_CFSTR_NSEDRAGDROP;


public



int
S_OK =

unchecked
((

int
)0x00000000L);


public



int
E_NOTIMPL =

unchecked
((

int
)0x80004001L);


public



int
E_INVALIDARG =

unchecked
((

int
)0x80070057L);


public



int
DV_E_DVASPECT =

unchecked
((

int
)0x8004006BL);


public



int
DV_E_TYMED =

unchecked
((

int
)0x80040069L);


public



int
DV_E_FORMATETC =

unchecked
((

int
)0x80040064L);


public



int
DV_E_LINDEX =

unchecked
((

int
)0x80040068L);


int
m_itemCount = 0;


int
m_cFormatsAvailable = 4;


FORMATETC
[] m_fmtetc; 


internal
DataObjectImpl(

IFolderObject
rootObj,

IntPtr
[] apidl,

int
ItemCount){





Root = rootObj;


m_CWExtensionData = RegisterClipboardFormatA(CFSTR_CWEXTENSIONDATA);


m_PreferredDropEffect = RegisterClipboardFormatA(CFSTR_PREFERREDDROPEFFECT);


m_ShellIdList = RegisterClipboardFormatA(CFSTR_SHELLIDLIST);


m_FileDescriptor = RegisterClipboardFormatA(CFSTR_FILEDESCRIPTOR);


m_FileContents = RegisterClipboardFormatA(CFSTR_FILECONTENTS);


m_CFSTR_NSEDRAGDROP = RegisterClipboardFormatA(CFSTR_NSEDRAGDROP);


m_itemCount = ItemCount;


m_fmtetc =




new



FORMATETC
[m_cFormatsAvailable];SetDefFormatEtc(


ref
m_fmtetc[0], m_CWExtensionData);SetDefFormatEtc(


ref
m_fmtetc[1], m_ShellIdList);SetDefFormatEtc(


ref
m_fmtetc[2], (

short
)WindowsShell.Nspace.

Clipformat
.

CLIPFORMAT
.CF_HDROP);SetDefFormatEtc(


ref
m_fmtetc[3], m_PreferredDropEffect);

}


void
SetDefFormatEtc(

ref



FORMATETC
pFE,

short
cfFormat){


// MessageBox.Show("SetDefFormatEtc");

pFE.cfFormat = cfFormat;


pFE.dwAspect =




DVASPECT
.DVASPECT_CONTENT;pFE.tymed =


TYMED
.TYMED_HGLOBAL;pFE.lindex = -1;

pFE.ptd = (


IntPtr
)0;}


int
WindowsShell.Interop.

IDataObject
.GetData([

In
]

ref



FORMATETC
pformatetcIn,

ref



STGMEDIUM
pmedium){


throw



new



NotImplementedException
();}


void
WindowsShell.Interop.

IDataObject
.GetDataHere(

ref



FORMATETC
pformatetc,

ref
System.Runtime.InteropServices.ComTypes.

STGMEDIUM
pmedium){


throw



new



NotImplementedException
();}


int
WindowsShell.Interop.

IDataObject
.QueryGetData(

ref



FORMATETC
pformatetc){


if
(pformatetc.cfFormat != m_CFSTR_NSEDRAGDROP &&pformatetc.cfFormat != (


ushort
)WindowsShell.Nspace.

Clipformat
.

CLIPFORMAT
.CF_HDROP)pformatetc.cfFormat = (


short
)WindowsShell.Nspace.

Clipformat
.

CLIPFORMAT
.CF_HDROP;


return
DV_E_FORMATETC;


if
(pformatetc.ptd !=

null
)


// MessageBox.Show("2");






return
E_INVALIDARG;


if
((pformatetc.dwAspect ) == 0)


// MessageBox.Show("3");






return
DV_E_DVASPECT;


if
(pformatetc.lindex != -1)


// MessageBox.Show("4");






return
DV_E_LINDEX;


if
((pformatetc.tymed ) == 0)


// MessageBox.Show("5");






return
DV_E_TYMED;


// throw new NotImplementedException();

}







int
WindowsShell.Interop.

IDataObject
.GetCanonicalFormatEtc(

ref



FORMATETC
pformatectIn,

out



FORMATETC
pformatetcOut){


// MessageBox.Show("GetCanonicalFormatEtc");






throw



new



NotImplementedException
();}


int
WindowsShell.Interop.

IDataObject
.SetData(

ref



FORMATETC
pformatetc,

ref
System.Runtime.InteropServices.ComTypes.

STGMEDIUM
pmedium,

bool
fRelease){


//return 0;






//MessageBox.Show("SetData");






throw



new



NotImplementedException
();}


int
WindowsShell.Interop.

IDataObject
.EnumFormatEtc(

uint
a,

out



IEnumFormatEtc
b){


//throw new NotSupportedException();






//return E_NOTIMPL;






// MessageBox.Show("EnumFormatEtc");






switch
(a){


case
1:

b =


new



EnumFormatEtcImpl
(m_fmtetc, m_cFormatsAvailable);


break
;


case
2:


default
:b =


null
;


break
;}


if
(b ==

null
){


return
E_NOTIMPL;}


return
S_OK;


// throw new NotImplementedException();

}







int
WindowsShell.Interop.

IDataObject
.DAdvise(

ref



FORMATETC
pformatetc,

uint
advf, WindowsShell.Interop.

IAdviseSink
pAdvSink,

out



uint
pdwConnection){


throw



new



NotImplementedException
();}


int
WindowsShell.Interop.

IDataObject
.DUnadvise(

uint
dwConnection){


throw



new



NotImplementedException
();}


int
WindowsShell.Interop.

IDataObject
.EnumDAdvise(

out



IEnumStatData
ppenumAdvise){


throw



new



NotImplementedException
();}


//*******************************




}


}
0
ShareVB Messages postés 2676 Date d'inscription vendredi 28 juin 2002 Statut Membre Dernière intervention 13 janvier 2016 26
28 nov. 2007 à 11:42
salut,

je pense que tu peux utiliser directement la classe System.Windows.Forms.DataObject qui implémente System.Runtime.InteropServices.ComTypes.IDataObject. Je suppose que tu passes une instance de DataObjectImpl depuis ton idropsource ou idroptarget...donc tu instancie un System.Windows.Forms.DataObject que tu remplit avant de le passer à un windows...

ShareVB
0
Rejoignez-nous