#include<windows.h>
#include<windowsx.h>
#include<ddraw.h>
#include<d3d9.h>
HRESULT ddrval;
LPDIRECTDRAW7 lpdd = NULL;
HWND hwnd;
int APIENTRY WinMain(HINSTANCE hin, HINSTANCE hp, LPSTR lpCmd, int
CmdShow){
DirectDrawCreateEx(NULL, (void**) &lpdd, IID_IDirectDraw7, NULL);
ddrval = lpdd->SetCooperativeLevel( hwnd, DDSCL_ALLOWMODEX |
DDSCL_EXCLUSIVE | DDSCL_FULLSCREEN);
ddrval = lpdd->SetDisplayMode( 800,600,16,0,0);
lpdd->Release();
return 0;
}
And it seems to be same as the books but I am getting this error:
Compiling...
Main.cpp
Linking...
Main.obj : error LNK2001: unresolved external symbol _IID_IDirectDraw7
Debug/DDrawX.exe : fatal error LNK1120: 1 unresolved externals
Error executing link.exe.
DDrawX.exe - 2 error(s), 0 warning(s)
with
DirectDrawCreateEx(NULL, (void**) &lpdd, IID_IDirectDraw7, NULL);
Why am I getting this error?
Seem that you have forgot linking with dxguild.lib
Add following line to solve that error
#pragma comment(lib, "dxguid.lib")
Hieu Le
DDrawX.exe - 1 error(s), 0 warning(s)
-----Original Message-----
From: C-Game-Pr...@googlegroups.com
[mailto:C-Game-Pr...@googlegroups.com] On Behalf Of JoeC
Sent: Friday, January 06, 2006 10:53 AM
To: C++ Game Programming
I think your compiler is too old
http://forums.microsoft.com/MSDN/ShowPost.aspx?PostID=113325&SiteID=1