Bonsoir,

Je poste ce message car je n'arrive pas à résoudre l'erreur C2664 sous VS2008 (Winform).
1>.\WifibotApp.cpp(34) : error C2664: 'CreateThread'*: impossible de convertir le paramètre 3 de 'overloaded-function' en 'LPTHREAD_START_ROUTINE'
J'ai pourtant bien fait attention à suivre la FAQ http://cpp.developpez.com/faq/vc/?pa...keWorkerThread et bien d'autres sujets traitants ce problème, mais rien n'y fait.

Voici mon code :

WifibotForm .h :
Code : Sélectionner tout - Visualiser dans une fenêtre à part
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
#include "WifibotClient.h"
#pragma once
 
namespace WifibotApp {
 
	using namespace System;
	using namespace System::ComponentModel;
	using namespace System::Collections;
	using namespace System::Windows::Forms;
	using namespace System::Data;
	using namespace System::Drawing;
	using namespace System::Threading;
 
 
	public ref class WifibotForm : public System::Windows::Forms::Form
	{
	public:
 
		static DWORD WINAPI Thread_Send (LPVOID lpParam);
		void Thread_Send(void);
 
		DWORD dwthread_sendID1;
		HANDLE hthread_send1;
 
         }
 
...
}
WifibotApp .ccp :
Code : Sélectionner tout - Visualiser dans une fenêtre à part
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
#include "WifibotForm.h"
 
using namespace WifibotApp;
 
[STAThreadAttribute]
 
void WifibotForm::btnConnection_Click(System::Object ^sender, System::EventArgs ^e){
	char* addIp = "127.0.0.1";
	int port = 15020;
 
	if(robot.ConnectToRobot(addIp, port) == 0){
		robot.ConnectToRobot(addIp, port);
		btnConnection->Visible = false;
		btnDeconnection->Visible = true;
 
                //problème à cette ligne
		hthread_send1=CreateThread(NULL, 0, Thread_Send, this, 0, &dwthread_sendID1);
 
		running = true;
	}
	else
		MessageBox::Show("La connexion a échouée" , "Connexion", MessageBoxButtons::OK);
}
 
void WifibotForm::Thread_Send(void){
   //code
}
 
DWORD WINAPI WifibotForm::Thread_Send (LPVOID p){	
	WifibotForm ^me = (WifibotForm ^)p; //code managé "*" devient "^"
	me->Thread_Send ();
	return 0;
}
...
Je ne comprends pas ce qui ne va pas, et en quoi ma fonction est surchargée.

A noter aussi que cette erreur est aussi présente.
1>.\WifibotApp.cpp(94) : error C2440: 'cast de type'*: impossible de convertir de 'LPVOID' en 'WifibotApp::WifibotForm ^'
J'ai essayé un const_cast, dynamic_cast et reinterpret_cast mais en vain.

Cordialement,
Tehko