#### Archived

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

# Direct Draw...

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

## Recommended Posts

Ive made a function called: HRESULT InitDirectDraw(HWND hWnd); and its just a standard direct draw initialization function, but im having difficulty declaring it. The function itself is in DirectX.cpp, while the prototype declaration is in Windows.cpp. The problem is that it does not seem to recognize the function when i call it in Windows.cpp, just before the message loop. The line of code is simply: HRESULT InitDirectDraw(HWND hWnd); I get 3 error messages because of this. they are: syntax error : missing '';'' before identifier ''InitDirectDraw'' ''HRESULT'' : missing storage-class or type specifiers unexpected end of file found can anyone help me figure out what is wrong? am i declaring it wrong?

##### Share on other sites
it looks like ur calling it wrong. Is that 2nd line your call?
this is what it should be:
  /* this should bet a global and it should contain the HWND returned when you created the window */HWND hWndMain;//create a hresult to test for errorsHRESULT hr;hr=InitDirectDraw(hWndMain);//do some tests with the returned value

##### Share on other sites
Yes the second line is my call, forgot to mention that. I did your suggestion, but pardon me for being a newbie, but should i change the prototype as well? and what about the actual function itself? In the function i need the handle to the window to set the coopertive level. do i set this as hWndMain?

##### Share on other sites
No leave the prototype as is..it''s working fine.

To your second question, yes use the hwndMain window handle passed into your function as the window handle to use for your directdraw calls..

The actual function itself you''ve already written right??

  //declared in a header file somewhereHRESULT InitDirectDraw(HWND);//then in the source fileHRESULT InitDirectDraw(HWND hWndMain){ HRESULT hr = S_OK; //do directdraw stuff here.. return( hr );}

hth

1. 1
2. 2
3. 3
Rutin
18
4. 4
5. 5
JoeJ
13

• 14
• 10
• 23
• 9
• 56
• ### Forum Statistics

• Total Topics
632638
• Total Posts
3007599
• ### Who's Online (See full list)

There are no registered users currently online

×