Error Message box

Any problem with this?
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
#include <windows.h>
using namespace std;
int main()
{
	int choice;
	LPCTSTR Caption = L"Application Programming Interface";
	INT WINAPI WinMain(HINSTANCE hInstance, HINSTANCE hPrevInstance,
    LPSTR lpCmdLine, int nCmdShow)
	{
    MessageBox( NULL,
                L"Welcome to Win32 Application Development\n"
                L"You will learn about functions, classes, "
                L"communication, and other cool stuff\n"
                L"Are you ready to rumble!!!!!!!!!!!!!!",
                Caption,
                MB_YESNOCANCEL | MB_ICONQUESTION);
	}
    return 0;
}
Delete lines 2, 3, and 4. In windows, WinMain() takes the place of main().

Lines 5 and 6 can be moved within the WinMain method, not required to be that way though.

Line 14 is a statement phrased as a question.

Move line 18 within the WinMain block.

Delete line 19.

Here is my solution:

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
#include <windows.h>

INT WINAPI WinMain(HINSTANCE hInstance, HINSTANCE hPrevInstance, LPSTR lpCmdLine, int nCmdShow)
{
	int choice;
	LPCTSTR Caption = L"Application Programming Interface";
	MessageBox( NULL,
		L"Welcome to Win32 Application Development\n"
		L"You will learn about functions, classes, "
		L"communication, and other cool stuff\n"
		L"Are you ready to rumble?!?!?!?!??!!?!?!?",
		Caption,
		MB_YESNOCANCEL | MB_ICONQUESTION);
	return 0;
}
Last edited on
Topic archived. No new replies allowed.