bonjour,
je debute en c# et je fais un programme permettant d'uploader une image sur un ftp a intervalle regulié
j'avais tout fais mais j'ai changé de composant COM (j'utilise DShowNET) en court de route j'ai du readapter tout le code et
malheuresement il y a qqchose qui ne passe pas :

Code : Sélectionner tout - Visualiser dans une fenêtre à part
1
2
3
4
5
6
7
8
9
10
11
12
 
System.InvalidCastException was unhandled
  Message="Unable to cast COM object of type 'System.__ComObject' to interface type 'DShowNET.ISampleGrabber'. This operation failed because the QueryInterface call on the COM component for the interface with IID '{6B652FFF-11FE-4FCE-92AD-0266B5D7C78F}' failed due to the following error: Cette interface n'est pas prise en charge (Exception from HRESULT: 0x80004002 (E_NOINTERFACE))."
  Source="DShowNET"
  StackTrace:
       at DShowNET.ISampleGrabber.SetCallback(ISampleGrabberCB pCallback, Int32 WhichMethodToCallback)
       at WindowsApplication1.Form1.captImg() in C:\Documents and Settings\Marc\Mes documents\Visual Studio 2005\Projects\WindowsApplication1\WindowsApplication1\Form1.cs:line 579
       at WindowsApplication1.Form1.capt() in C:\Documents and Settings\Marc\Mes documents\Visual Studio 2005\Projects\WindowsApplication1\WindowsApplication1\Form1.cs:line 628
       at WindowsApplication1.ThreadPhotoUpload.startUp(Object obj) in C:\Documents and Settings\Marc\Mes documents\Visual Studio 2005\Projects\WindowsApplication1\WindowsApplication1\ThreadPhotoUpload.cs:line 32
       at System.Threading.ThreadHelper.ThreadStart_Context(Object state)
       at System.Threading.ExecutionContext.Run(ExecutionContext executionContext, ContextCallback callback, Object state)
       at System.Threading.ThreadHelper.ThreadStart(Object obj)
la ligne fautive est :
Code : Sélectionner tout - Visualiser dans une fenêtre à part
1
2
 
hr = sampGrabber.SetCallback(this, 1); // int hr
de la methode captImg qui est dans ma form principale appelé dans un autre Thread par reference :
par contre quand je met un boutton sur la form et que je lui met comme action :
Code : Sélectionner tout - Visualiser dans une fenêtre à part
1
2
 
captImg();// je n'ai aucune exception
j'ai mis un messageBox juste avant linstruction fautive pour voir this
et c'est le meme on dirait
donc je ne comprend pas ou est le probleme

voila
merci