Bonjour !
Alors voilà je cherche je cherche mais je ne trouve de solution nulle part...
J'utilise la méthode décrite ici, cela fonctionne bien. J'ai includé le fichier Globals.h contenant la méthode dans stdafx.h, juste avant #pragma once.
En-tête Globals :
Dès que je touche à CurrentProjectTrigList avec 'set', le programme rencontre une erreur : Une exception non gérée du type 'System.StackOverflowException' s'est produite dans Heroes V GUI Trigger Editor.exe
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
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62 public ref class SharedVariables { private: //STATIC VARIABLES static System::String ^Function; static System::String ^Project; static System::String ^ProjectTrigList; static System::String ^ProjectEvntList; public: static property String ^CurrentFunction { String^ get() { return Function; } void set(String^ value) { CurrentFunction = value; } } static property String ^CurrentProject { String^ get() { return Project; } void set(String^ value) { CurrentProject = value; } } static property String ^CurrentProjectTrigList { String^ get() { return ProjectTrigList; } void set(String^ value) { CurrentProjectTrigList = value; } } static property String ^CurrentProjectEvntList { String^ get() { return ProjectEvntList; } void set(String^ value) { CurrentProjectEvntList = value; } } };
Par contre, CurrentProject est utilisé avec 'set' sans problèmes juste avant. Et dans la pile des appels, il n'y a qu'une suite interminable de
> Heroes V GUI Trigger Editor.exe!SharedVariables::set_CurrentFunction(System::String^ value = <valeur non définie>) Ligne 19 + 0xffffffef octets C++
Utilisation des variables :
Je ne comprends pas...
Code : Sélectionner tout - Visualiser dans une fenêtre à part
1
2
3
4
5
6
7
8
9 System::String ^CurrentProjectName; System::IO::StreamReader ^sr = gcnew System::IO::StreamReader("TMP.txt"); System::IO::Directory::CreateDirectory("Projects\\"); CurrentProjectName = sr->ReadToEnd()->ToString(); SharedVariables::CurrentProject = ("Projects\\" + CurrentProjectName + ".h5t"); SharedVariables::CurrentProjectTrigList = ("Projects\\" + CurrentProjectName + ".triglist"); SharedVariables::CurrentProjectEvntList = ("Projects\\" + CurrentProjectName + ".evntlist"); sr->Close();
Aussi dans les avertissement du déboggage, il y a :
Avertissement 1 warning C4717: 'SharedVariables::CurrentFunction::set' : récurrent sur tous les chemins d'accès de contrôle, la fonction entraînera un dépassement de capacité de la pile d'exécution c:\users\raftadata\documents\visual studio 2008\projects\heroes v gui trigger editor\heroes v gui trigger editor\globals.h 20
Mais coment faire alors pour mes variables globales à toutes les forms ?
Partager