473,387 Members | 1,863 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,387 software developers and data experts.

DirectX Window error

Greetings dear forum!

I am currently trying to learn some directX programming and thus I am following this tutorial I found. After completing the first stage I should be able to get a blue window when I run the program, but instead I get no less then 103 Errors. After looking through the code and searching on the web for awhile I decided to ask if anyone her could enlighten me of what I've done so terribly wrong.

Here is my code:


Expand|Select|Wrap|Line Numbers
  1.    #include <windows.h>
  2.     #include <d3d9.h>
  3.  
  4.  
  5.  
  6.     // globals
  7.     LPDIRECT3D9       g_pDirect3D = NULL;
  8.     LPDIRECT3DDEVICE9 g_pDirect3D_Device = NULL;
  9.  
  10.  
  11.  
  12.     LRESULT WINAPI WndProc(HWND hwnd, UINT msg, WPARAM wParam, LPARAM lParam);
  13.  
  14.  
  15.  
  16.     int WINAPI WinMain(HINSTANCE hInstance, HINSTANCE hPrevInst, LPSTR lpCmdLine, int nShow)
  17.     {
  18.        MSG msg;
  19.  
  20.  
  21.        WNDCLASSEX wc = {sizeof(WNDCLASSEX), CS_VREDRAW|CS_HREDRAW|CS_OWNDC,
  22.                         WndProc, 0, 0, hInstance, NULL, NULL, (HBRUSH)(COLOR_WINDOW+1),
  23.                         NULL, "DX9_TUTORIAL1_CLASS", NULL};
  24.  
  25.        RegisterClassEx(&wc);
  26.  
  27.        HWND hMainWnd = CreateWindow("DX9_TUTORIAL1_CLASS",
  28.  
  29.                                     "DirectX 9 Bare Bones Tutorial 1",
  30.                                     WS_OVERLAPPEDWINDOW, 100, 100, 300, 300,
  31.  
  32.                                     NULL, NULL, hInstance, NULL);
  33.            g_pDirect3D = Direct3DCreate9(D3D_SDK_VERSION);
  34.  
  35.     D3DPRESENT_PARAMETERS PresentParams;
  36.     memset(&PresentParams, 0, sizeof(D3DPRESENT_PARAMETERS));
  37.  
  38.     PresentParams.Windowed = TRUE;
  39.     PresentParams.SwapEffect = D3DSWAPEFFECT_DISCARD;
  40.  
  41.     g_pDirect3D->CreateDevice(D3DADAPTER_DEFAULT, D3DDEVTYPE_HAL, hMainWnd,
  42.  
  43.                               D3DCREATE_SOFTWARE_VERTEXPROCESSING, &PresentParams,
  44.  
  45.                               &g_pDirect3D_Device);
  46.  
  47.        ShowWindow(hMainWnd, nShow);
  48.        UpdateWindow(hMainWnd);
  49.  
  50.        while(GetMessage(&msg, NULL, 0, 0))
  51.        {
  52.           TranslateMessage(&msg);
  53.           DispatchMessage(&msg);
  54.        }
  55.  
  56.        g_pDirect3D_Device->Release();
  57.        g_pDirect3D->Release();
  58.        return(0);
  59.     }
  60.  
  61.  
  62.  
  63.     LRESULT WINAPI WndProc(HWND hwnd, UINT msg, WPARAM wParam, LPARAM lParam)
  64.     {
  65.      switch(msg)
  66. {
  67.    case WM_DESTROY:
  68.       PostQuitMessage(0);
  69.       return(0);
  70.    case WM_PAINT: // <— ADD THIS BLOCK
  71.           g_pDirect3D_Device->Clear(0, NULL, D3DCLEAR_TARGET, D3DCOLOR_XRGB(0, 0, 255),
  72.  
  73.                               1.0f, 0);
  74.     g_pDirect3D_Device->Present(NULL, NULL, NULL, NULL);
  75.  
  76.       ValidateRect(hwnd, NULL);
  77.       return(0);
  78. }
  79.        return(DefWindowProc(hwnd, msg, wParam, lParam));
  80.     }
  81.  
And the errors:

Expand|Select|Wrap|Line Numbers
  1. Error    1    error C2061: syntax error : identifier '__RPC__out_xcount_part'    c:\program files (x86)\microsoft sdks\windows\v7.0a\include\objidl.h    11280    1    StartHere
  2. Error    2    error C2059: syntax error : ')'    c:\program files (x86)\microsoft sdks\windows\v7.0a\include\objidl.h    11281    1    StartHere
  3. Error    3    error C1903: unable to recover from previous error(s); stopping compilation    c:\program files (x86)\microsoft sdks\windows\v7.0a\include\objidl.h    11281    1    StartHere
  4.     4    IntelliSense: type name is not allowed    c:\program files (x86)\microsoft sdks\windows\v7.0a\include\oleidl.h    3777    64    
  5.     5    IntelliSense: expected an expression    c:\program files (x86)\microsoft sdks\windows\v7.0a\include\oleidl.h    3777    79    
  6.     6    IntelliSense: type name is not allowed    c:\program files (x86)\microsoft sdks\windows\v7.0a\include\oleidl.h    3778    64    
  7.     7    IntelliSense: expected an expression    c:\program files (x86)\microsoft sdks\windows\v7.0a\include\oleidl.h    3778    79    
  8.     8    IntelliSense: type name is not allowed    c:\program files (x86)\microsoft sdks\windows\v7.0a\include\oleidl.h    3782    60    
  9.     9    IntelliSense: expected an expression    c:\program files (x86)\microsoft sdks\windows\v7.0a\include\oleidl.h    3782    75    
  10.     10    IntelliSense: type name is not allowed    c:\program files (x86)\microsoft sdks\windows\v7.0a\include\oleidl.h    3783    60    
  11.     11    IntelliSense: expected an expression    c:\program files (x86)\microsoft sdks\windows\v7.0a\include\oleidl.h    3783    75    
  12.     12    IntelliSense: type name is not allowed    c:\program files (x86)\microsoft sdks\windows\v7.0a\include\oleidl.h    3787    57    
  13.     13    IntelliSense: expected an expression    c:\program files (x86)\microsoft sdks\windows\v7.0a\include\oleidl.h    3787    72    
  14.     14    IntelliSense: type name is not allowed    c:\program files (x86)\microsoft sdks\windows\v7.0a\include\oleidl.h    3788    57    
  15.     15    IntelliSense: expected an expression    c:\program files (x86)\microsoft sdks\windows\v7.0a\include\oleidl.h    3788    72    
  16.     16    IntelliSense: type name is not allowed    c:\program files (x86)\microsoft sdks\windows\v7.0a\include\oleidl.h    3792    61    
  17.     17    IntelliSense: expected an expression    c:\program files (x86)\microsoft sdks\windows\v7.0a\include\oleidl.h    3792    76    
  18.     18    IntelliSense: type name is not allowed    c:\program files (x86)\microsoft sdks\windows\v7.0a\include\oleidl.h    3793    61    
  19.     19    IntelliSense: expected an expression    c:\program files (x86)\microsoft sdks\windows\v7.0a\include\oleidl.h    3793    76    
  20.     20    IntelliSense: type name is not allowed    c:\program files (x86)\microsoft sdks\windows\v7.0a\include\oleidl.h    3797    59    
  21.     21    IntelliSense: expected an expression    c:\program files (x86)\microsoft sdks\windows\v7.0a\include\oleidl.h    3797    74    
  22.     22    IntelliSense: type name is not allowed    c:\program files (x86)\microsoft sdks\windows\v7.0a\include\oleidl.h    3798    59    
  23.     23    IntelliSense: expected an expression    c:\program files (x86)\microsoft sdks\windows\v7.0a\include\oleidl.h    3798    74    
  24.     24    IntelliSense: type name is not allowed    c:\program files (x86)\microsoft sdks\windows\v7.0a\include\oleidl.h    3802    58    
  25.     25    IntelliSense: expected an expression    c:\program files (x86)\microsoft sdks\windows\v7.0a\include\oleidl.h    3802    73    
  26.     26    IntelliSense: type name is not allowed    c:\program files (x86)\microsoft sdks\windows\v7.0a\include\oleidl.h    3803    58    
  27.     27    IntelliSense: expected an expression    c:\program files (x86)\microsoft sdks\windows\v7.0a\include\oleidl.h    3803    73    
  28.     28    IntelliSense: type name is not allowed    c:\program files (x86)\microsoft sdks\windows\v7.0a\include\oleidl.h    3807    63    
  29.     29    IntelliSense: expected an expression    c:\program files (x86)\microsoft sdks\windows\v7.0a\include\oleidl.h    3807    78    
  30.     30    IntelliSense: type name is not allowed    c:\program files (x86)\microsoft sdks\windows\v7.0a\include\oleidl.h    3808    63    
  31.     31    IntelliSense: expected an expression    c:\program files (x86)\microsoft sdks\windows\v7.0a\include\oleidl.h    3808    78    
  32.     32    IntelliSense: type name is not allowed    c:\program files (x86)\microsoft sdks\windows\v7.0a\include\oleidl.h    3812    66    
  33.     33    IntelliSense: expected an expression    c:\program files (x86)\microsoft sdks\windows\v7.0a\include\oleidl.h    3812    81    
  34.     34    IntelliSense: type name is not allowed    c:\program files (x86)\microsoft sdks\windows\v7.0a\include\oleidl.h    3813    66    
  35.     35    IntelliSense: expected an expression    c:\program files (x86)\microsoft sdks\windows\v7.0a\include\oleidl.h    3813    81    
  36.     36    IntelliSense: type name is not allowed    c:\program files (x86)\microsoft sdks\windows\v7.0a\include\oleidl.h    3817    62    
  37.     37    IntelliSense: expected an expression    c:\program files (x86)\microsoft sdks\windows\v7.0a\include\oleidl.h    3817    77    
  38.     38    IntelliSense: type name is not allowed    c:\program files (x86)\microsoft sdks\windows\v7.0a\include\oleidl.h    3818    62    
  39.     39    IntelliSense: expected an expression    c:\program files (x86)\microsoft sdks\windows\v7.0a\include\oleidl.h    3818    77    
  40.     40    IntelliSense: type name is not allowed    c:\program files (x86)\microsoft sdks\windows\v7.0a\include\oleidl.h    3822    59    
  41.     41    IntelliSense: expected an expression    c:\program files (x86)\microsoft sdks\windows\v7.0a\include\oleidl.h    3822    74    
  42.     42    IntelliSense: type name is not allowed    c:\program files (x86)\microsoft sdks\windows\v7.0a\include\oleidl.h    3823    59    
  43.     43    IntelliSense: expected an expression    c:\program files (x86)\microsoft sdks\windows\v7.0a\include\oleidl.h    3823    74    
  44.     44    IntelliSense: type name is not allowed    c:\program files (x86)\microsoft sdks\windows\v7.0a\include\oleidl.h    3827    63    
  45.     45    IntelliSense: expected an expression    c:\program files (x86)\microsoft sdks\windows\v7.0a\include\oleidl.h    3827    78    
  46.     46    IntelliSense: type name is not allowed    c:\program files (x86)\microsoft sdks\windows\v7.0a\include\oleidl.h    3828    63    
  47.     47    IntelliSense: expected an expression    c:\program files (x86)\microsoft sdks\windows\v7.0a\include\oleidl.h    3828    78    
  48.     48    IntelliSense: type name is not allowed    c:\program files (x86)\microsoft sdks\windows\v7.0a\include\oleidl.h    3832    61    
  49.     49    IntelliSense: expected an expression    c:\program files (x86)\microsoft sdks\windows\v7.0a\include\oleidl.h    3832    76    
  50.     50    IntelliSense: type name is not allowed    c:\program files (x86)\microsoft sdks\windows\v7.0a\include\oleidl.h    3833    61    
  51.     51    IntelliSense: expected an expression    c:\program files (x86)\microsoft sdks\windows\v7.0a\include\oleidl.h    3833    76    
  52.     52    IntelliSense: type name is not allowed    c:\program files (x86)\microsoft sdks\windows\v7.0a\include\oleidl.h    3837    60    
  53.     53    IntelliSense: expected an expression    c:\program files (x86)\microsoft sdks\windows\v7.0a\include\oleidl.h    3837    75    
  54.     54    IntelliSense: type name is not allowed    c:\program files (x86)\microsoft sdks\windows\v7.0a\include\oleidl.h    3838    60    
  55.     55    IntelliSense: expected an expression    c:\program files (x86)\microsoft sdks\windows\v7.0a\include\oleidl.h    3838    75    
  56.     56    IntelliSense: type name is not allowed    c:\program files (x86)\microsoft sdks\windows\v7.0a\include\oleidl.h    3842    65    
  57.     57    IntelliSense: expected an expression    c:\program files (x86)\microsoft sdks\windows\v7.0a\include\oleidl.h    3842    80    
  58.     58    IntelliSense: type name is not allowed    c:\program files (x86)\microsoft sdks\windows\v7.0a\include\oleidl.h    3843    65    
  59.     59    IntelliSense: expected an expression    c:\program files (x86)\microsoft sdks\windows\v7.0a\include\oleidl.h    3843    80    
  60.     60    IntelliSense: identifier "__RPC__in_range" is undefined    c:\program files (x86)\microsoft sdks\windows\v7.0a\include\oaidl.h    2134    31    
  61.     61    IntelliSense: expected a ')'    c:\program files (x86)\microsoft sdks\windows\v7.0a\include\oaidl.h    2134    47    
  62.     62    IntelliSense: expected a type specifier    c:\program files (x86)\microsoft sdks\windows\v7.0a\include\oaidl.h    2134    49    
  63.     63    IntelliSense: expected a ';'    c:\program files (x86)\microsoft sdks\windows\v7.0a\include\oaidl.h    2134    56    
  64.     64    IntelliSense: type name is not allowed    c:\program files (x86)\microsoft sdks\windows\v7.0a\include\oaidl.h    5185    58    
  65.     65    IntelliSense: expected an expression    c:\program files (x86)\microsoft sdks\windows\v7.0a\include\oaidl.h    5185    73    
  66.     66    IntelliSense: type name is not allowed    c:\program files (x86)\microsoft sdks\windows\v7.0a\include\oaidl.h    5186    58    
  67.     67    IntelliSense: expected an expression    c:\program files (x86)\microsoft sdks\windows\v7.0a\include\oaidl.h    5186    73    
  68.     68    IntelliSense: type name is not allowed    c:\program files (x86)\microsoft sdks\windows\v7.0a\include\oaidl.h    5190    71    
  69.     69    IntelliSense: expected an expression    c:\program files (x86)\microsoft sdks\windows\v7.0a\include\oaidl.h    5190    86    
  70.     70    IntelliSense: type name is not allowed    c:\program files (x86)\microsoft sdks\windows\v7.0a\include\oaidl.h    5191    71    
  71.     71    IntelliSense: expected an expression    c:\program files (x86)\microsoft sdks\windows\v7.0a\include\oaidl.h    5191    86    
  72.     72    IntelliSense: type name is not allowed    c:\program files (x86)\microsoft sdks\windows\v7.0a\include\oaidl.h    5195    61    
  73.     73    IntelliSense: expected an expression    c:\program files (x86)\microsoft sdks\windows\v7.0a\include\oaidl.h    5195    76    
  74.     74    IntelliSense: type name is not allowed    c:\program files (x86)\microsoft sdks\windows\v7.0a\include\oaidl.h    5196    61    
  75.     75    IntelliSense: expected an expression    c:\program files (x86)\microsoft sdks\windows\v7.0a\include\oaidl.h    5196    76    
  76.     76    IntelliSense: type name is not allowed    c:\program files (x86)\microsoft sdks\windows\v7.0a\include\oaidl.h    5200    60    
  77.     77    IntelliSense: expected an expression    c:\program files (x86)\microsoft sdks\windows\v7.0a\include\oaidl.h    5200    75    
  78.     78    IntelliSense: type name is not allowed    c:\program files (x86)\microsoft sdks\windows\v7.0a\include\oaidl.h    5201    60    
  79.     79    IntelliSense: expected an expression    c:\program files (x86)\microsoft sdks\windows\v7.0a\include\oaidl.h    5201    75    
  80.     80    IntelliSense: type name is not allowed    c:\program files (x86)\microsoft sdks\windows\v7.0a\include\oaidl.h    5205    73    
  81.     81    IntelliSense: expected an expression    c:\program files (x86)\microsoft sdks\windows\v7.0a\include\oaidl.h    5205    88    
  82.     82    IntelliSense: type name is not allowed    c:\program files (x86)\microsoft sdks\windows\v7.0a\include\oaidl.h    5206    73    
  83.     83    IntelliSense: expected an expression    c:\program files (x86)\microsoft sdks\windows\v7.0a\include\oaidl.h    5206    88    
  84.     84    IntelliSense: type name is not allowed    c:\program files (x86)\microsoft sdks\windows\v7.0a\include\oaidl.h    5210    63    
  85.     85    IntelliSense: expected an expression    c:\program files (x86)\microsoft sdks\windows\v7.0a\include\oaidl.h    5210    78    
  86.     86    IntelliSense: type name is not allowed    c:\program files (x86)\microsoft sdks\windows\v7.0a\include\oaidl.h    5211    63    
  87.     87    IntelliSense: expected an expression    c:\program files (x86)\microsoft sdks\windows\v7.0a\include\oaidl.h    5211    78    
  88.     88    IntelliSense: type name is not allowed    c:\program files (x86)\microsoft sdks\windows\v7.0a\include\urlmon.h    9372    58    
  89.     89    IntelliSense: expected an expression    c:\program files (x86)\microsoft sdks\windows\v7.0a\include\urlmon.h    9372    73    
  90.     90    IntelliSense: type name is not allowed    c:\program files (x86)\microsoft sdks\windows\v7.0a\include\urlmon.h    9373    58    
  91.     91    IntelliSense: expected an expression    c:\program files (x86)\microsoft sdks\windows\v7.0a\include\urlmon.h    9373    73    
  92.     92    IntelliSense: type name is not allowed    c:\program files (x86)\microsoft sdks\windows\v7.0a\include\urlmon.h    9377    58    
  93.     93    IntelliSense: expected an expression    c:\program files (x86)\microsoft sdks\windows\v7.0a\include\urlmon.h    9377    73    
  94.     94    IntelliSense: type name is not allowed    c:\program files (x86)\microsoft sdks\windows\v7.0a\include\urlmon.h    9378    58    
  95.     95    IntelliSense: expected an expression    c:\program files (x86)\microsoft sdks\windows\v7.0a\include\urlmon.h    9378    73    
  96.     96    IntelliSense: type name is not allowed    c:\program files (x86)\microsoft sdks\windows\v7.0a\include\urlmon.h    9382    60    
  97.     97    IntelliSense: expected an expression    c:\program files (x86)\microsoft sdks\windows\v7.0a\include\urlmon.h    9382    75    
  98.     98    IntelliSense: type name is not allowed    c:\program files (x86)\microsoft sdks\windows\v7.0a\include\urlmon.h    9383    60    
  99.     99    IntelliSense: expected an expression    c:\program files (x86)\microsoft sdks\windows\v7.0a\include\urlmon.h    9383    75    
  100.     100    IntelliSense: type name is not allowed    c:\program files (x86)\microsoft sdks\windows\v7.0a\include\urlmon.h    9387    60    
  101.     101    IntelliSense: expected an expression    c:\program files (x86)\microsoft sdks\windows\v7.0a\include\urlmon.h    9387    75    
  102.     102    IntelliSense: type name is not allowed    c:\program files (x86)\microsoft sdks\windows\v7.0a\include\urlmon.h    9388    60    
  103.     103    IntelliSense: expected an expression    c:\program files (x86)\microsoft sdks\windows\v7.0a\include\urlmon.h    9388    75    
  104.  
Thanks for any help! And sorry about the mess...
Jul 26 '10 #1
2 6897
weaknessforcats
9,208 Expert Mod 8TB
You should also include an stdafx.h.

This has various #defines needed to make your build. Either include the file ofr code the defines in every file you compile.

Are you using Visual Studio.NET? If so, did you create a Win32 project?
Jul 27 '10 #2
The problem was that I had DirectX SDK 2007 installed which is not compatible with VS 2010. I installed a newer version and all is fine. Thank you for your help nevertheless.
Jul 27 '10 #3

Sign in to post your reply or Sign up for a free account.

Similar topics

0
by: Dave Boal | last post by:
There are a couple of common tasks I would like to perform in the cmd window. When I try, I receive error messages. Could you explain why I am getting the following error messages, or suggest a...
0
by: Job Lot | last post by:
When an invalid property value is provided in designer, an error message box popup which provide error description on clicking Details button. How can I display custom error message on click of...
3
by: dricks dr | last post by:
Hi, I'm using the AxWebBrowser Control from microsoft in a C# application. It works fine, but i have many problems to hide the javascript error windows that appear when u visit a website with......
2
by: JT | last post by:
Hi, Is there an example available online of a C# direct3d application being loaded inside a web page? I just read up a bit about web forms, and that doesn't seem like the way to do it... ...
0
by: YiFai | last post by:
Hello, I'm currently writing a directx program with C++, but it takes a while to load the files necessary for the directx. When the directx window loads, it can quit the program with the...
4
by: Csaba Gabor | last post by:
Up until a few weeks ago, javascript code like window.open("http://mydomain.com", "windowName"); would always bring my new or reused window to the top, with focus. Lately, Firefox (Deer park...
4
by: Daniel | last post by:
Hey guys Anyone know if it is possible to add a button at design time and place it over the top of a directx window? For example checkboxes, standard buttons, menus etc? If so how?
2
by: jr | last post by:
Hello everyone! I am new to this sort of postings so I'm not even sure if this is the correct place to start. Anyway, I would realy appreciate any help. I have a some VBA code that works quite...
3
by: Reedsp | last post by:
I am using Access 2007. In Access 2003, when you had the import window opened and clicked on the Cancel button, MS displayed an error message. To compensate for this using VB code, I used the "On...
6
by: WillByteAccess | last post by:
I a webpage on which most links open in the same window, but one will opens in a new window. If I click the link which opens in a new window ALL other links from the original page will then open...
0
by: Charles Arthur | last post by:
How do i turn on java script on a villaon, callus and itel keypad mobile phone
0
by: ryjfgjl | last post by:
If we have dozens or hundreds of excel to import into the database, if we use the excel import function provided by database editors such as navicat, it will be extremely tedious and time-consuming...
0
by: ryjfgjl | last post by:
In our work, we often receive Excel tables with data in the same format. If we want to analyze these data, it can be difficult to analyze them because the data is spread across multiple Excel files...
0
BarryA
by: BarryA | last post by:
What are the essential steps and strategies outlined in the Data Structures and Algorithms (DSA) roadmap for aspiring data scientists? How can individuals effectively utilize this roadmap to progress...
1
by: nemocccc | last post by:
hello, everyone, I want to develop a software for my android phone for daily needs, any suggestions?
0
by: Hystou | last post by:
There are some requirements for setting up RAID: 1. The motherboard and BIOS support RAID configuration. 2. The motherboard has 2 or more available SATA protocol SSD/HDD slots (including MSATA, M.2...
0
by: Hystou | last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can...
0
Oralloy
by: Oralloy | last post by:
Hello folks, I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>". The problem is that using the GNU compilers,...
0
jinu1996
by: jinu1996 | last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.