I was creating a basic window, and when I tried to compile it I got these errors
Code:
c:\program files (x86)\microsoft sdks\windows\v7.0a\include\objidl.h(11280): error C2061: syntax error : identifier '__RPC__out_xcount_part'
c:\program files (x86)\microsoft sdks\windows\v7.0a\include\objidl.h(11281): error C2059: syntax error : ')'
c:\program files (x86)\microsoft sdks\windows\v7.0a\include\objidl.h(11281): fatal error C1903: unable to recover from previous error(s); stopping compilation
Here is my code
Code:
//Include the windows header files
#include <Windows.h>
HINSTANCE hInst;
HWND wndHandle;
int width = 640;
int Height = 480;
//Forward declerations
bool InitWindow(HINSTANCE hInstance, int width, int height);
LRESULT CALLBACK WndProc(HWND, UINT, WPARAM, LPARAM);
int APIENTRY WinMain(HINSTANCE hInstance, HINSTANCE hPrevInstance, LPSTR lpCmdLine, int nCmdShow)
{
//Initialize the window
if(!InitWindow)
return false;
//Main message loop
MSG msg = {0};
while(msg.message != WM_QUIT)
{
while(PeekMessage(&msg, wndHandle, 0, 0, PM_REMOVE))
{
TranslateMessage(&msg);
DispatchMessage(&msg);
}
//Aditional game logic can go here
}
return msg.message;
}
//InitWindow
bool InitWindow(HINSTANCE hInstance, int width, int height)
{
WNDCLASSEX wcex;
wcex.cbSize = sizeof(WNDCLASSEX);
wcex.style = CS_HREDRAW | CS_VREDRAW;
wcex.lpfnWndProc = WndProc;
wcex.cbClsExtra = 0;
wcex.cbWndExtra = 0;
wcex.hInstance = hInstance;
wcex.hIcon = 0;
wcex.hCursor = LoadCursor(hInstance, IDC_ARROW);
wcex.hbrBackground = (HBRUSH)(COLOR_WINDOW+1);
wcex.lpszMenuName = NULL;
wcex.lpszClassName = TEXT("DirectXExample");
wcex.hIconSm = 0;
RegisterClass(&wcex);
//Resize the window
RECT rect = {0, 0, width, height};
AdjustWindowRect(&rect, WS_OVERLAPPEDWINDOW, FALSE);
//Creaete the window from the class above
wndHandle = CreateWindow(TEXT("DirectXExample"), TEXT("DirectXExample"), WS_OVERLAPPEDWINDOW, CW_USEDEFAULT, CW_USEDEFAULT, rect.right - rect.left,
rect.bottom - rect.top, NULL, NULL, hInstance, NULL);
if(!wndHandle)
return false;
//Display the window on the screen
ShowWindow(wndHandle, SW_SHOW);
UpdateWindow(wndHandle);
return true;
}
LRESULT CALLBACK WndProc(HWND hWnd, UINT message, WPARAM wParam, LPARAM lParam)
{
//Check the message queue
switch(message)
{
case WM_KEYDOWN:
switch(wParam)
{
//Check if the user hit the Escape Key
case VK_ESCAPE:
PostQuitMessage(0);
break;
}
break;
//The user hit the close button, close the application
case WM_DESTROY:
PostQuitMessage(0);
break;
}
//Always return the message to the default window procedure for further processing
return DefWindowProc(hWnd, message, wParam, lParam);
}
Thank you in advance.