Stilllegung des Forums
Das Forum wurde am 05.06.2023 nach über 20 Jahren stillgelegt (weitere Informationen und ein kleiner Rückblick).
Registrierungen, Anmeldungen und Postings sind nicht mehr möglich. Öffentliche Inhalte sind weiterhin zugänglich.
Das Team von spieleprogrammierer.de bedankt sich bei der Community für die vielen schönen Jahre.
Wenn du eine deutschsprachige Spieleentwickler-Community suchst, schau doch mal im Discord und auf ZFX vorbei!
Werbeanzeige
C-/C++-Quelltext |
|
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 |
// Test02.cpp : Defines the entry point for the application. // #include <Windows.h> #include <StdIO.h> #include <D3D9.h> #include "stdafx.h" #include "Test02.h" int WINAPI WinMain(HINSTANCE hInstance, HINSTANCE hPrevInstance, char* pcCmdLine, int iShowCmd) { PDIRECT3D9 pD3D = Direct3DCreate9(D3D_SDK_VERSION); if (pD3D) { MessageBox(NULL, "Fehler beim Erzeugen der Direct3D-Schnittstelle!", "Fehler", MB_OK | MB_ICONEXCLAMATION); return 1; } int iNumAdapters = pD3D->GetAdapterCount(); D3DADAPTER_IDENTIFIER9* pAdapters = new D3DADAPTER_IDENTIFIER9[iNumAdapters]; for (int iAdapter = 0; iAdapter < iNumAdapters; iAdapter++) { if (FAILED(pD3D->GetAdapterIdentifier(iAdapter, 0, &pAdapters[iAdapter]))) { MessageBox(NULL, "Adapterinformationen konnten nicht abgefragt werden!", "Fehler", MB_OK | MB_ICONEXCLAMATION); pD3D->Release(); delete[] pAdapters; return 1; } char acAdapterInfo[1024]; sprintf(acAdapterInfo, "Adapter-ID: $d\n" "Name: %s\n" "Treiber: %s\n" "Treiberversion: %d", iAdapters, pAdapters[iAdapter].Description, pAdapters[iAdapter].Driver, pAdapters[iAdapter].DriverVersion); MessageBox(NULL, acAdapterInfo, "Adapter gefunden", MB_OK | MB_ICONINFORMATION); } pD3D->Release(); delete[] pAdapters; return 0; } |
Quellcode |
|
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 |
------ Build started: Project: Test02, Configuration: Debug Win32 ------ Compiling... Test02.cpp d:\projects\vc\test02\test02\test02.cpp(12) : error C2065: 'PDIRECT3D9' : undeclared identifier d:\projects\vc\test02\test02\test02.cpp(12) : error C2146: syntax error : missing ';' before identifier 'pD3D' d:\projects\vc\test02\test02\test02.cpp(12) : error C2065: 'pD3D' : undeclared identifier d:\projects\vc\test02\test02\test02.cpp(12) : error C2065: 'D3D_SDK_VERSION' : undeclared identifier d:\projects\vc\test02\test02\test02.cpp(12) : error C3861: 'Direct3DCreate9': identifier not found d:\projects\vc\test02\test02\test02.cpp(16) : error C2664: 'MessageBoxW' : cannot convert parameter 2 from 'const char [49]' to 'LPCWSTR' Types pointed to are unrelated; conversion requires reinterpret_cast, C-style cast or function-style cast d:\projects\vc\test02\test02\test02.cpp(20) : error C2227: left of '->GetAdapterCount' must point to class/struct/union/generic type type is ''unknown-type'' d:\projects\vc\test02\test02\test02.cpp(22) : error C2065: 'D3DADAPTER_IDENTIFIER9' : undeclared identifier d:\projects\vc\test02\test02\test02.cpp(22) : error C2065: 'pAdapters' : undeclared identifier d:\projects\vc\test02\test02\test02.cpp(22) : error C2061: syntax error : identifier 'D3DADAPTER_IDENTIFIER9' d:\projects\vc\test02\test02\test02.cpp(26) : error C2227: left of '->GetAdapterIdentifier' must point to class/struct/union/generic type type is ''unknown-type'' d:\projects\vc\test02\test02\test02.cpp(28) : error C2664: 'MessageBoxW' : cannot convert parameter 2 from 'const char [53]' to 'LPCWSTR' Types pointed to are unrelated; conversion requires reinterpret_cast, C-style cast or function-style cast d:\projects\vc\test02\test02\test02.cpp(29) : error C2227: left of '->Release' must point to class/struct/union/generic type type is ''unknown-type'' d:\projects\vc\test02\test02\test02.cpp(30) : error C2541: 'delete' : cannot delete objects that are not pointers d:\projects\vc\test02\test02\test02.cpp(39) : error C2065: 'iAdapters' : undeclared identifier d:\projects\vc\test02\test02\test02.cpp(40) : error C2228: left of '.Description' must have class/struct/union d:\projects\vc\test02\test02\test02.cpp(41) : error C2228: left of '.Driver' must have class/struct/union d:\projects\vc\test02\test02\test02.cpp(42) : error C2228: left of '.DriverVersion' must have class/struct/union d:\projects\vc\test02\test02\test02.cpp(35) : error C3861: 'sprintf': identifier not found d:\projects\vc\test02\test02\test02.cpp(44) : error C2664: 'MessageBoxW' : cannot convert parameter 2 from 'char [1024]' to 'LPCWSTR' Types pointed to are unrelated; conversion requires reinterpret_cast, C-style cast or function-style cast d:\projects\vc\test02\test02\test02.cpp(47) : error C2227: left of '->Release' must point to class/struct/union/generic type type is ''unknown-type'' d:\projects\vc\test02\test02\test02.cpp(48) : error C2541: 'delete' : cannot delete objects that are not pointers Build log was saved at "file://d:\Projects\VC\Test02\Test02\Debug\BuildLog.htm" Test02 - 22 error(s), 0 warning(s) ========== Build: 0 succeeded, 1 failed, 0 up-to-date, 0 skipped ========== |
Werbeanzeige