• 12
• 12
• 9
• 10
• 13

# 2 errors in basic hello world in DirectX 9

This topic is 3838 days old which is more than the 365 day threshold we allow for new replies. Please post a new topic.

## Recommended Posts

// DIRECT X 9 TESTING.cpp : Defines the entry point for the console application.
//

#include "stdafx.h"
#include <windows.h>
#include <iostream>
using namespace std;

int WINAPI WinMain(HINSTANCE hInstance,
HINSTANCE hPrevInstance,
LPSTR lpCmdLine,
int nCmdShow)
{
MessageBox(NULL,
L"Hello World",
L"Just another hello world program",
MB_ICONEXCLAMATION | MB_OK);
return 0;
}


##### Share on other sites
It'd be handy if you posted the errors :)

##### Share on other sites
My guess is that you're not compiling for unicode, and so MessageBox isn't expecting wide strings.

Or, based on your comment, your compiling as a console app... which doesn't start with a WinMain like you have, but just a normal C style main: int main(int argc, char **argv)

##### Share on other sites
No.

Please show some inituitive in solving your problem before posting to these forums. We shouldn't be your first port of call whenever things don't work out perfectly. Try pressing "F1" on any compile errors to bring up their help page, copy-n-paste the message into a search engine... for runtime errors, do some basic debugging with breakpoints etc...

Once you've tried those sorts of things and if you still can't get it to work then you're more than welcome to post here and we'll see what we can do to help [smile]

Jack