Bonjour,

Je developpe actuellement un projet sous Visual C++. Par contre j'ai des difficultés à utiliser les fenêtres et autres possibilité.

Bon pour simplifier, je cherche à réaliser une fenêtre composé d'un menu. Dans le menu on doit pouvoir faire Fichier ---> Ouvrir et la Avoir une fenetre de choix de fichier (Style Windows) appelé "une boîte de dialogue 'parcourir'" Par Bob et CGi dans leur tutorial ...ON choisit un fichier image et celui ci s'affiche dans notre fenetre.

Premier question: Comment ouvrir une fenetre de choix de fichiers (style windows).
[...]
j'appel dans :
Code : Sélectionner tout - Visualiser dans une fenêtre à part
LRESULT CALLBACK WndProc(HWND hWnd, UINT message, WPARAM wParam, LPARAM lParam){ [...] }
la fonction suivante
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
 
void DoFileOpen(HWND hwnd)
{
	OPENFILENAME ofn;
	char szFileName[MAX_PATH] = "";
	char ext[3];
 
	ZeroMemory(&ofn, sizeof(ofn));
 
	ofn.lStructSize = sizeof(OPENFILENAME);
	ofn.hwndOwner = hwnd;
	ofn.lpstrFilter = "Fichiers audio (*.mp3;*.wma;*.ogg;*.wav)\0*.mp3;*.wma;*.ogg;*.wav\0Listes de lecture (*.wpl;*.m3u;*.asx)\0*.wpl;*.m3u;*.asx\0Tous les fichiers (*.*)\0*.*\0";
	ofn.lpstrFile = szFileName;
	ofn.nMaxFile = MAX_PATH;
	ofn.Flags = OFN_EXPLORER | OFN_FILEMUSTEXIST | OFN_HIDEREADONLY;
	ofn.lpstrDefExt = "mp3";
 
	if(GetOpenFileName(&ofn))
	{
		getExt(szFileName,ext);
		if(stricmp(ext,"mp3")==0 || stricmp(ext,"wma")==0 || stricmp(ext,"ogg")==0 || stricmp(ext,"wav")==0){
			if(!ajouterMusique(hwnd,szFileName,&ListeAConv,IDC_LIST))
				MessageBox(hwnd, "Impossible d'ajouter le fichier","Erreur", MB_OK | MB_ICONINFORMATION);
		}
		else if(stricmp(ext,"wpl")==0 || stricmp(ext,"m3u")==0 || stricmp(ext,"asx")==0){
			if(!ajouterPlaylist(hwnd,szFileName,&ListeAConv))
				MessageBox(hwnd, "Impossible d'ajouter le fichier","Erreur", MB_OK | MB_ICONINFORMATION);
		}
		else 
			MessageBox(hwnd,"Erreur : Format incompatible","Erreur", MB_OK | MB_ICONINFORMATION);
	}
}
Sachant que j'avais déja utilisé cette méthode en C et cela fonctionnait.

Je vous laisse aussi la liste d'erreur générée.

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
symboles.cpp(64) : error C2065: 'OPENFILENAME' : undeclared identifier
symboles.cpp(64) : error C2146: syntax error : missing ';' before identifier 'ofn'
symboles.cpp(64) : error C2065: 'ofn' : undeclared identifier
symboles.cpp(70) : error C2228: left of '.lStructSize' must have class/struct/union type
symboles.cpp(71) : error C2228: left of '.hwndOwner' must have class/struct/union type
symboles.cpp(72) : error C2228: left of '.lpstrFilter' must have class/struct/union type
symboles.cpp(73) : error C2228: left of '.lpstrFile' must have class/struct/union type
symboles.cpp(74) : error C2228: left of '.nMaxFile' must have class/struct/union type
symboles.cpp(75) : error C2228: left of '.Flags' must have class/struct/union type
symboles.cpp(75) : error C2065: 'OFN_EXPLORER' : undeclared identifier
symboles.cpp(75) : error C2065: 'OFN_FILEMUSTEXIST' : undeclared identifier
symboles.cpp(75) : error C2065: 'OFN_HIDEREADONLY' : undeclared identifier
symboles.cpp(76) : error C2228: left of '.lpstrDefExt' must have class/struct/union type
symboles.cpp(78) : error C2065: 'GetOpenFileName' : undeclared identifier
symboles.cpp(80) : error C2065: 'getExt' : undeclared identifier
symboles.cpp(82) : error C2065: 'ajouterMusique' : undeclared identifier
symboles.cpp(82) : error C2065: 'ListeAConv' : undeclared identifier
symboles.cpp(82) : error C2065: 'IDC_LIST' : undeclared identifier
symboles.cpp(86) : error C2065: 'ajouterPlaylist' : undeclared identifier
Error executing cl.exe.
Creating browse info file...
 
symboles.exe - 19 error(s), 0 warning(s)
[EDIT]
J'en profite pour ajouter une question :
Sachant que je veux avoir un menu, dans une fenetre qui permet d'ouvrir "une boîte de dialogue 'parcourir'" et lorsque j'ai choisi monfichier (ici une image) je l'affiche dans ma fenetre. De plus j'aimerais ajouter un bouton dans ma fenetre enfin dans l'espace "client". Cela est -ce possible ??

Sachant que le But Final est de pouvoir ouvrir ( avec traitement je suppose ), un fichier de type vectoriel et effectué un bruitage dessus.

Je remerci Bob et CGi pour leur superbe Tuto.

J'espere que vous pourrez m'aider.
En tt cas merci d'avance !