[Helpith]Trippy error

Posts 1–9 of 9 · Page 1 of 1
[Helpith]Trippy error
Code:
// nigga.cpp : Defines the entry point for the application.
//

#include "stdafx.h"
#include <Windows.h>

using namespace std;

int WINAPI _tWinMain(HINSTANCE hInstance,HINSTANCE hPrevInstance, LPTSTR lpCmdLine, int nCmdShow)
{
	MessageBox(NULL, "Sup Niggas!", "Note", MB_OK);
	return 0;
}
the error is for both of the strings in the MessageBox:

argument of type "const char *" is incompatible with parameter of type "LPCWSTR" 11

I don't see any parameters with that name... js .
Change the character set to multi-byte.

Project properties -> general -> character set.

Or use a LPCWSTR instead of a const char..
MessageBox comes in two flavors.... MessageBoxA and MessageBoxW, the A stands for ASCII and the W stand for wide-char or Unicode. Hold your mouse over the MessageBox function and Intellisense should display MessageBoxW, this is because based on the settings of the compiler it uses MessageBoxW by default. I figured it would be better if you learn this now since almost all Windows API functions come in these two flavors, ASCII supporting the English typeset and Unicode supporting an international typeset including english characters. So either change your compiler settings or Use the MessageBoxA since it will support cstrings a.k.a. ASCII strings a.k.a. char*
Quote Originally Posted by why06 View Post
MessageBox comes in two flavors.... MessageBoxA and MessageBoxW, the A stands for ASCII and the W stand for wide-char or Unicode. Hold your mouse over the MessageBox function and Intellisense should display MessageBoxW, this is because based on the settings of the compiler it uses MessageBoxW by default. I figured it would be better if you learn this now since almost all Windows API functions come in these two flavors, ASCII supporting the English typeset and Unicode supporting an international typeset including english characters. So either change your compiler settings or Use the MessageBoxA since it will support cstrings a.k.a. ASCII strings a.k.a. char*
Intellisense is broken 90% of the time. Stick with my fix. ;D

Naw I kid, this works too, but I ALWAYS call MessageBoxA, so yeah. \:
Quote Originally Posted by mookamoka3 View Post
Code:
// nigga.cpp : Defines the entry point for the application.
//

#include "stdafx.h"
#include <Windows.h>

using namespace std;

int WINAPI _tWinMain(HINSTANCE hInstance,HINSTANCE hPrevInstance, LPTSTR lpCmdLine, int nCmdShow)
{
	MessageBox(NULL, "Sup Niggas!", "Note", MB_OK);
	return 0;
}
the error is for both of the strings in the MessageBox:

argument of type "const char *" is incompatible with parameter of type "LPCWSTR" 11

I don't see any parameters with that name... js .
do this bro, and remember u using namespace std; with out the header file
#include <iostream> dont forget when ever u using namespace std; alway put this in


#include <iostream>
#include <Windows.h>

using namespace std;
int WINAPI WinMain(HINSTANCE hInstance,
HINSTANCE hPrvInstance,
LPSTR IpCmdLine,
int nShowCmd)
{
MessageBox(NULL, L"Sup Niggas!", L"Note", MB_OK);
return 0;
}
Quote Originally Posted by bkbatman View Post
do this bro, and remember u using namespace std; with out the header file
#include <iostream> dont forget when ever u using namespace std; alway put this in


#include <iostream>
#include <Windows.h>

using namespace std;
int WINAPI WinMain(HINSTANCE hInstance,
HINSTANCE hPrvInstance,
LPSTR IpCmdLine,
int nShowCmd)
{
MessageBox(NULL, L"Sup Niggas!", L"Note", MB_OK);
return 0;
}
The L macro works as well but I don't think you can use it with variables.
ss
Quote Originally Posted by Void View Post
The L macro works as well but I don't think you can use it with variables.
? just copy and paste it

he is trying to create a simple messagebox right then my code should work

well if u got something else in mind ,post it he will be thank full so let see what
what u have in my.
Quote Originally Posted by bkbatman View Post
? just copy and paste it

he is trying to create a simple messagebox right then my code should work

well if u got something else in mind ,post it he will be thank full so let see what
what u have in my.
He does not want to copy-paste, he wants to learn.
Quote Originally Posted by Void View Post
The L macro works as well but I don't think you can use it with variables.
There's other functions for that =p
Posts 1–9 of 9 · Page 1 of 1

Post a Reply

Tags for this Thread

None

Talk with us