MessageBox error
What do I need to do to get "message" in the messagebox without
any weird characters.
1 2 3 4 5 6 7 8 9 10 11 12 13
|
#include <iostream>
#include <windows.h>
using namespace std;
int main(){
string message = "message";
MessageBoxA(NULL, (char*)&message, (char*)&message, MB_ICONERROR);
}
|
If you're running in Unicode:
1 2
|
wstring wmessage{ message.begin( ), message.end( ) };
MessageBoxA( NULL, wmessage.c_str( ), wmessage.c_str( ), MB_ICONERROR );
|
Otherwise:
|
MessageBoxA( NULL, message.c_str( ), message.c_str( ), MB_ICONERROR );
|
Great ! Thanks man your a hero.
Topic archived. No new replies allowed.