Bonjour,
dans mon programme, je veux appeler un fonction qui se trouve dans une DLL, et je voudrai quel me retourne plusieurs valeur. J'ai essayé avec un vecteur mais sa ne marche pas:
Code : Sélectionner tout - Visualiser dans une fenêtre à part extern "C++" __declspec(dllimport)std::vector<float> __stdcall Com_Serie_Read ();avec sa sa plante
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
35
36
37
38
39
40
41
42 { int Carte(2),Alarme(0),ret(0); float Tair(0),Tcut(0),Consigne(0),HR(0); std::vector<float> Tab; Tab=Com_Serie_Read (); alarme->Text="Etape 1"; Carte=Tab[0]; Alarme=Tab[1]; Tair=Tab[2]; Tcut=Tab[3]; Consigne=Tab[4]; HR=Tab[5]; if (Carte==0) { pCarte->ForeColor=System::Drawing::Color::Red; pCarte->Text="Carte Deconnectée"; } if (Carte==1) { pCarte->ForeColor=System::Drawing::Color::Lime; pCarte->Text="Carte Connectée"; if(Alarme==0) alarme->Text="Alarme Eteinte"; else if (Alarme==1) { alarme->ForeColor=System::Drawing::Color::Red; alarme->Text="Alarme Allumée"; } tair->Text=Convert::ToString(Tair); tcut->Text=Convert::ToString(Tcut); cons->Text=Convert::ToString(Consigne); hum->Text=Convert::ToString(HR); } if (Carte==2) alarme->Text="Probléme"; }
j'ai aussi essayé comme sa:
Code : Sélectionner tout - Visualiser dans une fenêtre à part extern "C++" __declspec(dllimport)int __stdcall Com_Serie_Read (int Alarme,float Tair,float Tcut,float Consigne,float HR);donc la je me retrouve tout le temps avec les variable à zéro, il ne prend pas en compte les modification effectué sur les variables par la DLL
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 { int Carte(0),Alarme(0),ret(0); float Tair(0),Tcut(0),Consigne(0),HR(0); carte= Com_Serie_Read (Alarme,Tair,Tcut,Consigne,HR); alarme->Text="Etape 1"; if (Carte==0) { pCarte->ForeColor=System::Drawing::Color::Red; pCarte->Text="Carte Deconnectée"; } if (Carte==1) { pCarte->ForeColor=System::Drawing::Color::Lime; pCarte->Text="Carte Connectée"; if(Alarme==0) alarme->Text="Alarme Eteinte"; else if (Alarme==1) { alarme->ForeColor=System::Drawing::Color::Red; alarme->Text="Alarme Allumée"; } tair->Text=Convert::ToString(Tair); tcut->Text=Convert::ToString(Tcut); cons->Text=Convert::ToString(Consigne); hum->Text=Convert::ToString(HR); } }







Répondre avec citation



j'apprend au fur et à mesure en fonction de ce que j'ai besoin

Partager