Jump to content
  • Advertisement

Archived

This topic is now archived and is closed to further replies.

OoMMMoO

newbie directx question

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

If you intended to correct an error in the post then please contact us.

Recommended Posts

Im pretty new to this so please dont laugh at my questions 1.I am using mvc++ and have set the options to look in the directx lib folder for everything and when I try and compile a direct draw program it says c:\program files\microsoft visual studio\myprojects\test\main.cpp(23) : fatal error C1010: unexpected end of file while looking for precompiled header directive can anyone help? 2. Also does anyone know of a good directx tutorial with using c++? And is this code right for initializing it? LPDIRECTDRAW lpdd; bool DirectDrawInit(HWND hwnd) { HRESULT ddrval; ddrval=DirectDrawCreate(NULL,&lpdd,NULL); ddrval=lpdd->SetCooperativeLevel(hwnd,DDSCL_EXCLUSIVE / DDSCL_FULLSCREEN); if(ddrval!=DD_OK) { lpdd->release(); return(false); } return (true); } When I want to use the function what do i put in for HWND hwnd in DirectDrawinit()???? Thanks alot

Share this post


Link to post
Share on other sites
Advertisement

About the handle business. Create a global handled.

HWND Global_Window_Handle = NULL;

The after you have create your window like so....

if(!(hwnd = CreateWindowEx( Your window details here)))
return(0);

save your handle in the global handle that you created ealier like so...

Global_Window_Handle = hwnd;


then when you make the function call do this

DirectDrawInit(Global_Window_Handle);

if you are using multiple source files. I made this mistake before so that you don''t make it I will tell you.

In the header file that you use make sure you make the (Global_Window_Handle) a external like so...

extern HWND Global_Window_Handle = NULL;

About you linking error.

Make sure you have the directx library and header folders scanned first before anything else

Share this post


Link to post
Share on other sites

TOOLS/OPTIONS/DIRECTORIES and then make sure the directx lib, and header folders are at the top of the lists.

Also make sure that your "Show Directory" option is under include files for headers files and library files for lib.

Share this post


Link to post
Share on other sites

  • Advertisement
×

Important Information

By using GameDev.net, you agree to our community Guidelines, Terms of Use, and Privacy Policy.

GameDev.net is your game development community. Create an account for your GameDev Portfolio and participate in the largest developer community in the games industry.

Sign me up!