Bonjour,
Voici un petit code devant permettre d'afficher un message box en fonction de paramètres choisis pas l'utilisateur. Le voici :

#include <stdio.h>
#include <windows.h>
#include <iostream>
#include <sstream>

using namespace std;

template<typename T>
std::string to_string( const T & Value )
{
// utiliser un flux de sortie pour créer la chaîne
std::ostringstream oss;
// écrire la valeur dans le flux
oss << Value;
// renvoyer une string
return oss.str();
}

int main()
{
std::string sIpText;
std::string sIpCaption;
LPCTSTR IpText;
LPCTSTR IpCaption;
UINT uType;
char key;

cout << "Message Box Text:" << endl;
cin >> sIpText;
cout << "Message Box Title:" << endl;
cin >> sIpCaption;
cout << "Message Box Type:" << endl;
cout << "(a) Error" << endl;
cout << "(b) Exclamation" << endl;
cout << "(c) Information" << endl;
cout << "(d) Question " << endl;

switch(key)
{
case 'a':
uType = MB_ICONERROR;
break;

case 'b':
uType = MB_ICONEXCLAMATION;
break;

case 'c':
uType = MB_ICONINFORMATION;
break;

case 'd':
uType = MB_ICONQUESTION;
break;

default:
return EXIT_SUCCESS;
break;
}

IpText = to_string(sIpText);
IpCaption = to_string(sIpCaption);

MessageBox(0, IpText, IpCaption, MB_TASKMODAL);

system("PAUSE");
}
Mais la conversion ne fonctionne pas. Voici ce que me dit le compilateur :
61 cannot convert `std::basic_string<char, std::char_traits<char>, std::allocator<char> >' to `const TCHAR*' in assignment
pour les deux lignes :
IpText = to_string(sIpText);
IpCaption = to_string(sIpCaption);

Quelqu'un pourrait-il m'aider ?
Merci d'avance.