DirectX9 - newbie question

Started by
5 comments, last by zip7000 20 years, 11 months ago
hi, I would like to create an application from directX9 appwizard. So I select directX9 appwizard and a program is generated showing a red triangle. It works fine. Then I create a class called CForm. My problem comes up when I want to add the following function in CForm: HRESULT RestoreDeviceObject(); I receive the following error
  
:\programmation\bouquin\FirstAppD9\Form.cpp(21) : error C2143: syntax error : missing '';'' before ''tag::id''
G:\programmation\bouquin\FirstAppD9\Form.cpp(21) : error C2501: ''HRESULT'' : missing storage-class or type specifiers
G:\programmation\bouquin\FirstAppD9\Form.cpp(21) : fatal error C1004: unexpected end of file found
Error executing cl.exe.
  
I guess the problem comes from the HRESULT type because when I change it into int type it compiles. more generally, should I include something in the CForm class? thank you for any help ypu can give!!
Advertisement
actually, here the right error message :


  :\programmation\bouquin\firstappd9\form.h(15) : error C2146: syntax error : missing '';'' before identifier ''RstoreDeviceObject''g:\programmation\bouquin\firstappd9\form.h(15) : error C2501: ''HRESULT'' : missing storage-class or type specifiersg:\programmation\bouquin\firstappd9\form.cpp(21) : error C2143: syntax error : missing '';'' before ''tag::id''g:\programmation\bouquin\firstappd9\form.cpp(21) : error C2501: ''HRESULT'' : missing storage-class or type specifiersg:\programmation\bouquin\firstappd9\form.cpp(21) : fatal error C1004: unexpected end of file foundError executing cl.exe.FirstAppD9.exe - 5 error(s), 0 warning(s)  
I found!!!

I put #include stdAfx.h in CForm header file. However I don''t understand wery well what was the problem. I guess HRESULT definition is somewhere in this stdAfx.h
If someone knows exactly where I apreciate to know it!!
What is this file?
Is it necessary each time?


thank you!
I think ''RstoreDeviceObject'' must have been in a header which was included in stdafx.h or it was declared in that header.
I think that HRESULT is in the stdafx.h not RestoreDeviceObject
Hi there

HRESULT is a Windows-specific type that microsoft guys use to return a result. It is defined as:
typedef LONG HRESULT
so its only a simple 32 bits value.
You can find its definition in **many** MS files, for instance in

The header that you mentionned is a file that includes all the defitions you need to program with Windows and MFC. [If you only want to use Windows (without MFC), replace #include <stdafx.h> by #include <windows.h>.] This file is generated automatically by the framework, so its part of your project, not Windows source. But it includes all you need in Windows source (afxwin.h, afxcore.h, and so on). Afx is the technical prefix for every thing that is part of MFC.

To conclude, you need to include in every file of your project, otherwise you wont be able to use any windows function.

see ya
thank you very much!!

This topic is closed to new replies.

Advertisement