Bonjour j'ai un problème avec le else de ma boucle de test: je teste l'existence d'une clef dans le registre Windows, si celle ci n'existe pas je la crée en l'ouvrant (puisque lorsque on essaye d'ouvrir une clef qui n'existe pas elle est crée par défaut):

Uilisation des bobliothèques suivantes:
Code : Sélectionner tout - Visualiser dans une fenêtre à part
1
2
#include "Registry.h"
#include "RegEntry.h"
Code : Sélectionner tout - Visualiser dans une fenêtre à part
1
2
3
4
5
6
7
8
9
10
for(i=0;i<m_ListMonday.size();i++)
	{	if ( CRegistry :: KeyExists( "Software\\Workshift editor", HKEY_LOCAL_MACHINE )) 
	//la clef existe on ne fait rien
 
		else 
			//la clef n'existe pas on la crée
			RegMyReg.Open( "Software\\Workshift editor", HKEY_LOCAL_MACHINE );
 
 
	}
L'erreur est la suivante:
C:\activeX\Workshift\WorkshiftPpg.cpp(300) : error C2181: illegal else without matching if
Je change donc mon code et encadre les statements par des {} :
Code : Sélectionner tout - Visualiser dans une fenêtre à part
1
2
3
4
5
6
7
8
9
10
for(i=0;i<m_ListMonday.size();i++)
	{	if ( CRegistry :: KeyExists( "Software\\Workshift editor", HKEY_LOCAL_MACHINE )) {
	    //la clef existe on ne fait rien
 
	} else {
			//la clef n'existe pas on la crée
		RegMyReg.Open( "Software\\Workshift editor", HKEY_LOCAL_MACHINE ); }
 
 
	}
et j'obtiens cette fois-ci 5 erreurs !!!
WorkshiftPpg.obj : error LNK2001: unresolved external symbol "public: bool __thiscall CRegistry::Open(char const *,struct HKEY__ *,unsigned long,bool)" (?Open@CRegistry@@QAE_NPBDPAUHKEY__@@K_N@Z)

WorkshiftPpg.obj : error LNK2001: unresolved external symbol "public: static bool __cdecl CRegistry::KeyExists(char const *,struct HKEY__ *)" (?KeyExists@CRegistry@@SA_NPBDPAUHKEY__@@@Z)

WorkshiftPpg.obj : error LNK2001: unresolved external symbol "public: __thiscall CRegistry::CRegistry(unsigned long)" (??0CRegistry@@QAE@K@Z)

WorkshiftPpg.obj : error LNK2001: unresolved external symbol "public: void __thiscall CRegistry::Close(void)" (?Close@CRegistry@@QAEXXZ)

Debug/Workshift.ocx : fatal error LNK1120: 4 unresolved externals
Error executing link.exe.
Merci pour votre aide !!