ich habe mir ein C++ buch gekauft für Directx11 und hatte vorher einstieg mit der Consolenprogrammierung und habe nur Grundkentnise in c++ lese und mache gerade das Buch doch ich kriege immer diesen Error:
Code:
1>------ Build started: Project: DirectX11 test, Configuration: Debug Win32 ------ 1> Source.cpp 1>c:\users\finn\documents\visual studio 2012\projects\directx11 test\directx11 test\source.cpp(23): error C2440: 'initializing' : cannot convert from 'int' to 'RECT' 1> No constructor could take the source type, or constructor overload resolution was ambiguous ========== Build: 0 succeeded, 1 failed, 0 up-to-date, 0 skipped ==========
Code:
#include <windows.h>
LRESULT CALLBACK WndProc(HWND hwnd,UINT message,WPARAM wParam,LPARAM lParam);
int WINAPI wWinMain(HINSTANCE hInstance,HINSTANCE prevInstance,LPWSTR cmdLine,int cmdShow)
{
UNREFERENCED_PARAMETER(prevInstance);
UNREFERENCED_PARAMETER(cmdLine);
WNDCLASSEX wndClass={0};
wndClass.cbSize=sizeof(WNDCLASSEX);
wndClass.style=CS_HREDRAW|CS_VREDRAW;
wndClass.lpfnWndProc=WndProc;
wndClass.hInstance=hInstance;
wndClass.hCursor=LoadCursor(NULL,IDC_ARROW);
wndClass.hbrBackground=(HBRUSH)(COLOR_WINDOW+1);
wndClass.lpszMenuName=NULL;
wndClass.lpszClassName;
if( !RegisterClassEx( &wndClass))
return -1;
RECT rc=(0,0,640,480); //hier kommt der fehler bei der (
AdjustWindowRect( &rc,WS_OVERLAPPEDWINDOW,FALSE);
HWND hwnd=CreateWindowA("Directx11 versuche","Direct X11",WS_OVERLAPPEDWINDOW,CW_USEDEFAULT,CW_USEDEFAULT,rc.right-rc.left,rc.bottom-rc.top,NULL,NULL,hInstance,NULL);
if( !hwnd)
return -1;
ShowWindow(hwnd,cmdShow);
MSG msg= {0};
while(msg.message!=WM_QUIT)
{
if(PeekMessage( &msg,0,0,0,PM_REMOVE))
{
TranslateMessage( &msg);
DispatchMessage( &msg);
}
}
return static_cast<int>(msg.wParam);
}
LRESULT CALLBACK WndProc(HWND hwnd,UINT message,WPARAM wParam,LPARAM lParam)
{
PAINTSTRUCT paintStruct;
HDC hDC;
switch(message)
{
case WM_PAINT:
hDC=BeginPaint(hwnd, &paintStruct);
EndPaint(hwnd, &paintStruct);
break;
case WM_DESTROY:
PostQuitMessage(0);
break;
default:
return DefWindowProc(hwnd,message,wParam,lParam);
}
}






