#include #include using namespace std; int WINAPI WinMain(HINSTANCE hInstance, HINSTANCE hPrevInstance, LPSTR lpCmdLine, int nCmdShow) { // Create a file reader ifstream readText("message.dat"); // Space for the text char icon[128]; char title[128]; char message[1024]; // Default icon DWORD iconIdentifier = MB_ICONEXCLAMATION; // Get the title line and icon type line readText.getline(title, 128); readText.getline(icon, 128); // Assign the icon based on input string if (strcmp(icon, "EXCLAMATION") == 0) { iconIdentifier = MB_ICONEXCLAMATION; } else if (strcmp(icon, "INFORMATION") == 0) { iconIdentifier = MB_ICONINFORMATION; } else if (strcmp(icon, "QUESTION") == 0) { iconIdentifier = MB_ICONQUESTION; } else if (strcmp(icon, "ERROR") == 0) { iconIdentifier = MB_ICONERROR; } // Read the message into the character buffer for (int i=0; i < 1024; i++) { readText.get(message[i]); // Stop and add null if we've reached end if (readText.eof()) { message[i] = '\0'; i = 1024; } } // Do the message box MessageBox (NULL, message , title, iconIdentifier); return 0; }