Der sieht so aus:
Code: Alles auswählen
#include <windows.h>
#include <D3D9.h>
HWND hWnd;
LRESULT CALLBACK WindowProc (HWND hWnd, UINT message,
WPARAM wParam, LPARAM lParam);
int WINAPI WinMain (HINSTANCE hInst, HINSTANCE hPrevInst, LPSTR lpcmdline, int ncmdshow)
{
int Adapter, Mode;
//4. D3D_HARDWARE_VERTEXPROESSING
HRESULT hResult;
D3DPRESENT_PARAMETERS PresentParams;
WNDCLASSEX windowclass;
MSG message;
const char szClassName[] = "Wecker";
windowclass.cbSize = sizeof (WNDCLASSEX);
windowclass.style = CS_HREDRAW | CS_VREDRAW;
windowclass.lpfnWndProc = WindowProc;
windowclass.cbClsExtra = 0;
windowclass.cbWndExtra = 0;
windowclass.hInstance = hInst;
windowclass.hIcon =LoadIcon (NULL, IDI_APPLICATION);
windowclass.hIconSm =LoadIcon (NULL, IDI_APPLICATION);
windowclass.hCursor =LoadCursor (NULL, IDC_ARROW);
windowclass.hbrBackground = (HBRUSH)COLOR_BACKGROUND+1;
windowclass.lpszMenuName = NULL;
windowclass.lpszClassName = szClassName;
int Laenge = GetSystemMetrics(SM_CXSCREEN);//Größe des Bildschirms nach links(in Pixel)
int Breite = GetSystemMetrics(SM_CYSCREEN);//Größe des Bildschirms nach unten(in Pixel)
hWnd = CreateWindowEx(NULL,
szClassName,
"Rechner",
WS_OVERLAPPEDWINDOW | WS_VISIBLE,
0, 0,
Breite, Laenge,
NULL,
NULL,
hInst,
NULL);
if(!RegisterClassEx (&windowclass))
return (0);
if(hWnd == NULL)
return (0);
PDIRECT3D9 pD3D = Direct3DCreate9(D3D_SDK_VERSION);
if(!pD3D)
{
MessageBox(0,"Neu version INSTALLIEREN", "Fehler", MB_OK | MB_ICONEXCLAMATION);
}
int iNumAdapters = pD3D->GetAdapterCount();
D3DADAPTER_IDENTIFIER9*pAdapters=new D3DADAPTER_IDENTIFIER9[iNumAdapters];
for (int iAdapter=0;iAdapter<iNumAdapters; iAdapter++)
{
int iNumModes= pD3D->GetAdapterModeCount(iAdapter,D3DFMT_R5G6B5);
if(iNumModes>0)
{
D3DDISPLAYMODE* pModes = new D3DDISPLAYMODE[iNumModes];
char acModes[16384] = "";
for(int iMode=0;iMode<iNumModes; iMode++)
{
pD3D->EnumAdapterModes(iAdapter,D3DFMT_R5G6B5,iMode,&pModes[iMode]);
if(pModes[iMode].Width==Breite)
{
if(pModes[iMode].Height==Laenge)
{
Adapter=iAdapter;
Mode=iMode;
break;
}
}
}
}
}
ZeroMemory(&PresentParams,sizeof(D3DPRESENT_PARAMETERS));
PresentParams.BackBufferWidth =Breite;
PresentParams.BackBufferHeight =Laenge;
PresentParams.BackBufferFormat =D3DFMT_X8R8G8B8;
PresentParams.BackBufferCount =1;
PresentParams.MultiSampleType =D3DMULTISAMPLE_NONE;
//PresentParams.MultiSampleQuality
PresentParams.SwapEffect =D3DSWAPEFFECT_DISCARD;
PresentParams.hDeviceWindow =NULL;
PresentParams.Windowed =TRUE;
PresentParams.EnableAutoDepthStencil =TRUE;
PresentParams.AutoDepthStencilFormat =D3DFMT_D24S8;
PresentParams.Flags =D3DPRESENTFLAG_LOCKABLE_BACKBUFFER;
PresentParams.FullScreen_RefreshRateInHz =D3DPRESENT_RATE_DEFAULT;
PresentParams.PresentationInterval =D3DPRESENT_INTERVAL_DEFAULT;
IDirect3D9::CreateDevice(Adapter, D3DDEVTYPE_HAL, hWnd, D3DCREATE_HARDWARE_VERTEXPROCESSING, PresentParams, pD3D); // Das ist Zeile 100
while (GetMessage (&message, NULL, 0, 0))
{
TranslateMessage (&message);
DispatchMessage (&message);
}
return (int)(message.wParam);
}
LRESULT CALLBACK WindowProc(HWND hWnd, UINT message, WPARAM wParam, LPARAM lParam)
{
switch(message)
{
case WM_DESTROY:
{
PostQuitMessage(0);
return (0);
}
case WM_KEYDOWN:
{
switch(wParam)
{
case VK_ESCAPE:
{
PostQuitMessage (0);
return (0);
}
}
}
break;
case WM_COMMAND:
{
switch(wParam)
{
}
return (0);
}
}
return (DefWindowProc (hWnd, message, wParam, lParam));
}
99 C:\Users\Janek\Desktop\Neuer Ordner\main.cpp no matching function for call to `IDirect3D9::CreateDevice(int&, _D3DDEVTYPE, HWND__*&, int, D3DPRESENT_PARAMETERS&, IDirect3D9*&)'
note C:\Dev-Cpp\include\D3D9.h:139 candidates are: virtual HRESULT IDirect3D9::CreateDevice(UINT, D3DDEVTYPE, HWND__*, DWORD, D3DPRESENT_PARAMETERS*, IDirect3DDevice9**)
was ist das Problem und wie komm ich ihm bei?
Hab schon gegoogelt aber keine Erklärung gefunden die nach meinem Lösungsversuch nicht noch mehr ERRORS ausgelöst hat.
mfg
Empire