# Visual Studi0 2005, DirectX and Message Boxes (Solved)

## Recommended Posts

So I've just got Visual Studio 2005 Std, and so I've also got a couple of problems. First, (I'm using C++) While trying to program with native Win32 in Visual Studio I get this error message with the MessageBox() function.
MessageBox(NULL, "Hello", "Title", MB_OK);

error C2664: 'MessageBoxW' : cannot convert parameter 2 from 'const char [6]' to 'LPCWSTR' Types pointed to are unrelated; conversion requires reinterpret_cast, C-style cast or function-style cast I've tried casting the parameters, it works, but the text in the message box is gibberish. Visual Studio also installed the PSDK while I was installing it off the disk...I think. My other problem is with DirectX 8.1. I've added the search directories for the libraries and headers in visual studio, but for some reason it won't work. I'm thinking that I might have to individually add the files I need into the project... Here's the code that won't compile.
LPDIRECTDRAW7 lpdd;
DirectDrawCreateEx(NULL, (void **)&lpdd, IID_IDirectDraw7, NULL);

error LNK2001: unresolved external symbol _DirectDrawCreateEx@16 error LNK2001: unresolved external symbol _IID_IDirectDraw7 In my code I also have #define DXGUID, so I think the problem is that I haven't specified all the import files I need. Any help is very much appreciated! Thanks! [Edited by - TaylorGJ on March 20, 2007 5:23:33 AM]

##### Share on other sites
I'm using 2003 so I hope this is still the same, but did you add the libraries in the project properties?

##### Share on other sites
Quote:
 Original post by CandleJackI'm using 2003 so I hope this is still the same, but did you add the libraries in the project properties?
It's not exactly the same, but it's very similar.

As for the first problem, go to project settings -> General (or something, the first page that opens by default) and change "Character Set" from "Unicode character set" to "Multi-Byte Character Set".

##### Share on other sites
Thanks a lot guys, it's working fine now [grin]

## Create an account

Register a new account

• ### Forum Statistics

• Total Topics
628400
• Total Posts
2982447

• 10
• 9
• 19
• 24
• 10