View Single Post
Old Mar 6th, 2005, 7:40 PM   #1
layer
Hobbyist Programmer
 
Join Date: Feb 2005
Posts: 112
Rep Power: 4 layer is on a distinguished road
Thumbs down Weird compiler error (Dev-Cpp 4.9.9.2)

hello again...im making a little command line and need a little help... well, fist ill show the code, then the questions! (1 question actualy)
#include <cstdlib>
#include <iostream>
#include <windows.h>

using namespace std;

int main()
{
    string line; 
    cout << "EasyCommand v. 1.0.0 BETA\n";
    cout << "Copyright (c) 2005-2006\n";
    cout << "Type 'help' for help\n\n";
    do { 
        cout << ": ";
        cin >> line;
        if (line == "exit"){
                 return 0;
        }
        if (line == "box"){
                 string buffer;
                 cout << "\nEnter a title: ";
                 cin >> buffer;
                 string buffertwo;
                 cout << "\nEnter the text: ";
                 cin >> buffertwo;
                 MessageBox(NULL, buffertwo, buffer, 0);
                 }
        if (line == "clear"){
                 system("cls"); 
                 cout << "\n";
        }
        if (line == "pause"){
             system("pause"); 
             cout << "\n";
        }
        if (line == "help"){
             cout << "\nBOX   Used to display a simple messagebox\nExample - Box (Output)Title: TitleHere (Output)Text: TextHere\nCLEAR Used to clear the console screen\nExample - clear\nEXIT  Used to exit the console\nExample - exit\nHELP  Used to display a list of commands\nExample - help\nPAUSE Used to pause the console \nExample - pause\n";
      }
  } while (line != "exit");
  cout << "Exiting...";
  return 0;
}

ok, when i try to compile that, i get this error:
Quote:
26 C:\Documents and Settings\ryanmoore\Desktop\Goal\main.cpp cannot convert `std::string' to `const CHAR*' for argument `2' to `int MessageBoxA(HWND__*, const CHAR*, const CHAR*, UINT)'
now its obviously got something to do with the box section of the code... could someone PELASE explain to me what i am doing wrong with it? thanks a bunch!
layer is offline   Reply With Quote