Skip to main content
gamedev.net
🔒 Locked

Direct Draw...

Started by Laroche 2 replies 200+ views
Original Post
Laroche
Laroche
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?
Check out my music at: http://zed.cbc.ca/go.ZeD?user_id=41947&user=Laroche&page=content
kmsixpence
kmsixpence
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 errors

HRESULT hr;


hr=InitDirectDraw(hWndMain);
//do some tests with the returned value

Laroche
Laroche
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?
Check out my music at: http://zed.cbc.ca/go.ZeD?user_id=41947&user=Laroche&page=content
wazoo69
wazoo69
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 somewhere

HRESULT InitDirectDraw(HWND);

//then in the source file

HRESULT InitDirectDraw(HWND hWndMain){

HRESULT hr = S_OK;

//do directdraw stuff here..


return( hr );
}



hth

Topic Locked

This topic has been locked by a moderator. New replies are not allowed.

Sign in to reply to this topic.