Du bist nicht angemeldet.

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

Patrick Egli

Treue Seele

  • »Patrick Egli« ist der Autor dieses Themas

Beiträge: 161

Wohnort: Rainstrasse 38

  • Private Nachricht senden

1

11.12.2007, 20:03

Fehler beim Compilieren vom Dialog Fenster

Hallo zusammen

Kann mir jemand sagen was ich dieses mal falsch gemacht habe?

Hier der Quellcode des Listings:

Header-Files:

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
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
427
428
429
430
431
432
433
434
435
436
437
438
439
440
441
442
443
444
445
446
447
448
449
450
451
452
453
454
455
456
457
458
459
460
461
462
463
464
465
466
467
468
469
470
471
472
473
474
475
476
477
478
479
480
481
482
483
484
485
486
487
488
489
490
491
492
493
494
495
496
497
498
499
500
501
502
503
504
505
506
507
508
509
510
511
512
513
514
515
516
517
518
519
520
521
522
523
524
525
526
527
528
529
530
531
532
533
534
535
536
537
538
539
540
541
542
543
544
545
546
547
548
549
550
551
552
553
554
555
556
557
558
559
560
561
562
563
564
565
566
567
568
569
570
571
572
573
574
575
576
577
578
579
580
581
582
583
584
585
586
587
588
589
590
591
592
593
594
595
596
597
598
599
600
601
602
603
604
605
606
607
608
609
610
611
612
613
614
615
616
617
618
619
620
621
622
623
624
625
626
627
628
629
630
631
632
633
634
635
636
637
638
639
640
641
642
643
644
645
646
647
648
649
650
651
652
653
654
655
656
657
658
659
660
661
662
663
664
665
666
667
668
669
670
671
672
673
674
675
676
677
678
679
680
681
682
683
684
685
686
687
688
689
690
691
692
693
694
695
696
697
698
699
700
701
702
703
704
705
706
707
708
709
710
711
712
713
714
715
716
717
718
719
720
721
722
723
724
725
726
727
728
729
730
731
732
733
734
735
736
737
738
739
740
741
742
743
744
745
746
747
748
749
750
751
752
753
754
755
756
757
758
759
760
761
762
763
764
765
766
767
768
769
770
771
772
773
774
775
776
777
778
779
780
781
782
783
784
785
786
787
788
789
790
791
792
793
794
795
796
797
798
799
800
801
802
803
804
805
806
807
808
809
810
811
812
813
814
815
816
817
818
819
820
821
822
823
824
825
826
827
828
829
830
831
832
833
834
835
836
837
838
839
840
841
842
843
844
845
846
847
848
849
850
851
852
853
854
855
856
857
858
859
860
861
862
863
864
865
866
867
868
869
870
871
872
873
874
875
876
877
878
879
880
881
882
883
884
885
886
887
888
889
890
891
892
893
894
895
896
897
898
899
900
901
902
903
904
905
906
907
908
909
910
911
912
913
914
915
916
917
918
919
920
921
922
923
924
925
926
927
928
929
930
931
932
933
934
935
936
937
938
939
940
941
942
943
944
945
946
947
948
949
950
951
952
953
954
955
956
957
958
959
960
961
962
963
964
965
966
967
968
969
970
971
972
973
974
975
976
977
978
979
980
981
982
983
984
985
986
987
988
989
990
991
992
993
994
995
996
997
998
999
1000
1001
1002
1003
1004
1005
1006
1007
1008
1009
1010
1011
1012
1013
1014
1015
1016
1017
1018
1019
1020
1021
1022
1023
1024
1025
1026
1027
1028
1029
1030
1031
1032
1033
1034
1035
1036
1037
1038
1039
1040
1041
1042
1043
1044
1045
1046
1047
1048
1049
1050
1051
1052
1053
1054
1055
1056
1057
1058
1059
1060
1061
1062
1063
1064
1065
1066
1067
1068
1069
1070
1071
1072
1073
1074
1075
1076
1077
1078
1079
1080
1081
1082
1083
1084
1085
1086
1087
1088
1089
1090
1091
1092
1093
1094
1095
1096
1097
1098
1099
1100
1101
1102
1103
1104
1105
1106
1107
1108
1109
1110
1111
1112
1113
1114
1115
1116
1117
1118
1119
1120
1121
1122
1123
1124
1125
1126
1127
1128
1129
1130
1131
1132
1133
1134
1135
1136
1137
1138
// Allgemeines.h



//{{NO_DEPENDENCIES}}

// Microsoft Visual C++ generated include file.

// Used by Allgemeines.rc

//

#define IDD_DIRECT3D_SETTINGS           901
#define IDC_D3DS_OK                     9001
#define IDC_D3DS_CANCEL                 9002
#define IDC_D3DS_ADAPTERS               9003
#define IDC_D3DS_DEVICE_TYPES           9004
#define IDC_D3DS_WINDOWED_MODE          9005
#define IDC_D3DS_FULLSCREEN_MODE        9006
#define IDC_D3DS_VIDEO_MODES            9007
#define IDC_D3DS_BACK_BUFFER_FORMATS    9008
#define IDC_D3DS_Z_STENCIL_BUFFER_FORMATS 9009
#define IDC_D3DS_MULTI_SAMPLING_TYPES   9010
#define IDC_D3DS_MULTI_SAMPLING_QUALITIES 9011
#define IDC_D3DS_HARDWARE_TNL           9012
#define IDC_D3DS_SOFTWARE_TNL           9014
#define IDC_D3DS_DESCRIPTION            9016
#define IDC_D3DS_SAVE                   9015
#define IDC_D3DS_LOAD                   9017


// Direct3DEnum.h



// Hilfsdatei DIRECT3DENUM.H

// =========================

// Hier werden Funktionen zur Auflistung aller Direct3D-Adapter, deren

// Videomodi und sonstige Eigenschaften deklariert. Ein Dialogfenster

// präsentiert alle Möglichkeiten übersichtlich.


#ifdef _DIRECT3DENUM_CPP
#undef VAR
#define VAR
#else
#undef VAR
#define VAR extern
#endif

// ******************************************************************

// Struktur für die Direct3D-Parameter

struct SDirect3DParameters
{
    int                 iAdapter;               // Adapter-ID

    D3DDEVTYPE          DeviceType;             // Gerätetyp

    BOOL                bWindowed;              // Fenstermodus?

    D3DDISPLAYMODE      VideoMode;              // Videomodus

    D3DFORMAT           BackBufferFormat;       // Bildpufferformat

    D3DFORMAT           ZStencilBufferFormat;   // Z-Stencil-Buffer-Format

    D3DMULTISAMPLE_TYPE MultiSamplingType;      // Multi-Sampling-Typ

    DWORD               dwMultiSamplingQuality; // Multi-Sampling-Qualität

    DWORD               dwFlags;                // Flags (Hardware oder Software?)

    D3DCAPS9            DeviceCaps;             // Fähigkeiten des Geräts

};

// ******************************************************************

// Funktionen

tbResult GetDirect3DParameters(SDirect3DParameters* pOut); // Direct3D-Parameter erfragen (Auwahl per Dialogfenster)


// ******************************************************************




Resource Files:



// Allgemeines.rc


keine Text


Source Files:


// Direct3DEnum.cpp



// Hilfsdatei DIRECT3DENUM.CPP

// ===========================

// Hier werden Funktionen zur Auflistung aller Direct3D-Adapter, deren

// Videomodi und sonstige Eigenschaften deklariert. Ein Dialogfenster

// präsentiert alle Möglichkeiten übersichtlich.


#define _DIRECT3DENUM_CPP
#include <Windows.h>
#include <TriBase.h>
#include <D3D9.h>
#include "Direct3DEnum.h"
#include "Allgemeines.h"


// ******************************************************************

// Beschreibungstexte

#define ADAPTER_DESCRIPTION                 ("Adapter:\r\n\r\nWählen Sie aus der Liste den Adapter aus, mit dem das Programm arbeiten soll. Ein Adapter ist das gleiche wie eine Grafikkarte oder ein Grafikchip. Im Normalfall ist nur ein einziger Adapter auf Ihrem System installiert.")
#define DEVICE_TYPE_DESCRIPTION             ("Gerätetyp:\r\n\r\nDer Gerätetyp bestimmt, ob hardwarebeschleunigte Grafikausgabe zum Einsatz kommt (empfohlen). Eventuell gibt es noch weitere Möglichkeiten, die Sie nur dann in Erwägung ziehen sollten, wenn die Hardwarebeschleunigung nicht funktioniert.")
#define VIDEO_MODE_DESCRIPTION              ("Videomodus:\r\n\r\nDer Videomodus bestimmt die Auflösung des Monitors im Vollbildmodus oder die Größe des Fensters im Fenstermodus. Je höher die Auflösung, desto mehr Details sind erkennbar und desto langsamer läuft die Anwendung. 800 x 600 Pixel ist ein guter Wert.\r\nAchten Sie auch auf die eventuell angegebene Bildwiederholfrequenz! Je höher, desto flimmerfreier ist das Bild. Im Fenstermodus spielen Format und Bildwiederholfrequenz keine Rolle - sie werden vom aktuellen Videomodus übernommen.")
#define WINDOWED_FULLSCREEN_DESCRIPTION     ("Fenster-/Vollbildmodus:\r\n\r\nWählen Sie \"Fenstermodus\", damit das Programm in einem Fenster läuft. Sie können so einfacher zwischen Anwendungen wechseln. Der Vollbildmodus überlässt der Anwendung mehr Möglichkeiten und kann zu einem Geschwindigkeitsgewinn führen.")
#define BACK_BUFFER_FORMAT_DESCRIPTION      ("Bildpufferformat:\r\n\r\nDas Bildpufferformat bestimmt, in welchem Format die Bilddaten gespeichert werden. Je größer die Zahlen, desto vollständiger ist das Farbspektrum abgedeckt.")
#define Z_STENCIL_BUFFER_FORMAT_DESCRIPTION ("Z-Stencil-Buffer-Format:\r\n\r\nWählen Sie hier das gewünschte Z-Stencil-Buffer-Format aus. Ein \"S\" im Formatnamen besagt, dass in diesem Format Platz für einen Stencil-Buffer ist, der für zusätzliche Grafikeffekte verwendet werden kann.\r\nJe höher die Zahl hinter dem \"D\", desto genauer kann die Tiefe eines 3D-Objekts gespeichert werden, was zu besserer Grafik führt.\r\nDie Zahl hinter dem \"S\" steht für die Anzahl der Bits für den Stencil-Buffer.")
#define MULTI_SAMPLING_TYPE_DESCRIPTION     ("Multi-Sampling-Typ:\r\n\r\nDer Multi-Sampling-Typ bestimmt, in wie vielen Durchgängen jedes Bild geglättet wird. Je höher diese Anzahl ist, desto weniger Kanten erscheinen im fertigen Bild und desto langsamer läuft die Grafikausgabe.")
#define MULTI_SAMPLING_QUALITY_DESCRIPTION  ("Multi-Sampling-Qualität:\r\n\r\nManche Adapter unterstützen Multi-Sampling in verschiedenen Qualitätsstufen. Je höher die Qualität, desto langsamer ist das Multi-Sampling und desto besser ist natürlich das Ergebnis.")
#define TNL_DESCRIPTION                     ("Transformation und Beleuchtung:\r\n\r\nViele Grafikkarten können selbst einen Großteil der Rechenarbeit erledigen, die vor dem eigentlichen Zeichnen des Bildes anfällt - Transformation und Beleuchtung.\r\nBei \"Hardware\" übernimmt die Hardware alle Operationen. Wird eine nicht unterstützt, ist sie nicht verfügbar.\r\nWählen Sie \"Software\", um alles per Software erledigen zu lassen, was natürlich langsamer ist.")

// ******************************************************************

// Globale Variablen

SDirect3DParameters*    g_pDirect3DParameters;  // Zeiger auf Optionsstruktur

SDirect3DParameters     g_TempParameters;       // Temporäre Optionsstruktur

PDIRECT3D9              g_pD3DTemp = NULL;      // Temporäre "IDirect3D9"-Schnittstelle


// ******************************************************************

// Prototyp der Dialogfunktion

INT_PTR CALLBACK D3DEnumDialogProc(HWND hDlg, unsigned int uiMsg, WPARAM WParam, LPARAM LParam);


// ******************************************************************

// Diese Funktion wandelt ein Direct3D-Format in einen Text um.

tbResult GetFormatString(D3DFORMAT Format,
                         char* pcOut)
{
    // Parameter prüfen

    if(pcOut == NULL) TB_ERROR_NULL_POINTER("pcOut", TB_ERROR);


    // Format suchen und Beschreibung kopieren

    switch(Format)
    {
    case D3DFMT_R8G8B8:         strcpy(pcOut, "R8G8B8"); break;
    case D3DFMT_A8R8G8B8:       strcpy(pcOut, "A8R8G8B8"); break;
    case D3DFMT_X8R8G8B8:       strcpy(pcOut, "X8R8G8B8"); break;
    case D3DFMT_R5G6B5:         strcpy(pcOut, "R5G6B5"); break;
    case D3DFMT_X1R5G5B5:       strcpy(pcOut, "X1R5G5B5"); break;
    case D3DFMT_A1R5G5B5:       strcpy(pcOut, "A1R5G5B5"); break;
    case D3DFMT_A4R4G4B4:       strcpy(pcOut, "A4R4G4B4"); break;
    case D3DFMT_A2B10G10R10:    strcpy(pcOut, "A2B10G10R10"); break;
    case D3DFMT_A16B16G16R16:   strcpy(pcOut, "A16B16G16R16"); break;
    case D3DFMT_G16R16:         strcpy(pcOut, "G16R16"); break;
    case D3DFMT_A8P8:           strcpy(pcOut, "A8P8"); break;
    case D3DFMT_P8:             strcpy(pcOut, "P8"); break;
    case D3DFMT_L8:             strcpy(pcOut, "L8"); break;
    case D3DFMT_A8L8:           strcpy(pcOut, "A8L8"); break;
    case D3DFMT_A4L4:           strcpy(pcOut, "A4L4"); break;
    
    case D3DFMT_V8U8:           strcpy(pcOut, "V8U8"); break;
    case D3DFMT_Q8W8V8U8:       strcpy(pcOut, "Q8W8V8U8"); break;
    case D3DFMT_V16U16:         strcpy(pcOut, "V16U16"); break;
    case D3DFMT_Q16W16V16U16:   strcpy(pcOut, "Q16W16V16U16"); break;
    
    case D3DFMT_L6V5U5:         strcpy(pcOut, "L6V5U5"); break;
    case D3DFMT_X8L8V8U8:       strcpy(pcOut, "X8L8V8U8"); break;
    case D3DFMT_A2W10V10U10:    strcpy(pcOut, "A2W10V10U10"); break;
    case D3DFMT_L16:            strcpy(pcOut, "L16"); break;

    case D3DFMT_UYVY:           strcpy(pcOut, "UYVY"); break;
    case D3DFMT_YUY2:           strcpy(pcOut, "YUY2"); break;
    case D3DFMT_DXT1:           strcpy(pcOut, "DXT1"); break;
    case D3DFMT_DXT2:           strcpy(pcOut, "DXT2"); break;
    case D3DFMT_DXT3:           strcpy(pcOut, "DXT3"); break;
    case D3DFMT_DXT4:           strcpy(pcOut, "DXT4"); break;
    case D3DFMT_DXT5:           strcpy(pcOut, "DXT5"); break;
    case D3DFMT_MULTI2_ARGB8:   strcpy(pcOut, "MULTI2_ARGB8"); break;
    
    case D3DFMT_D16_LOCKABLE:   strcpy(pcOut, "D16_LOCKABLE"); break;
    case D3DFMT_D32:            strcpy(pcOut, "D32"); break;
    case D3DFMT_D32F_LOCKABLE:  strcpy(pcOut, "D32F_LOCKABLE"); break;
    case D3DFMT_D24FS8:         strcpy(pcOut, "D24FS8"); break;
    case D3DFMT_D15S1:          strcpy(pcOut, "D15S1"); break;
    case D3DFMT_D24S8:          strcpy(pcOut, "D24S8"); break;
    case D3DFMT_D16:            strcpy(pcOut, "D16"); break;
    case D3DFMT_D24X8:          strcpy(pcOut, "D24X8"); break;
    case D3DFMT_D24X4S4:        strcpy(pcOut, "D24X4S4"); break;
    case D3DFMT_VERTEXDATA:     strcpy(pcOut, "VERTEXDATA"); break;
    case D3DFMT_INDEX16:        strcpy(pcOut, "INDEX16"); break;
    case D3DFMT_INDEX32:        strcpy(pcOut, "INDEX32"); break;

    case D3DFMT_UNKNOWN:        strcpy(pcOut, "UNKNOWN"); break;

    default: strcpy(pcOut, "Unbekanntes Format"); break;
    }

    return TB_OK;
}

// ******************************************************************

// Diese Funktion löscht die Daten einer ganzen Liste.

tbResult DeleteListData(HWND hDlg,
                        int iDialogItem)
{
    int     iNumElements;
    void*   pElementData;


    // Anzahl der Listenelemente abfragen

    iNumElements = (int)(SendDlgItemMessage(hDlg, iDialogItem, CB_GETCOUNT, 0, 0));
    if(iNumElements == CB_ERR) return TB_ERROR;

    // Alle Elemente durchgehen

    for(int iElement = 0; iElement < iNumElements; iElement++)
    {
        // Daten des Elements abfragen und freigeben

        pElementData = (void*)(SendDlgItemMessage(hDlg, iDialogItem, CB_GETITEMDATA, iElement, 0));
        if(pElementData != (void*)(CB_ERR)) TB_SAFE_MEMFREE(pElementData);
    }

    // Liste leeren

    SendDlgItemMessage(hDlg, iDialogItem, CB_RESETCONTENT, 0, 0);

    return TB_OK;
}

// ******************************************************************

// Funktion zum Abzählen aller Adapter

tbResult EnumAdapters(HWND hDlg)
{
    int                     iNumAdapters;
    D3DADAPTER_IDENTIFIER9  AdapterInfo;

    
    // Liste löschen

    DeleteListData(hDlg, IDC_D3DS_ADAPTERS);

    // Anzahl der Adapter abfragen

    iNumAdapters = g_pD3DTemp->GetAdapterCount();

    // Jeden Adapter durchgehen

    for(int iAdapter = 0; iAdapter < iNumAdapters; iAdapter++)
    {
        // Informationen abfragen

        g_pD3DTemp->GetAdapterIdentifier(iAdapter, 0, &AdapterInfo);

        // Einen neuen Eintrag in der Adapterliste anlegen, mit

        // dem Namen des Adapters

        SendDlgItemMessage(hDlg, IDC_D3DS_ADAPTERS, CB_ADDSTRING,
                           0, (LPARAM)(AdapterInfo.Description));
    }

    // Den ersten Adapter in der Liste auswählen

    SendDlgItemMessage(hDlg, IDC_D3DS_ADAPTERS, CB_SETCURSEL, 0, 0);

    return TB_OK;
}

// ******************************************************************

// Abzählen der Gerätetypen des gerade ausgewählten Adapters

tbResult EnumDeviceTypes(HWND hDlg)
{
    int         iSelectedAdapter;
    D3DDEVTYPE  aDeviceType[] = {D3DDEVTYPE_HAL, D3DDEVTYPE_SW, D3DDEVTYPE_REF};
    char*       apcDeviceType[] = {"Hardwarebeschleunigung", "Softwaretreiber", "Referenz-Rasterizer"};
    D3DCAPS9    Caps;
    int         iIndex;
    D3DDEVTYPE* pDeviceType;


    // Gewählten Adapter abfragen

    iSelectedAdapter = (int)(SendDlgItemMessage(hDlg, IDC_D3DS_ADAPTERS, CB_GETCURSEL, 0, 0));

    // Gerätetypenliste leeren

    DeleteListData(hDlg, IDC_D3DS_DEVICE_TYPES);

    // Gerätetypen prüfen

    for(int iDeviceType = 0; iDeviceType < 3; iDeviceType++)
    {
        // Fähigkeiten abfragen. Falls das funktioniert, ist der Gerätetyp

        // verfügbar und er wird zur Liste hinzugefügt.

        if(SUCCEEDED(g_pD3DTemp->GetDeviceCaps(iSelectedAdapter, aDeviceType[iDeviceType], &Caps)))
        {
            iIndex = (int)(SendDlgItemMessage(hDlg, IDC_D3DS_DEVICE_TYPES, CB_ADDSTRING,
                                              0, (LPARAM)(apcDeviceType[iDeviceType])));

            // Speicher für den Gerätetyp reservieren und ihn dem Listeneintrag zuweisen.

            // Nur anhand des Listenindexes lässt sich der Typ nicht bestimmen.

            pDeviceType = (D3DDEVTYPE*)(tbMemAlloc(sizeof(D3DDEVTYPE)));
            *pDeviceType = aDeviceType[iDeviceType];

            // Daten dem Listeneintrag zuweisen

            SendDlgItemMessage(hDlg, IDC_D3DS_DEVICE_TYPES, CB_SETITEMDATA,
                               iIndex, (LPARAM)(pDeviceType));

            if(!(Caps.DevCaps & D3DDEVCAPS_HWTRANSFORMANDLIGHT))
            {
                g_TempParameters.dwFlags = D3DCREATE_SOFTWARE_VERTEXPROCESSING;
                EnableWindow(GetDlgItem(hDlg, IDC_D3DS_HARDWARE_TNL), FALSE);
            }
        }
    }

    // Ersten Gerätetyp auswählen

    SendDlgItemMessage(hDlg, IDC_D3DS_DEVICE_TYPES, CB_SETCURSEL, 0, 0);

    return TB_OK;
}

// ******************************************************************

// Abzählen der Videomodi des Adapters und des Gerätetyps

tbResult EnumVideoModes(HWND hDlg)
{
    int             iSelectedAdapter;
    int             iNumVideoModes;
    D3DFORMAT       aFormat[] = {D3DFMT_X8R8G8B8, D3DFMT_R8G8B8, D3DFMT_R5G6B5, D3DFMT_X1R5G5B5};
    D3DDISPLAYMODE* pVideoMode;
    char            acFormatString[256];
    char            acVideoModeString[256];
    int             iIndex;


    // Gewählten Adapter abfragen

    iSelectedAdapter = (int)(SendDlgItemMessage(hDlg, IDC_D3DS_ADAPTERS, CB_GETCURSEL, 0, 0));

    // Liste der Videomodi leeren

    DeleteListData(hDlg, IDC_D3DS_VIDEO_MODES);

    // Anzahl der verfügbaren Videomodi erfragen.

    // Wir gehen dabei Format für Format durch.

    for(int iFormat = 0; iFormat < 4; iFormat++)
    {
        iNumVideoModes = g_pD3DTemp->GetAdapterModeCount(iSelectedAdapter, aFormat[iFormat]);
        
        // Jeden Videomodus durchgehen und Informationen über ihn abfragen

        for(int iVideoMode = 0; iVideoMode < iNumVideoModes; iVideoMode++)
        {
            // Speicher für diesen Videomodus reservieren

            pVideoMode = (D3DDISPLAYMODE*)(tbMemAlloc(sizeof(D3DDISPLAYMODE)));

            // Informationen abfragen

            g_pD3DTemp->EnumAdapterModes(iSelectedAdapter, aFormat[iFormat], iVideoMode, pVideoMode);

            // Textbeschreibung für diesen Videomodus generieren

            GetFormatString(pVideoMode->Format, acFormatString);
            if(pVideoMode->RefreshRate != 0) sprintf(acVideoModeString, "%d x %d (%s, %d Hz)", pVideoMode->Width, pVideoMode->Height, acFormatString, pVideoMode->RefreshRate);
            else sprintf(acVideoModeString, "%d x %d (%s)", pVideoMode->Width, pVideoMode->Height, acFormatString);
            
            // Einen neuen Listeneintrag anlegen

            iIndex = (int)(SendDlgItemMessage(hDlg, IDC_D3DS_VIDEO_MODES, CB_ADDSTRING,
                                              0, (LPARAM)(acVideoModeString)));

            // Daten dem Eintrag zuweisen

            SendDlgItemMessage(hDlg, IDC_D3DS_VIDEO_MODES, CB_SETITEMDATA,
                               iIndex, (LPARAM)(pVideoMode));
        }
    }

    // Ersten Videomodus auswählen

    SendDlgItemMessage(hDlg, IDC_D3DS_VIDEO_MODES, CB_SETCURSEL, 0, 0);

    return TB_OK;
}

// ******************************************************************

// Diese Funktion listet alle kompatiblen Bildpufferformate auf

tbResult EnumBackBufferFormats(HWND hDlg)
{
    int             iSelectedAdapter;
    int             iSelectedDeviceType;
    D3DDEVTYPE*     pSelectedDeviceType;
    int             iSelectedVideoMode;
    D3DDISPLAYMODE* pSelectedVideoMode;
    BOOL            bWindowed;
    D3DDISPLAYMODE  CurrentVideoMode;
    BOOL            bHardwareFormatConversion;
    D3DFORMAT       aFormat[] = {D3DFMT_A2R10G10B10, D3DFMT_X8R8G8B8, D3DFMT_A8R8G8B8,
                                 D3DFMT_R5G6B5, D3DFMT_X1R5G5B5, D3DFMT_A1R5G5B5};
    char            acBackBufferString[256];
    int             iIndex;
    D3DFORMAT*      pFormat;


    // Gewählten Adapter, Gerätetyp, Videomodus und Fenster-/Vollbildmodus abfragen

    iSelectedAdapter = (int)(SendDlgItemMessage(hDlg, IDC_D3DS_ADAPTERS, CB_GETCURSEL, 0, 0));
    iSelectedDeviceType = (int)(SendDlgItemMessage(hDlg, IDC_D3DS_DEVICE_TYPES, CB_GETCURSEL, 0, 0));
    pSelectedDeviceType = (D3DDEVTYPE*)(SendDlgItemMessage(hDlg, IDC_D3DS_DEVICE_TYPES, CB_GETITEMDATA, iSelectedDeviceType, 0));
    iSelectedVideoMode = (int)(SendDlgItemMessage(hDlg, IDC_D3DS_VIDEO_MODES, CB_GETCURSEL, 0, 0));
    pSelectedVideoMode = (D3DDISPLAYMODE*)(SendDlgItemMessage(hDlg, IDC_D3DS_VIDEO_MODES, CB_GETITEMDATA, iSelectedVideoMode, 0));
    bWindowed = IsDlgButtonChecked(hDlg, IDC_D3DS_WINDOWED_MODE) == BST_CHECKED;

    // Liste leeren

    DeleteListData(hDlg, IDC_D3DS_BACK_BUFFER_FORMATS);

    // Aktuellen Videomodus abfragen

    g_pD3DTemp->GetAdapterDisplayMode(iSelectedAdapter, &CurrentVideoMode);

    // Jedes Format in der Liste durchgehen und prüfen, ob es verfügbar ist

    for(int iFormat = 0; iFormat < 6; iFormat++)
    {
        // Unterstützung abfragen

        if(SUCCEEDED(g_pD3DTemp->CheckDeviceFormat(iSelectedAdapter,
                                                   *pSelectedDeviceType,
                                                   bWindowed ? CurrentVideoMode.Format : pSelectedVideoMode->Format,
                                                   D3DUSAGE_RENDERTARGET,
                                                   D3DRTYPE_SURFACE,
                                                   aFormat[iFormat])))
        {
            // Prüfen, ob der Gerätetyp mit dieser Einstellung verfügbar ist

            if(SUCCEEDED(g_pD3DTemp->CheckDeviceType(iSelectedAdapter,
                                                     *pSelectedDeviceType,
                                                     bWindowed ? CurrentVideoMode.Format : pSelectedVideoMode->Format,
                                                     aFormat[iFormat],
                                                     bWindowed)))
            {
                // Wenn widersprüchliche Formate gewählt wurden, muss eine Formatkonvertierung

                // unterstützt sein.

                bHardwareFormatConversion = TRUE;
                if(bWindowed && aFormat[iFormat] != CurrentVideoMode.Format)
                {
                    if(FAILED(g_pD3DTemp->CheckDeviceFormatConversion(iSelectedAdapter,
                                                                      *pSelectedDeviceType,
                                                                      CurrentVideoMode.Format,
                                                                      aFormat[iFormat])))
                    {
                        // Hardwarekonvertierung ist nicht möglich!

                        bHardwareFormatConversion = FALSE;
                    }
                }

                if(bHardwareFormatConversion)
                {
                    // Formattext abfragen und Text generieren

                    GetFormatString(aFormat[iFormat], acBackBufferString);
                    if(bWindowed)
                    {
                        sprintf(acBackBufferString, "%s %s", acBackBufferString,
                                aFormat[iFormat] != CurrentVideoMode.Format ? "(Hardwarekonv.)" : "");
                    }

                    // Listeneintrag generieren

                    iIndex = (int)(SendDlgItemMessage(hDlg, IDC_D3DS_BACK_BUFFER_FORMATS, CB_ADDSTRING,
                                                      0, (LPARAM)(acBackBufferString)));

                    // Dem Eintrag das Format zuweisen

                    pFormat = (D3DFORMAT*)(tbMemAlloc(sizeof(D3DFORMAT)));
                    *pFormat = aFormat[iFormat];
                    SendDlgItemMessage(hDlg, IDC_D3DS_BACK_BUFFER_FORMATS, CB_SETITEMDATA,
                                       iIndex, (LPARAM)(pFormat));
                }
            }
        }
    }

    // Erstes Bildpufferformat auswählen

    SendDlgItemMessage(hDlg, IDC_D3DS_BACK_BUFFER_FORMATS, CB_SETCURSEL, 0, 0);

    return TB_OK;
}

// ******************************************************************

// Funktion zum Auflisten aller kompatiblen Z-Stencil-Buffer-Formate

tbResult EnumZStencilBufferFormats(HWND hDlg)
{
    int             iSelectedAdapter;
    int             iSelectedDeviceType;
    D3DDEVTYPE*     pSelectedDeviceType;
    int             iSelectedVideoMode;
    D3DDISPLAYMODE* pSelectedVideoMode;
    BOOL            bWindowed;
    int             iSelectedBackBufferFormat;
    D3DFORMAT*      pSelectedBackBufferFormat;
    D3DDISPLAYMODE  CurrentVideoMode;
    D3DFORMAT       aFormat[] = {D3DFMT_D32,
                                 D3DFMT_D24X8, D3DFMT_D24S8, D3DFMT_D24X4S4,
                                 D3DFMT_D16, D3DFMT_D16_LOCKABLE,
                                 D3DFMT_D15S1};
    char            acZStencilBufferString[256];
    int             iIndex;
    D3DFORMAT*      pFormat;


    // Gewählten Adapter, Gerätetyp, Videomodus, Fenster-/Vollbildmodus und Bildpufferformat abfragen

    iSelectedAdapter = (int)(SendDlgItemMessage(hDlg, IDC_D3DS_ADAPTERS, CB_GETCURSEL, 0, 0));
    iSelectedDeviceType = (int)(SendDlgItemMessage(hDlg, IDC_D3DS_DEVICE_TYPES, CB_GETCURSEL, 0, 0));
    pSelectedDeviceType = (D3DDEVTYPE*)(SendDlgItemMessage(hDlg, IDC_D3DS_DEVICE_TYPES, CB_GETITEMDATA, iSelectedDeviceType, 0));
    iSelectedVideoMode = (int)(SendDlgItemMessage(hDlg, IDC_D3DS_VIDEO_MODES, CB_GETCURSEL, 0, 0));
    pSelectedVideoMode = (D3DDISPLAYMODE*)(SendDlgItemMessage(hDlg, IDC_D3DS_VIDEO_MODES, CB_GETITEMDATA, iSelectedVideoMode, 0));
    bWindowed = IsDlgButtonChecked(hDlg, IDC_D3DS_WINDOWED_MODE) == BST_CHECKED;
    iSelectedBackBufferFormat = (int)(SendDlgItemMessage(hDlg, IDC_D3DS_BACK_BUFFER_FORMATS, CB_GETCURSEL, 0, 0));
    pSelectedBackBufferFormat = (D3DFORMAT*)(SendDlgItemMessage(hDlg, IDC_D3DS_BACK_BUFFER_FORMATS, CB_GETITEMDATA, iSelectedBackBufferFormat, 0));

    // Liste leeren

    DeleteListData(hDlg, IDC_D3DS_Z_STENCIL_BUFFER_FORMATS);

    // Aktuellen Videomodus abfragen

    g_pD3DTemp->GetAdapterDisplayMode(iSelectedAdapter, &CurrentVideoMode);

    // Jedes Format in der Liste durchgehen und prüfen, ob es verfügbar ist

    for(int iFormat = 0; iFormat < 7; iFormat++)
    {
        // Unterstützung abfragen

        if(SUCCEEDED(g_pD3DTemp->CheckDeviceFormat(iSelectedAdapter,
                                                   *pSelectedDeviceType,
                                                   bWindowed ? CurrentVideoMode.Format
                                                               : pSelectedVideoMode->Format,
                                                   D3DUSAGE_DEPTHSTENCIL,
                                                   D3DRTYPE_SURFACE,
                                                   aFormat[iFormat])))
        {
            // Passt das Format zum Bildpufferformat?

            if(SUCCEEDED(g_pD3DTemp->CheckDepthStencilMatch(iSelectedAdapter,
                                                            *pSelectedDeviceType,
                                                            bWindowed ? CurrentVideoMode.Format
                                                                        : pSelectedVideoMode->Format,
                                                            *pSelectedBackBufferFormat,
                                                            aFormat[iFormat])))
            {
                // Formattext abfragen und Text generieren

                GetFormatString(aFormat[iFormat], acZStencilBufferString);

                // Listeneintrag generieren

                iIndex = (int)(SendDlgItemMessage(hDlg, IDC_D3DS_Z_STENCIL_BUFFER_FORMATS, CB_ADDSTRING,
                                                  0, (LPARAM)(acZStencilBufferString)));

                // Dem Eintrag das Format zuweisen

                pFormat = (D3DFORMAT*)(tbMemAlloc(sizeof(D3DFORMAT)));
                *pFormat = aFormat[iFormat];
                SendDlgItemMessage(hDlg, IDC_D3DS_Z_STENCIL_BUFFER_FORMATS, CB_SETITEMDATA,
                                   iIndex, (LPARAM)(pFormat));
            }
        }
    }

    // Erstes Z-Stencil-Buffer-Format auswählen

    SendDlgItemMessage(hDlg, IDC_D3DS_Z_STENCIL_BUFFER_FORMATS, CB_SETCURSEL, 0, 0);

    return TB_OK;
}

// ******************************************************************

// Auflisten der Multi-Sampling-Typen

tbResult EnumMultiSamplingTypes(HWND hDlg)
{
    int                     iSelectedAdapter;
    int                     iSelectedDeviceType;
    D3DDEVTYPE*             pSelectedDeviceType;
    int                     iSelectedVideoMode;
    D3DDISPLAYMODE*         pSelectedVideoMode;
    BOOL                    bWindowed;
    int                     iSelectedBackBufferFormat;
    D3DFORMAT*              pSelectedBackBufferFormat;
    int                     iSelectedZStencilBufferFormat;
    D3DFORMAT*              pSelectedZStencilBufferFormat;
    D3DMULTISAMPLE_TYPE     aMultiSamplingType[] = {D3DMULTISAMPLE_NONE,
                                                    D3DMULTISAMPLE_NONMASKABLE,
                                                    D3DMULTISAMPLE_2_SAMPLES,
                                                    D3DMULTISAMPLE_3_SAMPLES,
                                                    D3DMULTISAMPLE_4_SAMPLES,
                                                    D3DMULTISAMPLE_5_SAMPLES,
                                                    D3DMULTISAMPLE_6_SAMPLES,
                                                    D3DMULTISAMPLE_7_SAMPLES,
                                                    D3DMULTISAMPLE_8_SAMPLES,
                                                    D3DMULTISAMPLE_9_SAMPLES,
                                                    D3DMULTISAMPLE_10_SAMPLES,
                                                    D3DMULTISAMPLE_11_SAMPLES,
                                                    D3DMULTISAMPLE_12_SAMPLES,
                                                    D3DMULTISAMPLE_13_SAMPLES,
                                                    D3DMULTISAMPLE_14_SAMPLES,
                                                    D3DMULTISAMPLE_15_SAMPLES,
                                                    D3DMULTISAMPLE_16_SAMPLES};
    char                    acMultiSamplingTypeString[256];
    int                     iIndex;
    D3DMULTISAMPLE_TYPE*    pMultiSamplingType;
    DWORD                   dwNumQualities;


    // Gewählte Optionen abfragen

    iSelectedAdapter = (int)(SendDlgItemMessage(hDlg, IDC_D3DS_ADAPTERS, CB_GETCURSEL, 0, 0));
    iSelectedDeviceType = (int)(SendDlgItemMessage(hDlg, IDC_D3DS_DEVICE_TYPES, CB_GETCURSEL, 0, 0));
    pSelectedDeviceType = (D3DDEVTYPE*)(SendDlgItemMessage(hDlg, IDC_D3DS_DEVICE_TYPES, CB_GETITEMDATA, iSelectedDeviceType, 0));
    iSelectedVideoMode = (int)(SendDlgItemMessage(hDlg, IDC_D3DS_VIDEO_MODES, CB_GETCURSEL, 0, 0));
    pSelectedVideoMode = (D3DDISPLAYMODE*)(SendDlgItemMessage(hDlg, IDC_D3DS_VIDEO_MODES, CB_GETITEMDATA, iSelectedVideoMode, 0));
    bWindowed = IsDlgButtonChecked(hDlg, IDC_D3DS_WINDOWED_MODE) == BST_CHECKED;
    iSelectedBackBufferFormat = (int)(SendDlgItemMessage(hDlg, IDC_D3DS_BACK_BUFFER_FORMATS, CB_GETCURSEL, 0, 0));
    pSelectedBackBufferFormat = (D3DFORMAT*)(SendDlgItemMessage(hDlg, IDC_D3DS_BACK_BUFFER_FORMATS, CB_GETITEMDATA, iSelectedBackBufferFormat, 0));
    iSelectedZStencilBufferFormat = (int)(SendDlgItemMessage(hDlg, IDC_D3DS_Z_STENCIL_BUFFER_FORMATS, CB_GETCURSEL, 0, 0));
    pSelectedZStencilBufferFormat = (D3DFORMAT*)(SendDlgItemMessage(hDlg, IDC_D3DS_Z_STENCIL_BUFFER_FORMATS, CB_GETITEMDATA, iSelectedZStencilBufferFormat, 0));

    // Liste leeren

    DeleteListData(hDlg, IDC_D3DS_MULTI_SAMPLING_TYPES);

    // Alle Multi-Sampling-Typen durchgehen und testen

    for(int iMultiSamplingType = 0; iMultiSamplingType < 17; iMultiSamplingType++)
    {
        // Kompatibilität mit dem Bildpufferformat prüfen

        if(SUCCEEDED(g_pD3DTemp->CheckDeviceMultiSampleType(iSelectedAdapter, 
                                                            *pSelectedDeviceType,
                                                            *pSelectedBackBufferFormat,
                                                            bWindowed,
                                                            aMultiSamplingType[iMultiSamplingType],
                                                            &dwNumQualities)))
        {
            if(dwNumQualities > 0)
            {
                // Kompatibilität mit dem Z-Stencil-Buffer-Format prüfen

                if(SUCCEEDED(g_pD3DTemp->CheckDeviceMultiSampleType(iSelectedAdapter, 
                                                                    *pSelectedDeviceType,
                                                                    *pSelectedZStencilBufferFormat,
                                                                    bWindowed,
                                                                    aMultiSamplingType[iMultiSamplingType],
                                                                    &dwNumQualities)))
                {
                    if(dwNumQualities > 0)
                    {
                        // Der Multi-Sampling-Typ ist OK!

                        if(iMultiSamplingType == 0) strcpy(acMultiSamplingTypeString, "Kein Multi-Sampling");
                        else if(iMultiSamplingType == 1) strcpy(acMultiSamplingTypeString, "Non-Maskable");
                        else sprintf(acMultiSamplingTypeString, "%d Samples", iMultiSamplingType);

                        pMultiSamplingType = (D3DMULTISAMPLE_TYPE*)(tbMemAlloc(sizeof(D3DMULTISAMPLE_TYPE)));
                        *pMultiSamplingType = aMultiSamplingType[iMultiSamplingType];

                        // Listeneintrag erzeugen

                        iIndex = (int)(SendDlgItemMessage(hDlg, IDC_D3DS_MULTI_SAMPLING_TYPES, CB_ADDSTRING,
                                                          0, (LPARAM)(acMultiSamplingTypeString)));
                
                        // Dem Eintrag den Multi-Sampling-Typ zuweisen

                        SendDlgItemMessage(hDlg, IDC_D3DS_MULTI_SAMPLING_TYPES, CB_SETITEMDATA,
                                           iIndex, (LPARAM)(pMultiSamplingType));
                    }
                }
            }
        }
    }

    // Ersten Multi-Sampling-Typ auswählen

    SendDlgItemMessage(hDlg, IDC_D3DS_MULTI_SAMPLING_TYPES, CB_SETCURSEL, 0, 0);

    return TB_OK;
}

// ******************************************************************

// Auflisten aller Multi-Sampling-Qualitätsstufen

tbResult EnumMultiSamplingQualities(HWND hDlg)
{
    int                     iSelectedAdapter;
    int                     iSelectedDeviceType;
    D3DDEVTYPE*             pSelectedDeviceType;
    int                     iSelectedVideoMode;
    D3DDISPLAYMODE*         pSelectedVideoMode;
    BOOL                    bWindowed;
    int                     iSelectedBackBufferFormat;
    D3DFORMAT*              pSelectedBackBufferFormat;
    int                     iSelectedMultiSamplingType;
    D3DMULTISAMPLE_TYPE*    pSelectedMultiSamplingType;
    DWORD                   dwNumMultiSamplingQualities;
    char                    acMultiSamplingQualityString[256];


    // Gewählte Optionen abfragen

    iSelectedAdapter = (int)(SendDlgItemMessage(hDlg, IDC_D3DS_ADAPTERS, CB_GETCURSEL, 0, 0));
    iSelectedDeviceType = (int)(SendDlgItemMessage(hDlg, IDC_D3DS_DEVICE_TYPES, CB_GETCURSEL, 0, 0));
    pSelectedDeviceType = (D3DDEVTYPE*)(SendDlgItemMessage(hDlg, IDC_D3DS_DEVICE_TYPES, CB_GETITEMDATA, iSelectedDeviceType, 0));
    iSelectedVideoMode = (int)(SendDlgItemMessage(hDlg, IDC_D3DS_VIDEO_MODES, CB_GETCURSEL, 0, 0));
    pSelectedVideoMode = (D3DDISPLAYMODE*)(SendDlgItemMessage(hDlg, IDC_D3DS_VIDEO_MODES, CB_GETITEMDATA, iSelectedVideoMode, 0));
    bWindowed = IsDlgButtonChecked(hDlg, IDC_D3DS_WINDOWED_MODE) == BST_CHECKED;
    iSelectedBackBufferFormat = (int)(SendDlgItemMessage(hDlg, IDC_D3DS_BACK_BUFFER_FORMATS, CB_GETCURSEL, 0, 0));
    pSelectedBackBufferFormat = (D3DFORMAT*)(SendDlgItemMessage(hDlg, IDC_D3DS_BACK_BUFFER_FORMATS, CB_GETITEMDATA, iSelectedBackBufferFormat, 0));
    iSelectedMultiSamplingType = (int)(SendDlgItemMessage(hDlg, IDC_D3DS_MULTI_SAMPLING_TYPES, CB_GETCURSEL, 0, 0));
    pSelectedMultiSamplingType = (D3DMULTISAMPLE_TYPE*)(SendDlgItemMessage(hDlg, IDC_D3DS_MULTI_SAMPLING_TYPES, CB_GETITEMDATA, iSelectedMultiSamplingType, 0));

    // Liste leeren

    DeleteListData(hDlg, IDC_D3DS_MULTI_SAMPLING_QUALITIES);

    // Anzahl der Qualitätsstufen abfragen

    g_pD3DTemp->CheckDeviceMultiSampleType(iSelectedAdapter, 
                                           *pSelectedDeviceType,
                                           *pSelectedBackBufferFormat,
                                           bWindowed,
                                           *pSelectedMultiSamplingType,
                                           &dwNumMultiSamplingQualities);

    // Listeneinträge erzeugen

    for(int iQuality = 0; iQuality < (int)(dwNumMultiSamplingQualities); iQuality++)
    {
        sprintf(acMultiSamplingQualityString, "Qualitätsstufe %d (von max. %d)",
                iQuality + 1, dwNumMultiSamplingQualities);
        SendDlgItemMessage(hDlg, IDC_D3DS_MULTI_SAMPLING_QUALITIES, CB_ADDSTRING,
                           0, (LPARAM)(acMultiSamplingQualityString));
    }

    // Höchste Qualitätsstufe auswählen

    SendDlgItemMessage(hDlg, IDC_D3DS_MULTI_SAMPLING_QUALITIES, CB_SETCURSEL,
                       dwNumMultiSamplingQualities - 1, 0);

    return TB_OK;
}

// ******************************************************************

// Diese Funktion durchsucht eine Dialogliste nach einem bestimmten Element.

tbResult FindListElement(HWND hDlg,
                         int iDialogItem,
                         void* pData,
                         int iSizeOfData,
                         int* piOut)
{
    int     iNumElements;
    void*   pElementData;


    // Parameter prüfen

    if(pData == NULL) TB_ERROR_NULL_POINTER("pData", TB_ERROR);


    // Anzahl der Listenelemente abfragen

    iNumElements = (int)(SendDlgItemMessage(hDlg, iDialogItem, CB_GETCOUNT, 0, 0));
    if(iNumElements == CB_ERR) return TB_ERROR;

    // Alle Elemente durchgehen

    for(int iElement = 0; iElement < iNumElements; iElement++)
    {
        // Daten des Elements abfragen und mit den angegebenen Daten vergleichen

        pElementData = (void*)(SendDlgItemMessage(hDlg, iDialogItem, CB_GETITEMDATA, iElement, 0));
        if(pElementData != (void*)(CB_ERR))
        {
            if(!memcmp(pData, pElementData, iSizeOfData))
            {
                // Gefunden!

                *piOut = iElement;
                return TB_OK;
            }
        }
    }

    return TB_ERROR;
}

// ******************************************************************

// Diese Funktion aktiviert in einer Dialogliste ein bestimmtes Element.

tbResult SelectListElement(HWND hDlg,
                           int iDialogItem,
                           void* pData,
                           int iSizeOfData,
                           int* piOut)
{
    int iIndex;

    // Nach dem Element suchen

    if(FindListElement(hDlg, iDialogItem, pData, iSizeOfData, &iIndex)) return TB_ERROR;

    // Element gefunden! Auswählen.

    SendDlgItemMessage(hDlg, iDialogItem, CB_SETCURSEL, iIndex, 0);
    if(piOut != NULL) *piOut = iIndex;

    return TB_OK;
}

// ******************************************************************

// Diese Funktion speichert die Einstellungen in eine Struktur.

tbResult GetParameters(HWND hDlg,
                       SDirect3DParameters* pOut)
{
    int     iIndex;
    void*   pTemp;


    // Parameter prüfen

    if(pOut == NULL) TB_ERROR_NULL_POINTER("pOut", TB_ERROR);


    // Alle Parameter abfragen und speichern, vorher noch die Struktur leeren

    ZeroMemory(pOut, sizeof(SDirect3DParameters));
    
    // Adapter

    pOut->iAdapter = (int)(SendDlgItemMessage(hDlg, IDC_D3DS_ADAPTERS, CB_GETCURSEL, 0, 0));
    
    // Gerätetyp

    iIndex = (int)(SendDlgItemMessage(hDlg, IDC_D3DS_DEVICE_TYPES, CB_GETCURSEL, 0, 0));    
    pTemp = ((void*)(SendDlgItemMessage(hDlg, IDC_D3DS_DEVICE_TYPES, CB_GETITEMDATA, iIndex, 0)));
    if(pTemp != (void*)(CB_ERR)) pOut->DeviceType = *((D3DDEVTYPE*)(pTemp));

    // Fenster-/Vollbildmodus

    pOut->bWindowed = IsDlgButtonChecked(hDlg, IDC_D3DS_WINDOWED_MODE) == BST_CHECKED;

    // Videomodus

    iIndex = (int)(SendDlgItemMessage(hDlg, IDC_D3DS_VIDEO_MODES, CB_GETCURSEL, 0, 0));
    pTemp = ((void*)(SendDlgItemMessage(hDlg, IDC_D3DS_VIDEO_MODES, CB_GETITEMDATA, iIndex, 0)));
    if(pTemp != (void*)(CB_ERR)) pOut->VideoMode = *((D3DDISPLAYMODE*)(pTemp));

    // Bildpufferformat

    iIndex = (int)(SendDlgItemMessage(hDlg, IDC_D3DS_BACK_BUFFER_FORMATS, CB_GETCURSEL, 0, 0));
    pTemp = ((void*)(SendDlgItemMessage(hDlg, IDC_D3DS_BACK_BUFFER_FORMATS, CB_GETITEMDATA, iIndex, 0)));
    if(pTemp != (void*)(CB_ERR)) pOut->BackBufferFormat = *((D3DFORMAT*)(pTemp));

    // Z-Stencil-Buffer-Format

    iIndex = (int)(SendDlgItemMessage(hDlg, IDC_D3DS_Z_STENCIL_BUFFER_FORMATS, CB_GETCURSEL, 0, 0));
    pTemp = ((void*)(SendDlgItemMessage(hDlg, IDC_D3DS_Z_STENCIL_BUFFER_FORMATS, CB_GETITEMDATA, iIndex, 0)));
    if(pTemp != (void*)(CB_ERR)) pOut->ZStencilBufferFormat = *((D3DFORMAT*)(pTemp));

    // Multi-Sampling-Typ

    iIndex = (int)(SendDlgItemMessage(hDlg, IDC_D3DS_MULTI_SAMPLING_TYPES, CB_GETCURSEL, 0, 0));
    pTemp = ((void*)(SendDlgItemMessage(hDlg, IDC_D3DS_MULTI_SAMPLING_TYPES, CB_GETITEMDATA, iIndex, 0)));
    if(pTemp != (void*)(CB_ERR)) pOut->MultiSamplingType = *((D3DMULTISAMPLE_TYPE*)(pTemp));

    // Multi-Sampling-Qualität

    pOut->dwMultiSamplingQuality = (DWORD)(SendDlgItemMessage(hDlg, IDC_D3DS_MULTI_SAMPLING_QUALITIES, CB_GETCURSEL, 0, 0));

    // Transformation und Beleuchtung

    if(IsDlgButtonChecked(hDlg, IDC_D3DS_HARDWARE_TNL) == BST_CHECKED) pOut->dwFlags = D3DCREATE_HARDWARE_VERTEXPROCESSING;
    else pOut->dwFlags = D3DCREATE_SOFTWARE_VERTEXPROCESSING;

    // Fähigkeiten abfragen

    g_pD3DTemp->GetDeviceCaps(pOut->iAdapter, pOut->DeviceType, &pOut->DeviceCaps);

    return TB_OK;
}

// ******************************************************************

// Diese Funktion aktiviert die Einstellungen aus einer Struktur

// so weit wie möglich.

tbResult SetParameters(HWND hDlg,
                       SDirect3DParameters* pParameters)
{
    // Alle Parameter in der Liste suchen und/oder auswählen

    SendDlgItemMessage(hDlg, IDC_D3DS_ADAPTERS, CB_SETCURSEL, pParameters->iAdapter, 0);
    EnumDeviceTypes(hDlg); SelectListElement(hDlg, IDC_D3DS_DEVICE_TYPES, &pParameters->DeviceType, sizeof(D3DDEVTYPE), NULL);
    CheckDlgButton(hDlg, IDC_D3DS_WINDOWED_MODE, pParameters->bWindowed ? BST_CHECKED : BST_UNCHECKED);
    CheckDlgButton(hDlg, IDC_D3DS_FULLSCREEN_MODE, !pParameters->bWindowed ? BST_CHECKED : BST_UNCHECKED);
    EnumVideoModes(hDlg); SelectListElement(hDlg, IDC_D3DS_VIDEO_MODES, &pParameters->VideoMode, sizeof(D3DDISPLAYMODE), NULL);
    EnumBackBufferFormats(hDlg); SelectListElement(hDlg, IDC_D3DS_BACK_BUFFER_FORMATS, &pParameters->BackBufferFormat, sizeof(D3DFORMAT), NULL);
    EnumZStencilBufferFormats(hDlg); SelectListElement(hDlg, IDC_D3DS_Z_STENCIL_BUFFER_FORMATS, &pParameters->ZStencilBufferFormat, sizeof(D3DFORMAT), NULL);
    EnumMultiSamplingTypes(hDlg); SelectListElement(hDlg, IDC_D3DS_MULTI_SAMPLING_TYPES, &pParameters->MultiSamplingType, sizeof(D3DMULTISAMPLE_TYPE), NULL);
    EnumMultiSamplingQualities(hDlg); if(pParameters->dwMultiSamplingQuality != -1) SendDlgItemMessage(hDlg, IDC_D3DS_MULTI_SAMPLING_QUALITIES, CB_SETCURSEL, pParameters->dwMultiSamplingQuality, 0);
    CheckDlgButton(hDlg, IDC_D3DS_HARDWARE_TNL, pParameters->dwFlags & D3DCREATE_HARDWARE_VERTEXPROCESSING ? BST_CHECKED : BST_UNCHECKED);
    CheckDlgButton(hDlg, IDC_D3DS_SOFTWARE_TNL, pParameters->dwFlags & D3DCREATE_SOFTWARE_VERTEXPROCESSING ? BST_CHECKED : BST_UNCHECKED);

    return TB_OK;
}

// ******************************************************************

// Dialogfunktion

INT_PTR CALLBACK D3DEnumDialogProc(HWND hDlg,
                                   unsigned int uiMsg,
                                   WPARAM WParam,
                                   LPARAM LParam)
{
    char    acFilename[256];
    FILE*   pFile;


    // Nachricht verarbeiten

    switch(uiMsg)
    {
    case WM_INITDIALOG:
        // Optionskästchen einstellen

        CheckDlgButton(hDlg, IDC_D3DS_FULLSCREEN_MODE, BST_CHECKED);
        CheckDlgButton(hDlg, IDC_D3DS_HARDWARE_TNL, BST_CHECKED);

        // Alles abzählen

        EnumAdapters(hDlg);
        EnumDeviceTypes(hDlg);
        EnumVideoModes(hDlg);
        EnumBackBufferFormats(hDlg);
        EnumZStencilBufferFormats(hDlg);
        EnumMultiSamplingTypes(hDlg);
        EnumMultiSamplingQualities(hDlg);
        break;

    case WM_CLOSE:
        // Code 2 zurückliefern; das bedeutet: Dialog abgebrochen

        EndDialog(hDlg, 2);
        break;

    case WM_DESTROY:
        // Aufräumen

        DeleteListData(hDlg, IDC_D3DS_ADAPTERS);
        DeleteListData(hDlg, IDC_D3DS_DEVICE_TYPES);
        DeleteListData(hDlg, IDC_D3DS_VIDEO_MODES);
        DeleteListData(hDlg, IDC_D3DS_BACK_BUFFER_FORMATS);
        DeleteListData(hDlg, IDC_D3DS_Z_STENCIL_BUFFER_FORMATS);
        DeleteListData(hDlg, IDC_D3DS_MULTI_SAMPLING_TYPES);
        DeleteListData(hDlg, IDC_D3DS_MULTI_SAMPLING_QUALITIES);
        break;

    case WM_COMMAND:        
        switch(LOWORD(WParam))
        {
        case IDC_D3DS_ADAPTERS:
            if(HIWORD(WParam) == CBN_SELCHANGE)
            {
                // Es wurde ein neuer Adapter gewählt! Gerätetypen neu auflisten.

                GetParameters(hDlg, &g_TempParameters);
                EnumDeviceTypes(hDlg);
                EnumVideoModes(hDlg);
                EnumBackBufferFormats(hDlg);
                EnumZStencilBufferFormats(hDlg);
                EnumMultiSamplingTypes(hDlg);
                EnumMultiSamplingQualities(hDlg);
                SetParameters(hDlg, &g_TempParameters);
            }
            else
            {
                // Informationstext anzeigen

                SetDlgItemText(hDlg, IDC_D3DS_DESCRIPTION, ADAPTER_DESCRIPTION);
            }
            break;

        case IDC_D3DS_DEVICE_TYPES:
            if(HIWORD(WParam) == CBN_SELCHANGE)
            {
                // Es wurde ein neuer Gerätetyp gewählt! Videomodi neu auflisten.

                GetParameters(hDlg, &g_TempParameters);
                EnumVideoModes(hDlg);
                EnumBackBufferFormats(hDlg);
                EnumZStencilBufferFormats(hDlg);
                EnumMultiSamplingTypes(hDlg);
                EnumMultiSamplingQualities(hDlg);
                SetParameters(hDlg, &g_TempParameters);
            }
            else
            {
                // Informationstext anzeigen

                SetDlgItemText(hDlg, IDC_D3DS_DESCRIPTION, DEVICE_TYPE_DESCRIPTION);
            }
            break;

        case IDC_D3DS_WINDOWED_MODE:
        case IDC_D3DS_FULLSCREEN_MODE:
            if(HIWORD(WParam) == BN_CLICKED)
            {
                // Es wurde zwischen Fenster- und Vollbildmodus gewechselt!

                // Die Bildpufferformate müssen neu aufgelistet werden.

                GetParameters(hDlg, &g_TempParameters);
                EnumVideoModes(hDlg);
                EnumBackBufferFormats(hDlg);
                EnumZStencilBufferFormats(hDlg);
                EnumMultiSamplingTypes(hDlg);
                EnumMultiSamplingQualities(hDlg);
                SetParameters(hDlg, &g_TempParameters);
            }

            // Informationstext anzeigen

            SetDlgItemText(hDlg, IDC_D3DS_DESCRIPTION, WINDOWED_FULLSCREEN_DESCRIPTION);
            break;

        case IDC_D3DS_VIDEO_MODES:
            if(HIWORD(WParam) == CBN_SELCHANGE)
            {
                // Es wurde ein neuer Videomodus gewählt! Bildpufferformate neu auflisten.

                GetParameters(hDlg, &g_TempParameters);
                EnumBackBufferFormats(hDlg);
                EnumZStencilBufferFormats(hDlg);
                EnumMultiSamplingTypes(hDlg);
                EnumMultiSamplingQualities(hDlg);
                SetParameters(hDlg, &g_TempParameters);
            }
            else
            {
                // Informationstext anzeigen

                SetDlgItemText(hDlg, IDC_D3DS_DESCRIPTION, VIDEO_MODE_DESCRIPTION);
            }
            break;

        case IDC_D3DS_BACK_BUFFER_FORMATS:
            if(HIWORD(WParam) == CBN_SELCHANGE)
            {
                // Es wurde ein neues Bildpufferformat gewählt! Z-Stencil-Buffer-Formate neu auflisten.

                GetParameters(hDlg, &g_TempParameters);
                EnumZStencilBufferFormats(hDlg);
                EnumMultiSamplingTypes(hDlg);
                EnumMultiSamplingQualities(hDlg);
                SetParameters(hDlg, &g_TempParameters);
            }
            else
            {
                // Informationstext anzeigen

                SetDlgItemText(hDlg, IDC_D3DS_DESCRIPTION, BACK_BUFFER_FORMAT_DESCRIPTION);
            }
            break;

        case IDC_D3DS_Z_STENCIL_BUFFER_FORMATS:
            if(HIWORD(WParam) == CBN_SELCHANGE)
            {
                // Es wurde ein neues Z-Stencil-Buffer-Format gewählt! Multi-Sampling-Typen neu auflisten.

                GetParameters(hDlg, &g_TempParameters);
                EnumMultiSamplingTypes(hDlg);
                EnumMultiSamplingQualities(hDlg);
                SetParameters(hDlg, &g_TempParameters);
            }
            else
            {
                // Informationstext anzeigen

                SetDlgItemText(hDlg, IDC_D3DS_DESCRIPTION, Z_STENCIL_BUFFER_FORMAT_DESCRIPTION);
            }
            break;

        case IDC_D3DS_MULTI_SAMPLING_TYPES:
            if(HIWORD(WParam) == CBN_SELCHANGE)
            {
                // Es wurde ein neuer Multi-Sampling-Typ gewählt! Qualitätsstufen neu auflisten.

                GetParameters(hDlg, &g_TempParameters);
                EnumMultiSamplingQualities(hDlg);
                SetParameters(hDlg, &g_TempParameters);
            }
            else
            {
                // Informationstext anzeigen

                SetDlgItemText(hDlg, IDC_D3DS_DESCRIPTION, MULTI_SAMPLING_TYPE_DESCRIPTION);
            }
            break;

        case IDC_D3DS_MULTI_SAMPLING_QUALITIES:
            if(HIWORD(WParam) != CBN_SELCHANGE)
            {
                // Informationstext anzeigen

                SetDlgItemText(hDlg, IDC_D3DS_DESCRIPTION, MULTI_SAMPLING_QUALITY_DESCRIPTION);
            }
            break;

        case IDC_D3DS_HARDWARE_TNL:
        case IDC_D3DS_SOFTWARE_TNL:
            // Informationstext anzeigen

            SetDlgItemText(hDlg, IDC_D3DS_DESCRIPTION, TNL_DESCRIPTION);
            break;

        case IDC_D3DS_SAVE:
            {
                strcpy(acFilename, "*.cfg");
                OPENFILENAME Filename = {sizeof(OPENFILENAME), hDlg, NULL, ".CFG-Dateien\0.cfg", NULL,
                                         0, 1, acFilename, 255, NULL, 0, NULL, ".CFG-Datei speichern",
                                         OFN_OVERWRITEPROMPT | OFN_HIDEREADONLY | OFN_NOCHANGEDIR,
                                         0, 1, ".cfg", 0, NULL, NULL};

                if(GetSaveFileName(&Filename))
                {
                    // Parameter abfragen und speichern

                    GetParameters(hDlg, &g_TempParameters);
                    pFile = fopen(acFilename, "wb");
                    fwrite(&g_TempParameters, sizeof(SDirect3DParameters), 1, pFile);
                    fclose(pFile);
                }
            }
            break;

        case IDC_D3DS_LOAD:
            {
                strcpy(acFilename, "*.cfg");
                OPENFILENAME Filename = {sizeof(OPENFILENAME), hDlg, NULL, ".CFG-Dateien\0.cfg\0Alle Dateien\0*.*", NULL,
                                         0, 1, acFilename, 255, NULL, 0, NULL, ".CFG-Datei laden",
                                         OFN_FILEMUSTEXIST | OFN_NOCHANGEDIR,
                                         0, 1, ".cfg", 0, NULL, NULL};
                
                if(GetOpenFileName(&Filename))
                {
                    // Parameter einlesen und aktivieren

                    pFile = fopen(acFilename, "rb");
                    GetParameters(hDlg, &g_TempParameters);
                    fread(&g_TempParameters, sizeof(SDirect3DParameters), 1, pFile);
                    fclose(pFile);
                    SetParameters(hDlg, &g_TempParameters);
                }
            }
            break;

        case IDC_D3DS_OK:
            // Parameter abfragen und einen eventuellen Fehler vermeiden

            GetParameters(hDlg, g_pDirect3DParameters);
            if(g_pDirect3DParameters->DeviceType != D3DDEVTYPE_HAL &&
               !(g_pDirect3DParameters->dwFlags & D3DCREATE_SOFTWARE_VERTEXPROCESSING))
            {
                if(g_pDirect3DParameters->dwFlags & D3DCREATE_HARDWARE_VERTEXPROCESSING) g_pDirect3DParameters->dwFlags ^= D3DCREATE_HARDWARE_VERTEXPROCESSING;
                g_pDirect3DParameters->dwFlags |= D3DCREATE_SOFTWARE_VERTEXPROCESSING;
            }
            
            // Code 0 zurückliefern; das bedeutet: alles OK.

            EndDialog(hDlg, 0);
            break;

        case IDC_D3DS_CANCEL:
            // Code 2 zurückliefern; das bedeutet: Dialog abgebrochen

            EndDialog(hDlg, 2);
            break;
        }
        break;

    default:
        // Standardverarbeitung der Nachricht

        return FALSE;
        break;
    }

    // Nachricht wurde verarbeitet.

    return TRUE;
}

// ******************************************************************

// Die Hauptfunktion: sie startet das Dialogfenster zur Auswahl aller

// Direct3D-Parameter (Adapter, Gerätetyp, Videomodus, ...) und speichert

// die Benutzerauswahl in einer Struktur vom Typ "SDirect3DParameters".

tbResult GetDirect3DParameters(SDirect3DParameters* pOut)
{
    int iResult;

    // Parameter prüfen

    if(pOut == NULL) TB_ERROR_NULL_POINTER("pOut", TB_ERROR);


    // Direct3D-Schnittstelle erzeugen. Sie wird vom Dialog zur

    // Auflistung benötigt.

    g_pD3DTemp = Direct3DCreate9(D3D_SDK_VERSION);
    if(g_pD3DTemp == NULL) return TB_ERROR;

    // Den globalen Zeiger auf die Struktur setzen, damit sie später

    // gefüllt werden kann

    g_pDirect3DParameters = pOut;

    // Dialogfenster aufrufen

    iResult = (int)(DialogBox(GetModuleHandle(NULL),
                              MAKEINTRESOURCE(IDD_DIRECT3D_SETTINGS),
                              NULL,
                              D3DEnumDialogProc));

    // Schnittstelle wieder freigeben

    TB_SAFE_RELEASE(g_pD3DTemp);

    // Rückgabewert des Dialogfensters auswerten

    if(iResult == 0) return TB_OK;                  // Alles OK!

    else if(iResult == 1) return TB_ERROR;          // Fehler!

    else /*if(iResult == 2)*/ return TB_CANCELED;   // Dialog abgebrochen

}

// ******************************************************************




Und jetzt kommen die Fehler:


1>------ Build started: Project: Dialog Fenster, Configuration: Debug Win32 ------
1>Linking...
1>Direct3DEnum.obj : error LNK2019: unresolved external symbol "__declspec(dllimport) enum tbResult __cdecl tbWriteToLog(char *,...)" (__imp_?tbWriteToLog@@YA?AW4tbResult@@PADZZ) referenced in function "enum tbResult __cdecl GetFormatString(enum _D3DFORMAT,char *)" (?GetFormatString@@YA?AW4tbResult@@W4_D3DFORMAT@@PAD@Z)
1>Direct3DEnum.obj : error LNK2019: unresolved external symbol "__declspec(dllimport) char * __cdecl tbRemoveDir(char *)" (__imp_?tbRemoveDir@@YAPADPAD@Z) referenced in function "enum tbResult __cdecl GetFormatString(enum _D3DFORMAT,char *)" (?GetFormatString@@YA?AW4tbResult@@W4_D3DFORMAT@@PAD@Z)
1>Direct3DEnum.obj : error LNK2019: unresolved external symbol "__declspec(dllimport) enum tbResult __cdecl tbMemFree(void *)" (__imp_?tbMemFree@@YA?AW4tbResult@@PAX@Z) referenced in function "enum tbResult __cdecl DeleteListData(struct HWND__ *,int)" (?DeleteListData@@YA?AW4tbResult@@PAUHWND__@@H@Z)
1>Direct3DEnum.obj : error LNK2019: unresolved external symbol "__declspec(dllimport) void * __cdecl tbMemAlloc(int)" (__imp_?tbMemAlloc@@YAPAXH@Z) referenced in function "enum tbResult __cdecl EnumDeviceTypes(struct HWND__ *)" (?EnumDeviceTypes@@YA?AW4tbResult@@PAUHWND__@@@Z)
1>MSVCRTD.lib(crtexew.obj) : error LNK2019: unresolved external symbol _WinMain@16 referenced in function ___tmainCRTStartup
1>C:\Programme\Microsoft Visual Studio 9.0\Alle Projekte\Dialog Fenster\Debug\Dialog Fenster.exe : fatal error LNK1120: 5 unresolved externals
1>Build log was saved at "file://c:\Programme\Microsoft Visual Studio 9.0\Alle Projekte\Dialog Fenster\Dialog Fenster\Debug\BuildLog.htm"
1>Dialog Fenster - 6 error(s), 0 warning(s)
========== Build: 0 succeeded, 1 failed, 0 up-to-date, 0 skipped ==========




Gruss Patrick Egli

2

11.12.2007, 21:05

Sieht so aus, als ob er irgendwelche Libs vermisst.
Bei VCE 2005:
Projekteigenschaften -> Linker -> Eingabe -> Zusätzliche Abhängigkeiten
TriBase.lib (release) oder TriBased.lib (debug) hinzufügen.

Patrick Egli

Treue Seele

  • »Patrick Egli« ist der Autor dieses Themas

Beiträge: 161

Wohnort: Rainstrasse 38

  • Private Nachricht senden

3

12.12.2007, 14:04

Hallo zusammen

Ich habe jetzt mal TriBaseD.lib bei den Linkern hinzugefügt.

Doch jetzt gibt es folgende Fehler:


C-/C++-Quelltext

1
2
3
4
5
6
7
1>------ Build started: Project: Dialog Fenster, Configuration: Debug Win32 ------
1>Linking...
1>MSVCRTD.lib(crtexew.obj) : error LNK2019: unresolved external symbol _WinMain@16 referenced in function ___tmainCRTStartup
1>C:\Programme\Microsoft Visual Studio 9.0\Alle Projekte\Dialog Fenster\Debug\Dialog Fenster.exe : fatal error LNK1120: 1 unresolved externals
1>Build log was saved at "file://c:\Programme\Microsoft Visual Studio 9.0\Alle Projekte\Dialog Fenster\Dialog Fenster\Debug\BuildLog.htm"
1>Dialog Fenster - 2 error(s), 0 warning(s)
========== Build: 0 succeeded, 1 failed, 0 up-to-date, 0 skipped ==========




Gruss Patrick Egli

Bugger

Frischling

Beiträge: 66

Wohnort: Bezirk Freistadt

Beruf: EDVO HTL Schüler

  • Private Nachricht senden

4

13.12.2007, 09:17

Dir fehlt eine (Win)main Funktion um das ausführen zu können :roll:
Kurz: du hast keine (Syntax) Fehler in deinem Header.

Patrick Egli

Treue Seele

  • »Patrick Egli« ist der Autor dieses Themas

Beiträge: 161

Wohnort: Rainstrasse 38

  • Private Nachricht senden

5

14.12.2007, 23:23

Hallo zusammen

So, ich habe jetzt die "Direct3DEnum.cpp" Datei abgeändert. Das sieht folgendermassen aus:

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
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
427
428
429
430
431
432
433
434
435
436
437
438
439
440
441
442
443
444
445
446
447
448
449
450
451
452
453
454
455
456
457
458
459
460
461
462
463
464
465
466
467
468
469
470
471
472
473
474
475
476
477
478
479
480
481
482
483
484
485
486
487
488
489
490
491
492
493
494
495
496
497
498
499
500
501
502
503
504
505
506
507
508
509
510
511
512
513
514
515
516
517
518
519
520
521
522
523
524
525
526
527
528
529
530
531
532
533
534
535
536
537
538
539
540
541
542
543
544
545
546
547
548
549
550
551
552
553
554
555
556
557
558
559
560
561
562
563
564
565
566
567
568
569
570
571
572
573
574
575
576
577
578
579
580
581
582
583
584
585
586
587
588
589
590
591
592
593
594
595
596
597
598
599
600
601
602
603
604
605
606
607
608
609
610
611
612
613
614
615
616
617
618
619
620
621
622
623
624
625
626
627
628
629
630
631
632
633
634
635
636
637
638
639
640
641
642
643
644
645
646
647
648
649
650
651
652
653
654
655
656
657
658
659
660
661
662
663
664
665
666
667
668
669
670
671
672
673
674
675
676
677
678
679
680
681
682
683
684
685
686
687
688
689
690
691
692
693
694
695
696
697
698
699
700
701
702
703
704
705
706
707
708
709
710
711
712
713
714
715
716
717
718
719
720
721
722
723
724
725
726
727
728
729
730
731
732
733
734
735
736
737
738
739
740
741
742
743
744
745
746
747
748
749
750
751
752
753
754
755
756
757
758
759
760
761
762
763
764
765
766
767
768
769
770
771
772
773
774
775
776
777
778
779
780
781
782
783
784
785
786
787
788
789
790
791
792
793
794
795
796
797
798
799
800
801
802
803
804
805
806
807
808
809
810
811
812
813
814
815
816
817
818
819
820
821
822
823
824
825
826
827
828
829
830
831
832
833
834
835
836
837
838
839
840
841
842
843
844
845
846
847
848
849
850
851
852
853
854
855
856
857
858
859
860
861
862
863
864
865
866
867
868
869
870
871
872
873
874
875
876
877
878
879
880
881
882
883
884
885
886
887
888
889
890
891
892
893
894
895
896
897
898
899
900
901
902
903
904
905
906
907
908
909
910
911
912
913
914
915
916
917
918
919
920
921
922
923
924
925
926
927
928
929
930
931
932
933
934
935
936
937
938
939
940
941
942
943
944
945
946
947
948
949
950
951
952
953
954
955
956
957
958
959
960
961
962
963
964
965
966
967
968
969
970
971
972
973
974
975
976
977
978
979
980
981
982
983
984
985
986
987
988
989
990
991
992
993
994
995
996
997
998
999
1000
1001
1002
1003
1004
1005
1006
1007
1008
1009
1010
1011
1012
1013
1014
1015
1016
1017
1018
1019
1020
1021
1022
1023
1024
1025
1026
1027
1028
1029
1030
1031
1032
1033
1034
1035
1036
1037
1038
1039
1040
1041
1042
1043
1044
1045
1046
1047
1048
1049
1050
1051
1052
1053
1054
1055
1056
1057
1058
1059
1060
1061
1062
1063
1064
// Hilfsdatei DIRECT3DENUM.CPP

// ===========================

// Hier werden Funktionen zur Auflistung aller Direct3D-Adapter, deren

// Videomodi und sonstige Eigenschaften deklariert. Ein Dialogfenster

// präsentiert alle Möglichkeiten übersichtlich.


#define _DIRECT3DENUM_CPP
#include <Windows.h>
#include <TriBase.h>
#include <D3D9.h>
#include "Direct3DEnum.h"
#include "Allgemeines.h"

int WINAPI WinMain (HINSTANCE hInstance, HINSTANCE HPrevInstance,
                    char* pcCommandLine, int iShowCommand)
{
    MSG Message; // Nachricht


    
        




// ******************************************************************

// Beschreibungstexte

#define ADAPTER_DESCRIPTION                 ("Adapter:\r\n\r\nWählen Sie aus der Liste den Adapter aus, mit dem das Programm arbeiten soll. Ein Adapter ist das gleiche wie eine Grafikkarte oder ein Grafikchip. Im Normalfall ist nur ein einziger Adapter auf Ihrem System installiert.")
#define DEVICE_TYPE_DESCRIPTION             ("Gerätetyp:\r\n\r\nDer Gerätetyp bestimmt, ob hardwarebeschleunigte Grafikausgabe zum Einsatz kommt (empfohlen). Eventuell gibt es noch weitere Möglichkeiten, die Sie nur dann in Erwägung ziehen sollten, wenn die Hardwarebeschleunigung nicht funktioniert.")
#define VIDEO_MODE_DESCRIPTION              ("Videomodus:\r\n\r\nDer Videomodus bestimmt die Auflösung des Monitors im Vollbildmodus oder die Größe des Fensters im Fenstermodus. Je höher die Auflösung, desto mehr Details sind erkennbar und desto langsamer läuft die Anwendung. 800 x 600 Pixel ist ein guter Wert.\r\nAchten Sie auch auf die eventuell angegebene Bildwiederholfrequenz! Je höher, desto flimmerfreier ist das Bild. Im Fenstermodus spielen Format und Bildwiederholfrequenz keine Rolle - sie werden vom aktuellen Videomodus übernommen.")
#define WINDOWED_FULLSCREEN_DESCRIPTION     ("Fenster-/Vollbildmodus:\r\n\r\nWählen Sie \"Fenstermodus\", damit das Programm in einem Fenster läuft. Sie können so einfacher zwischen Anwendungen wechseln. Der Vollbildmodus überlässt der Anwendung mehr Möglichkeiten und kann zu einem Geschwindigkeitsgewinn führen.")
#define BACK_BUFFER_FORMAT_DESCRIPTION      ("Bildpufferformat:\r\n\r\nDas Bildpufferformat bestimmt, in welchem Format die Bilddaten gespeichert werden. Je größer die Zahlen, desto vollständiger ist das Farbspektrum abgedeckt.")
#define Z_STENCIL_BUFFER_FORMAT_DESCRIPTION ("Z-Stencil-Buffer-Format:\r\n\r\nWählen Sie hier das gewünschte Z-Stencil-Buffer-Format aus. Ein \"S\" im Formatnamen besagt, dass in diesem Format Platz für einen Stencil-Buffer ist, der für zusätzliche Grafikeffekte verwendet werden kann.\r\nJe höher die Zahl hinter dem \"D\", desto genauer kann die Tiefe eines 3D-Objekts gespeichert werden, was zu besserer Grafik führt.\r\nDie Zahl hinter dem \"S\" steht für die Anzahl der Bits für den Stencil-Buffer.")
#define MULTI_SAMPLING_TYPE_DESCRIPTION     ("Multi-Sampling-Typ:\r\n\r\nDer Multi-Sampling-Typ bestimmt, in wie vielen Durchgängen jedes Bild geglättet wird. Je höher diese Anzahl ist, desto weniger Kanten erscheinen im fertigen Bild und desto langsamer läuft die Grafikausgabe.")
#define MULTI_SAMPLING_QUALITY_DESCRIPTION  ("Multi-Sampling-Qualität:\r\n\r\nManche Adapter unterstützen Multi-Sampling in verschiedenen Qualitätsstufen. Je höher die Qualität, desto langsamer ist das Multi-Sampling und desto besser ist natürlich das Ergebnis.")
#define TNL_DESCRIPTION                     ("Transformation und Beleuchtung:\r\n\r\nViele Grafikkarten können selbst einen Großteil der Rechenarbeit erledigen, die vor dem eigentlichen Zeichnen des Bildes anfällt - Transformation und Beleuchtung.\r\nBei \"Hardware\" übernimmt die Hardware alle Operationen. Wird eine nicht unterstützt, ist sie nicht verfügbar.\r\nWählen Sie \"Software\", um alles per Software erledigen zu lassen, was natürlich langsamer ist.")

// ******************************************************************

// Globale Variablen

SDirect3DParameters*    g_pDirect3DParameters;  // Zeiger auf Optionsstruktur

SDirect3DParameters     g_TempParameters;       // Temporäre Optionsstruktur

PDIRECT3D9              g_pD3DTemp = NULL;      // Temporäre "IDirect3D9"-Schnittstelle


// ******************************************************************

// Prototyp der Dialogfunktion

INT_PTR CALLBACK D3DEnumDialogProc(HWND hDlg, unsigned int uiMsg, WPARAM WParam, LPARAM LParam);


// ******************************************************************

// Diese Funktion wandelt ein Direct3D-Format in einen Text um.

tbResult GetFormatString(D3DFORMAT Format,
                         char* pcOut)
{
    // Parameter prüfen

    if(pcOut == NULL) TB_ERROR_NULL_POINTER("pcOut", TB_ERROR);


    // Format suchen und Beschreibung kopieren

    switch(Format)
    {
    case D3DFMT_R8G8B8:         strcpy(pcOut, "R8G8B8"); break;
    case D3DFMT_A8R8G8B8:       strcpy(pcOut, "A8R8G8B8"); break;
    case D3DFMT_X8R8G8B8:       strcpy(pcOut, "X8R8G8B8"); break;
    case D3DFMT_R5G6B5:         strcpy(pcOut, "R5G6B5"); break;
    case D3DFMT_X1R5G5B5:       strcpy(pcOut, "X1R5G5B5"); break;
    case D3DFMT_A1R5G5B5:       strcpy(pcOut, "A1R5G5B5"); break;
    case D3DFMT_A4R4G4B4:       strcpy(pcOut, "A4R4G4B4"); break;
    case D3DFMT_A2B10G10R10:    strcpy(pcOut, "A2B10G10R10"); break;
    case D3DFMT_A16B16G16R16:   strcpy(pcOut, "A16B16G16R16"); break;
    case D3DFMT_G16R16:         strcpy(pcOut, "G16R16"); break;
    case D3DFMT_A8P8:           strcpy(pcOut, "A8P8"); break;
    case D3DFMT_P8:             strcpy(pcOut, "P8"); break;
    case D3DFMT_L8:             strcpy(pcOut, "L8"); break;
    case D3DFMT_A8L8:           strcpy(pcOut, "A8L8"); break;
    case D3DFMT_A4L4:           strcpy(pcOut, "A4L4"); break;
    
    case D3DFMT_V8U8:           strcpy(pcOut, "V8U8"); break;
    case D3DFMT_Q8W8V8U8:       strcpy(pcOut, "Q8W8V8U8"); break;
    case D3DFMT_V16U16:         strcpy(pcOut, "V16U16"); break;
    case D3DFMT_Q16W16V16U16:   strcpy(pcOut, "Q16W16V16U16"); break;
    
    case D3DFMT_L6V5U5:         strcpy(pcOut, "L6V5U5"); break;
    case D3DFMT_X8L8V8U8:       strcpy(pcOut, "X8L8V8U8"); break;
    case D3DFMT_A2W10V10U10:    strcpy(pcOut, "A2W10V10U10"); break;
    case D3DFMT_L16:            strcpy(pcOut, "L16"); break;

    case D3DFMT_UYVY:           strcpy(pcOut, "UYVY"); break;
    case D3DFMT_YUY2:           strcpy(pcOut, "YUY2"); break;
    case D3DFMT_DXT1:           strcpy(pcOut, "DXT1"); break;
    case D3DFMT_DXT2:           strcpy(pcOut, "DXT2"); break;
    case D3DFMT_DXT3:           strcpy(pcOut, "DXT3"); break;
    case D3DFMT_DXT4:           strcpy(pcOut, "DXT4"); break;
    case D3DFMT_DXT5:           strcpy(pcOut, "DXT5"); break;
    case D3DFMT_MULTI2_ARGB8:   strcpy(pcOut, "MULTI2_ARGB8"); break;
    
    case D3DFMT_D16_LOCKABLE:   strcpy(pcOut, "D16_LOCKABLE"); break;
    case D3DFMT_D32:            strcpy(pcOut, "D32"); break;
    case D3DFMT_D32F_LOCKABLE:  strcpy(pcOut, "D32F_LOCKABLE"); break;
    case D3DFMT_D24FS8:         strcpy(pcOut, "D24FS8"); break;
    case D3DFMT_D15S1:          strcpy(pcOut, "D15S1"); break;
    case D3DFMT_D24S8:          strcpy(pcOut, "D24S8"); break;
    case D3DFMT_D16:            strcpy(pcOut, "D16"); break;
    case D3DFMT_D24X8:          strcpy(pcOut, "D24X8"); break;
    case D3DFMT_D24X4S4:        strcpy(pcOut, "D24X4S4"); break;
    case D3DFMT_VERTEXDATA:     strcpy(pcOut, "VERTEXDATA"); break;
    case D3DFMT_INDEX16:        strcpy(pcOut, "INDEX16"); break;
    case D3DFMT_INDEX32:        strcpy(pcOut, "INDEX32"); break;

    case D3DFMT_UNKNOWN:        strcpy(pcOut, "UNKNOWN"); break;

    default: strcpy(pcOut, "Unbekanntes Format"); break;
    }

    return TB_OK;
}

// ******************************************************************

// Diese Funktion löscht die Daten einer ganzen Liste.

tbResult DeleteListData(HWND hDlg,
                        int iDialogItem)
{
    int     iNumElements;
    void*   pElementData;


    // Anzahl der Listenelemente abfragen

    iNumElements = (int)(SendDlgItemMessage(hDlg, iDialogItem, CB_GETCOUNT, 0, 0));
    if(iNumElements == CB_ERR) return TB_ERROR;

    // Alle Elemente durchgehen

    for(int iElement = 0; iElement < iNumElements; iElement++)
    {
        // Daten des Elements abfragen und freigeben

        pElementData = (void*)(SendDlgItemMessage(hDlg, iDialogItem, CB_GETITEMDATA, iElement, 0));
        if(pElementData != (void*)(CB_ERR)) TB_SAFE_MEMFREE(pElementData);
    }

    // Liste leeren

    SendDlgItemMessage(hDlg, iDialogItem, CB_RESETCONTENT, 0, 0);

    return TB_OK;
}

// ******************************************************************

// Funktion zum Abzählen aller Adapter

tbResult EnumAdapters(HWND hDlg)
{
    int                     iNumAdapters;
    D3DADAPTER_IDENTIFIER9  AdapterInfo;

    
    // Liste löschen

    DeleteListData(hDlg, IDC_D3DS_ADAPTERS);

    // Anzahl der Adapter abfragen

    iNumAdapters = g_pD3DTemp->GetAdapterCount();

    // Jeden Adapter durchgehen

    for(int iAdapter = 0; iAdapter < iNumAdapters; iAdapter++)
    {
        // Informationen abfragen

        g_pD3DTemp->GetAdapterIdentifier(iAdapter, 0, &AdapterInfo);

        // Einen neuen Eintrag in der Adapterliste anlegen, mit

        // dem Namen des Adapters

        SendDlgItemMessage(hDlg, IDC_D3DS_ADAPTERS, CB_ADDSTRING,
                           0, (LPARAM)(AdapterInfo.Description));
    }

    // Den ersten Adapter in der Liste auswählen

    SendDlgItemMessage(hDlg, IDC_D3DS_ADAPTERS, CB_SETCURSEL, 0, 0);

    return TB_OK;
}

// ******************************************************************

// Abzählen der Gerätetypen des gerade ausgewählten Adapters

tbResult EnumDeviceTypes(HWND hDlg)
{
    int         iSelectedAdapter;
    D3DDEVTYPE  aDeviceType[] = {D3DDEVTYPE_HAL, D3DDEVTYPE_SW, D3DDEVTYPE_REF};
    char*       apcDeviceType[] = {"Hardwarebeschleunigung", "Softwaretreiber", "Referenz-Rasterizer"};
    D3DCAPS9    Caps;
    int         iIndex;
    D3DDEVTYPE* pDeviceType;


    // Gewählten Adapter abfragen

    iSelectedAdapter = (int)(SendDlgItemMessage(hDlg, IDC_D3DS_ADAPTERS, CB_GETCURSEL, 0, 0));

    // Gerätetypenliste leeren

    DeleteListData(hDlg, IDC_D3DS_DEVICE_TYPES);

    // Gerätetypen prüfen

    for(int iDeviceType = 0; iDeviceType < 3; iDeviceType++)
    {
        // Fähigkeiten abfragen. Falls das funktioniert, ist der Gerätetyp

        // verfügbar und er wird zur Liste hinzugefügt.

        if(SUCCEEDED(g_pD3DTemp->GetDeviceCaps(iSelectedAdapter, aDeviceType[iDeviceType], &Caps)))
        {
            iIndex = (int)(SendDlgItemMessage(hDlg, IDC_D3DS_DEVICE_TYPES, CB_ADDSTRING,
                                              0, (LPARAM)(apcDeviceType[iDeviceType])));

            // Speicher für den Gerätetyp reservieren und ihn dem Listeneintrag zuweisen.

            // Nur anhand des Listenindexes lässt sich der Typ nicht bestimmen.

            pDeviceType = (D3DDEVTYPE*)(tbMemAlloc(sizeof(D3DDEVTYPE)));
            *pDeviceType = aDeviceType[iDeviceType];

            // Daten dem Listeneintrag zuweisen

            SendDlgItemMessage(hDlg, IDC_D3DS_DEVICE_TYPES, CB_SETITEMDATA,
                               iIndex, (LPARAM)(pDeviceType));

            if(!(Caps.DevCaps & D3DDEVCAPS_HWTRANSFORMANDLIGHT))
            {
                g_TempParameters.dwFlags = D3DCREATE_SOFTWARE_VERTEXPROCESSING;
                EnableWindow(GetDlgItem(hDlg, IDC_D3DS_HARDWARE_TNL), FALSE);
            }
        }
    }

    // Ersten Gerätetyp auswählen

    SendDlgItemMessage(hDlg, IDC_D3DS_DEVICE_TYPES, CB_SETCURSEL, 0, 0);

    return TB_OK;
}

// ******************************************************************

// Abzählen der Videomodi des Adapters und des Gerätetyps

tbResult EnumVideoModes(HWND hDlg)
{
    int             iSelectedAdapter;
    int             iNumVideoModes;
    D3DFORMAT       aFormat[] = {D3DFMT_X8R8G8B8, D3DFMT_R8G8B8, D3DFMT_R5G6B5, D3DFMT_X1R5G5B5};
    D3DDISPLAYMODE* pVideoMode;
    char            acFormatString[256];
    char            acVideoModeString[256];
    int             iIndex;


    // Gewählten Adapter abfragen

    iSelectedAdapter = (int)(SendDlgItemMessage(hDlg, IDC_D3DS_ADAPTERS, CB_GETCURSEL, 0, 0));

    // Liste der Videomodi leeren

    DeleteListData(hDlg, IDC_D3DS_VIDEO_MODES);

    // Anzahl der verfügbaren Videomodi erfragen.

    // Wir gehen dabei Format für Format durch.

    for(int iFormat = 0; iFormat < 4; iFormat++)
    {
        iNumVideoModes = g_pD3DTemp->GetAdapterModeCount(iSelectedAdapter, aFormat[iFormat]);
        
        // Jeden Videomodus durchgehen und Informationen über ihn abfragen

        for(int iVideoMode = 0; iVideoMode < iNumVideoModes; iVideoMode++)
        {
            // Speicher für diesen Videomodus reservieren

            pVideoMode = (D3DDISPLAYMODE*)(tbMemAlloc(sizeof(D3DDISPLAYMODE)));

            // Informationen abfragen

            g_pD3DTemp->EnumAdapterModes(iSelectedAdapter, aFormat[iFormat], iVideoMode, pVideoMode);

            // Textbeschreibung für diesen Videomodus generieren

            GetFormatString(pVideoMode->Format, acFormatString);
            if(pVideoMode->RefreshRate != 0) sprintf(acVideoModeString, "%d x %d (%s, %d Hz)", pVideoMode->Width, pVideoMode->Height, acFormatString, pVideoMode->RefreshRate);
            else sprintf(acVideoModeString, "%d x %d (%s)", pVideoMode->Width, pVideoMode->Height, acFormatString);
            
            // Einen neuen Listeneintrag anlegen

            iIndex = (int)(SendDlgItemMessage(hDlg, IDC_D3DS_VIDEO_MODES, CB_ADDSTRING,
                                              0, (LPARAM)(acVideoModeString)));

            // Daten dem Eintrag zuweisen

            SendDlgItemMessage(hDlg, IDC_D3DS_VIDEO_MODES, CB_SETITEMDATA,
                               iIndex, (LPARAM)(pVideoMode));
        }
    }

    // Ersten Videomodus auswählen

    SendDlgItemMessage(hDlg, IDC_D3DS_VIDEO_MODES, CB_SETCURSEL, 0, 0);

    return TB_OK;
}

// ******************************************************************

// Diese Funktion listet alle kompatiblen Bildpufferformate auf

tbResult EnumBackBufferFormats(HWND hDlg)
{
    int             iSelectedAdapter;
    int             iSelectedDeviceType;
    D3DDEVTYPE*     pSelectedDeviceType;
    int             iSelectedVideoMode;
    D3DDISPLAYMODE* pSelectedVideoMode;
    BOOL            bWindowed;
    D3DDISPLAYMODE  CurrentVideoMode;
    BOOL            bHardwareFormatConversion;
    D3DFORMAT       aFormat[] = {D3DFMT_A2R10G10B10, D3DFMT_X8R8G8B8, D3DFMT_A8R8G8B8,
                                 D3DFMT_R5G6B5, D3DFMT_X1R5G5B5, D3DFMT_A1R5G5B5};
    char            acBackBufferString[256];
    int             iIndex;
    D3DFORMAT*      pFormat;


    // Gewählten Adapter, Gerätetyp, Videomodus und Fenster-/Vollbildmodus abfragen

    iSelectedAdapter = (int)(SendDlgItemMessage(hDlg, IDC_D3DS_ADAPTERS, CB_GETCURSEL, 0, 0));
    iSelectedDeviceType = (int)(SendDlgItemMessage(hDlg, IDC_D3DS_DEVICE_TYPES, CB_GETCURSEL, 0, 0));
    pSelectedDeviceType = (D3DDEVTYPE*)(SendDlgItemMessage(hDlg, IDC_D3DS_DEVICE_TYPES, CB_GETITEMDATA, iSelectedDeviceType, 0));
    iSelectedVideoMode = (int)(SendDlgItemMessage(hDlg, IDC_D3DS_VIDEO_MODES, CB_GETCURSEL, 0, 0));
    pSelectedVideoMode = (D3DDISPLAYMODE*)(SendDlgItemMessage(hDlg, IDC_D3DS_VIDEO_MODES, CB_GETITEMDATA, iSelectedVideoMode, 0));
    bWindowed = IsDlgButtonChecked(hDlg, IDC_D3DS_WINDOWED_MODE) == BST_CHECKED;

    // Liste leeren

    DeleteListData(hDlg, IDC_D3DS_BACK_BUFFER_FORMATS);

    // Aktuellen Videomodus abfragen

    g_pD3DTemp->GetAdapterDisplayMode(iSelectedAdapter, &CurrentVideoMode);

    // Jedes Format in der Liste durchgehen und prüfen, ob es verfügbar ist

    for(int iFormat = 0; iFormat < 6; iFormat++)
    {
        // Unterstützung abfragen

        if(SUCCEEDED(g_pD3DTemp->CheckDeviceFormat(iSelectedAdapter,
                                                   *pSelectedDeviceType,
                                                   bWindowed ? CurrentVideoMode.Format : pSelectedVideoMode->Format,
                                                   D3DUSAGE_RENDERTARGET,
                                                   D3DRTYPE_SURFACE,
                                                   aFormat[iFormat])))
        {
            // Prüfen, ob der Gerätetyp mit dieser Einstellung verfügbar ist

            if(SUCCEEDED(g_pD3DTemp->CheckDeviceType(iSelectedAdapter,
                                                     *pSelectedDeviceType,
                                                     bWindowed ? CurrentVideoMode.Format : pSelectedVideoMode->Format,
                                                     aFormat[iFormat],
                                                     bWindowed)))
            {
                // Wenn widersprüchliche Formate gewählt wurden, muss eine Formatkonvertierung

                // unterstützt sein.

                bHardwareFormatConversion = TRUE;
                if(bWindowed && aFormat[iFormat] != CurrentVideoMode.Format)
                {
                    if(FAILED(g_pD3DTemp->CheckDeviceFormatConversion(iSelectedAdapter,
                                                                      *pSelectedDeviceType,
                                                                      CurrentVideoMode.Format,
                                                                      aFormat[iFormat])))
                    {
                        // Hardwarekonvertierung ist nicht möglich!

                        bHardwareFormatConversion = FALSE;
                    }
                }

                if(bHardwareFormatConversion)
                {
                    // Formattext abfragen und Text generieren

                    GetFormatString(aFormat[iFormat], acBackBufferString);
                    if(bWindowed)
                    {
                        sprintf(acBackBufferString, "%s %s", acBackBufferString,
                                aFormat[iFormat] != CurrentVideoMode.Format ? "(Hardwarekonv.)" : "");
                    }

                    // Listeneintrag generieren

                    iIndex = (int)(SendDlgItemMessage(hDlg, IDC_D3DS_BACK_BUFFER_FORMATS, CB_ADDSTRING,
                                                      0, (LPARAM)(acBackBufferString)));

                    // Dem Eintrag das Format zuweisen

                    pFormat = (D3DFORMAT*)(tbMemAlloc(sizeof(D3DFORMAT)));
                    *pFormat = aFormat[iFormat];
                    SendDlgItemMessage(hDlg, IDC_D3DS_BACK_BUFFER_FORMATS, CB_SETITEMDATA,
                                       iIndex, (LPARAM)(pFormat));
                }
            }
        }
    }

    // Erstes Bildpufferformat auswählen

    SendDlgItemMessage(hDlg, IDC_D3DS_BACK_BUFFER_FORMATS, CB_SETCURSEL, 0, 0);

    return TB_OK;
}

// ******************************************************************

// Funktion zum Auflisten aller kompatiblen Z-Stencil-Buffer-Formate

tbResult EnumZStencilBufferFormats(HWND hDlg)
{
    int             iSelectedAdapter;
    int             iSelectedDeviceType;
    D3DDEVTYPE*     pSelectedDeviceType;
    int             iSelectedVideoMode;
    D3DDISPLAYMODE* pSelectedVideoMode;
    BOOL            bWindowed;
    int             iSelectedBackBufferFormat;
    D3DFORMAT*      pSelectedBackBufferFormat;
    D3DDISPLAYMODE  CurrentVideoMode;
    D3DFORMAT       aFormat[] = {D3DFMT_D32,
                                 D3DFMT_D24X8, D3DFMT_D24S8, D3DFMT_D24X4S4,
                                 D3DFMT_D16, D3DFMT_D16_LOCKABLE,
                                 D3DFMT_D15S1};
    char            acZStencilBufferString[256];
    int             iIndex;
    D3DFORMAT*      pFormat;


    // Gewählten Adapter, Gerätetyp, Videomodus, Fenster-/Vollbildmodus und Bildpufferformat abfragen

    iSelectedAdapter = (int)(SendDlgItemMessage(hDlg, IDC_D3DS_ADAPTERS, CB_GETCURSEL, 0, 0));
    iSelectedDeviceType = (int)(SendDlgItemMessage(hDlg, IDC_D3DS_DEVICE_TYPES, CB_GETCURSEL, 0, 0));
    pSelectedDeviceType = (D3DDEVTYPE*)(SendDlgItemMessage(hDlg, IDC_D3DS_DEVICE_TYPES, CB_GETITEMDATA, iSelectedDeviceType, 0));
    iSelectedVideoMode = (int)(SendDlgItemMessage(hDlg, IDC_D3DS_VIDEO_MODES, CB_GETCURSEL, 0, 0));
    pSelectedVideoMode = (D3DDISPLAYMODE*)(SendDlgItemMessage(hDlg, IDC_D3DS_VIDEO_MODES, CB_GETITEMDATA, iSelectedVideoMode, 0));
    bWindowed = IsDlgButtonChecked(hDlg, IDC_D3DS_WINDOWED_MODE) == BST_CHECKED;
    iSelectedBackBufferFormat = (int)(SendDlgItemMessage(hDlg, IDC_D3DS_BACK_BUFFER_FORMATS, CB_GETCURSEL, 0, 0));
    pSelectedBackBufferFormat = (D3DFORMAT*)(SendDlgItemMessage(hDlg, IDC_D3DS_BACK_BUFFER_FORMATS, CB_GETITEMDATA, iSelectedBackBufferFormat, 0));

    // Liste leeren

    DeleteListData(hDlg, IDC_D3DS_Z_STENCIL_BUFFER_FORMATS);

    // Aktuellen Videomodus abfragen

    g_pD3DTemp->GetAdapterDisplayMode(iSelectedAdapter, &CurrentVideoMode);

    // Jedes Format in der Liste durchgehen und prüfen, ob es verfügbar ist

    for(int iFormat = 0; iFormat < 7; iFormat++)
    {
        // Unterstützung abfragen

        if(SUCCEEDED(g_pD3DTemp->CheckDeviceFormat(iSelectedAdapter,
                                                   *pSelectedDeviceType,
                                                   bWindowed ? CurrentVideoMode.Format
                                                               : pSelectedVideoMode->Format,
                                                   D3DUSAGE_DEPTHSTENCIL,
                                                   D3DRTYPE_SURFACE,
                                                   aFormat[iFormat])))
        {
            // Passt das Format zum Bildpufferformat?

            if(SUCCEEDED(g_pD3DTemp->CheckDepthStencilMatch(iSelectedAdapter,
                                                            *pSelectedDeviceType,
                                                            bWindowed ? CurrentVideoMode.Format
                                                                        : pSelectedVideoMode->Format,
                                                            *pSelectedBackBufferFormat,
                                                            aFormat[iFormat])))
            {
                // Formattext abfragen und Text generieren

                GetFormatString(aFormat[iFormat], acZStencilBufferString);

                // Listeneintrag generieren

                iIndex = (int)(SendDlgItemMessage(hDlg, IDC_D3DS_Z_STENCIL_BUFFER_FORMATS, CB_ADDSTRING,
                                                  0, (LPARAM)(acZStencilBufferString)));

                // Dem Eintrag das Format zuweisen

                pFormat = (D3DFORMAT*)(tbMemAlloc(sizeof(D3DFORMAT)));
                *pFormat = aFormat[iFormat];
                SendDlgItemMessage(hDlg, IDC_D3DS_Z_STENCIL_BUFFER_FORMATS, CB_SETITEMDATA,
                                   iIndex, (LPARAM)(pFormat));
            }
        }
    }

    // Erstes Z-Stencil-Buffer-Format auswählen

    SendDlgItemMessage(hDlg, IDC_D3DS_Z_STENCIL_BUFFER_FORMATS, CB_SETCURSEL, 0, 0);

    return TB_OK;
}

// ******************************************************************

// Auflisten der Multi-Sampling-Typen

tbResult EnumMultiSamplingTypes(HWND hDlg)
{
    int                     iSelectedAdapter;
    int                     iSelectedDeviceType;
    D3DDEVTYPE*             pSelectedDeviceType;
    int                     iSelectedVideoMode;
    D3DDISPLAYMODE*         pSelectedVideoMode;
    BOOL                    bWindowed;
    int                     iSelectedBackBufferFormat;
    D3DFORMAT*              pSelectedBackBufferFormat;
    int                     iSelectedZStencilBufferFormat;
    D3DFORMAT*              pSelectedZStencilBufferFormat;
    D3DMULTISAMPLE_TYPE     aMultiSamplingType[] = {D3DMULTISAMPLE_NONE,
                                                    D3DMULTISAMPLE_NONMASKABLE,
                                                    D3DMULTISAMPLE_2_SAMPLES,
                                                    D3DMULTISAMPLE_3_SAMPLES,
                                                    D3DMULTISAMPLE_4_SAMPLES,
                                                    D3DMULTISAMPLE_5_SAMPLES,
                                                    D3DMULTISAMPLE_6_SAMPLES,
                                                    D3DMULTISAMPLE_7_SAMPLES,
                                                    D3DMULTISAMPLE_8_SAMPLES,
                                                    D3DMULTISAMPLE_9_SAMPLES,
                                                    D3DMULTISAMPLE_10_SAMPLES,
                                                    D3DMULTISAMPLE_11_SAMPLES,
                                                    D3DMULTISAMPLE_12_SAMPLES,
                                                    D3DMULTISAMPLE_13_SAMPLES,
                                                    D3DMULTISAMPLE_14_SAMPLES,
                                                    D3DMULTISAMPLE_15_SAMPLES,
                                                    D3DMULTISAMPLE_16_SAMPLES};
    char                    acMultiSamplingTypeString[256];
    int                     iIndex;
    D3DMULTISAMPLE_TYPE*    pMultiSamplingType;
    DWORD                   dwNumQualities;


    // Gewählte Optionen abfragen

    iSelectedAdapter = (int)(SendDlgItemMessage(hDlg, IDC_D3DS_ADAPTERS, CB_GETCURSEL, 0, 0));
    iSelectedDeviceType = (int)(SendDlgItemMessage(hDlg, IDC_D3DS_DEVICE_TYPES, CB_GETCURSEL, 0, 0));
    pSelectedDeviceType = (D3DDEVTYPE*)(SendDlgItemMessage(hDlg, IDC_D3DS_DEVICE_TYPES, CB_GETITEMDATA, iSelectedDeviceType, 0));
    iSelectedVideoMode = (int)(SendDlgItemMessage(hDlg, IDC_D3DS_VIDEO_MODES, CB_GETCURSEL, 0, 0));
    pSelectedVideoMode = (D3DDISPLAYMODE*)(SendDlgItemMessage(hDlg, IDC_D3DS_VIDEO_MODES, CB_GETITEMDATA, iSelectedVideoMode, 0));
    bWindowed = IsDlgButtonChecked(hDlg, IDC_D3DS_WINDOWED_MODE) == BST_CHECKED;
    iSelectedBackBufferFormat = (int)(SendDlgItemMessage(hDlg, IDC_D3DS_BACK_BUFFER_FORMATS, CB_GETCURSEL, 0, 0));
    pSelectedBackBufferFormat = (D3DFORMAT*)(SendDlgItemMessage(hDlg, IDC_D3DS_BACK_BUFFER_FORMATS, CB_GETITEMDATA, iSelectedBackBufferFormat, 0));
    iSelectedZStencilBufferFormat = (int)(SendDlgItemMessage(hDlg, IDC_D3DS_Z_STENCIL_BUFFER_FORMATS, CB_GETCURSEL, 0, 0));
    pSelectedZStencilBufferFormat = (D3DFORMAT*)(SendDlgItemMessage(hDlg, IDC_D3DS_Z_STENCIL_BUFFER_FORMATS, CB_GETITEMDATA, iSelectedZStencilBufferFormat, 0));

    // Liste leeren

    DeleteListData(hDlg, IDC_D3DS_MULTI_SAMPLING_TYPES);

    // Alle Multi-Sampling-Typen durchgehen und testen

    for(int iMultiSamplingType = 0; iMultiSamplingType < 17; iMultiSamplingType++)
    {
        // Kompatibilität mit dem Bildpufferformat prüfen

        if(SUCCEEDED(g_pD3DTemp->CheckDeviceMultiSampleType(iSelectedAdapter, 
                                                            *pSelectedDeviceType,
                                                            *pSelectedBackBufferFormat,
                                                            bWindowed,
                                                            aMultiSamplingType[iMultiSamplingType],
                                                            &dwNumQualities)))
        {
            if(dwNumQualities > 0)
            {
                // Kompatibilität mit dem Z-Stencil-Buffer-Format prüfen

                if(SUCCEEDED(g_pD3DTemp->CheckDeviceMultiSampleType(iSelectedAdapter, 
                                                                    *pSelectedDeviceType,
                                                                    *pSelectedZStencilBufferFormat,
                                                                    bWindowed,
                                                                    aMultiSamplingType[iMultiSamplingType],
                                                                    &dwNumQualities)))
                {
                    if(dwNumQualities > 0)
                    {
                        // Der Multi-Sampling-Typ ist OK!

                        if(iMultiSamplingType == 0) strcpy(acMultiSamplingTypeString, "Kein Multi-Sampling");
                        else if(iMultiSamplingType == 1) strcpy(acMultiSamplingTypeString, "Non-Maskable");
                        else sprintf(acMultiSamplingTypeString, "%d Samples", iMultiSamplingType);

                        pMultiSamplingType = (D3DMULTISAMPLE_TYPE*)(tbMemAlloc(sizeof(D3DMULTISAMPLE_TYPE)));
                        *pMultiSamplingType = aMultiSamplingType[iMultiSamplingType];

                        // Listeneintrag erzeugen

                        iIndex = (int)(SendDlgItemMessage(hDlg, IDC_D3DS_MULTI_SAMPLING_TYPES, CB_ADDSTRING,
                                                          0, (LPARAM)(acMultiSamplingTypeString)));
                
                        // Dem Eintrag den Multi-Sampling-Typ zuweisen

                        SendDlgItemMessage(hDlg, IDC_D3DS_MULTI_SAMPLING_TYPES, CB_SETITEMDATA,
                                           iIndex, (LPARAM)(pMultiSamplingType));
                    }
                }
            }
        }
    }

    // Ersten Multi-Sampling-Typ auswählen

    SendDlgItemMessage(hDlg, IDC_D3DS_MULTI_SAMPLING_TYPES, CB_SETCURSEL, 0, 0);

    return TB_OK;
}

// ******************************************************************

// Auflisten aller Multi-Sampling-Qualitätsstufen

tbResult EnumMultiSamplingQualities(HWND hDlg)
{
    int                     iSelectedAdapter;
    int                     iSelectedDeviceType;
    D3DDEVTYPE*             pSelectedDeviceType;
    int                     iSelectedVideoMode;
    D3DDISPLAYMODE*         pSelectedVideoMode;
    BOOL                    bWindowed;
    int                     iSelectedBackBufferFormat;
    D3DFORMAT*              pSelectedBackBufferFormat;
    int                     iSelectedMultiSamplingType;
    D3DMULTISAMPLE_TYPE*    pSelectedMultiSamplingType;
    DWORD                   dwNumMultiSamplingQualities;
    char                    acMultiSamplingQualityString[256];


    // Gewählte Optionen abfragen

    iSelectedAdapter = (int)(SendDlgItemMessage(hDlg, IDC_D3DS_ADAPTERS, CB_GETCURSEL, 0, 0));
    iSelectedDeviceType = (int)(SendDlgItemMessage(hDlg, IDC_D3DS_DEVICE_TYPES, CB_GETCURSEL, 0, 0));
    pSelectedDeviceType = (D3DDEVTYPE*)(SendDlgItemMessage(hDlg, IDC_D3DS_DEVICE_TYPES, CB_GETITEMDATA, iSelectedDeviceType, 0));
    iSelectedVideoMode = (int)(SendDlgItemMessage(hDlg, IDC_D3DS_VIDEO_MODES, CB_GETCURSEL, 0, 0));
    pSelectedVideoMode = (D3DDISPLAYMODE*)(SendDlgItemMessage(hDlg, IDC_D3DS_VIDEO_MODES, CB_GETITEMDATA, iSelectedVideoMode, 0));
    bWindowed = IsDlgButtonChecked(hDlg, IDC_D3DS_WINDOWED_MODE) == BST_CHECKED;
    iSelectedBackBufferFormat = (int)(SendDlgItemMessage(hDlg, IDC_D3DS_BACK_BUFFER_FORMATS, CB_GETCURSEL, 0, 0));
    pSelectedBackBufferFormat = (D3DFORMAT*)(SendDlgItemMessage(hDlg, IDC_D3DS_BACK_BUFFER_FORMATS, CB_GETITEMDATA, iSelectedBackBufferFormat, 0));
    iSelectedMultiSamplingType = (int)(SendDlgItemMessage(hDlg, IDC_D3DS_MULTI_SAMPLING_TYPES, CB_GETCURSEL, 0, 0));
    pSelectedMultiSamplingType = (D3DMULTISAMPLE_TYPE*)(SendDlgItemMessage(hDlg, IDC_D3DS_MULTI_SAMPLING_TYPES, CB_GETITEMDATA, iSelectedMultiSamplingType, 0));

    // Liste leeren

    DeleteListData(hDlg, IDC_D3DS_MULTI_SAMPLING_QUALITIES);

    // Anzahl der Qualitätsstufen abfragen

    g_pD3DTemp->CheckDeviceMultiSampleType(iSelectedAdapter, 
                                           *pSelectedDeviceType,
                                           *pSelectedBackBufferFormat,
                                           bWindowed,
                                           *pSelectedMultiSamplingType,
                                           &dwNumMultiSamplingQualities);

    // Listeneinträge erzeugen

    for(int iQuality = 0; iQuality < (int)(dwNumMultiSamplingQualities); iQuality++)
    {
        sprintf(acMultiSamplingQualityString, "Qualitätsstufe %d (von max. %d)",
                iQuality + 1, dwNumMultiSamplingQualities);
        SendDlgItemMessage(hDlg, IDC_D3DS_MULTI_SAMPLING_QUALITIES, CB_ADDSTRING,
                           0, (LPARAM)(acMultiSamplingQualityString));
    }

    // Höchste Qualitätsstufe auswählen

    SendDlgItemMessage(hDlg, IDC_D3DS_MULTI_SAMPLING_QUALITIES, CB_SETCURSEL,
                       dwNumMultiSamplingQualities - 1, 0);

    return TB_OK;
}

// ******************************************************************

// Diese Funktion durchsucht eine Dialogliste nach einem bestimmten Element.

tbResult FindListElement(HWND hDlg,
                         int iDialogItem,
                         void* pData,
                         int iSizeOfData,
                         int* piOut)
{
    int     iNumElements;
    void*   pElementData;


    // Parameter prüfen

    if(pData == NULL) TB_ERROR_NULL_POINTER("pData", TB_ERROR);


    // Anzahl der Listenelemente abfragen

    iNumElements = (int)(SendDlgItemMessage(hDlg, iDialogItem, CB_GETCOUNT, 0, 0));
    if(iNumElements == CB_ERR) return TB_ERROR;

    // Alle Elemente durchgehen

    for(int iElement = 0; iElement < iNumElements; iElement++)
    {
        // Daten des Elements abfragen und mit den angegebenen Daten vergleichen

        pElementData = (void*)(SendDlgItemMessage(hDlg, iDialogItem, CB_GETITEMDATA, iElement, 0));
        if(pElementData != (void*)(CB_ERR))
        {
            if(!memcmp(pData, pElementData, iSizeOfData))
            {
                // Gefunden!

                *piOut = iElement;
                return TB_OK;
            }
        }
    }

    return TB_ERROR;
}

// ******************************************************************

// Diese Funktion aktiviert in einer Dialogliste ein bestimmtes Element.

tbResult SelectListElement(HWND hDlg,
                           int iDialogItem,
                           void* pData,
                           int iSizeOfData,
                           int* piOut)
{
    int iIndex;

    // Nach dem Element suchen

    if(FindListElement(hDlg, iDialogItem, pData, iSizeOfData, &iIndex)) return TB_ERROR;

    // Element gefunden! Auswählen.

    SendDlgItemMessage(hDlg, iDialogItem, CB_SETCURSEL, iIndex, 0);
    if(piOut != NULL) *piOut = iIndex;

    return TB_OK;
}

// ******************************************************************

// Diese Funktion speichert die Einstellungen in eine Struktur.

tbResult GetParameters(HWND hDlg,
                       SDirect3DParameters* pOut)
{
    int     iIndex;
    void*   pTemp;


    // Parameter prüfen

    if(pOut == NULL) TB_ERROR_NULL_POINTER("pOut", TB_ERROR);


    // Alle Parameter abfragen und speichern, vorher noch die Struktur leeren

    ZeroMemory(pOut, sizeof(SDirect3DParameters));
    
    // Adapter

    pOut->iAdapter = (int)(SendDlgItemMessage(hDlg, IDC_D3DS_ADAPTERS, CB_GETCURSEL, 0, 0));
    
    // Gerätetyp

    iIndex = (int)(SendDlgItemMessage(hDlg, IDC_D3DS_DEVICE_TYPES, CB_GETCURSEL, 0, 0));    
    pTemp = ((void*)(SendDlgItemMessage(hDlg, IDC_D3DS_DEVICE_TYPES, CB_GETITEMDATA, iIndex, 0)));
    if(pTemp != (void*)(CB_ERR)) pOut->DeviceType = *((D3DDEVTYPE*)(pTemp));

    // Fenster-/Vollbildmodus

    pOut->bWindowed = IsDlgButtonChecked(hDlg, IDC_D3DS_WINDOWED_MODE) == BST_CHECKED;

    // Videomodus

    iIndex = (int)(SendDlgItemMessage(hDlg, IDC_D3DS_VIDEO_MODES, CB_GETCURSEL, 0, 0));
    pTemp = ((void*)(SendDlgItemMessage(hDlg, IDC_D3DS_VIDEO_MODES, CB_GETITEMDATA, iIndex, 0)));
    if(pTemp != (void*)(CB_ERR)) pOut->VideoMode = *((D3DDISPLAYMODE*)(pTemp));

    // Bildpufferformat

    iIndex = (int)(SendDlgItemMessage(hDlg, IDC_D3DS_BACK_BUFFER_FORMATS, CB_GETCURSEL, 0, 0));
    pTemp = ((void*)(SendDlgItemMessage(hDlg, IDC_D3DS_BACK_BUFFER_FORMATS, CB_GETITEMDATA, iIndex, 0)));
    if(pTemp != (void*)(CB_ERR)) pOut->BackBufferFormat = *((D3DFORMAT*)(pTemp));

    // Z-Stencil-Buffer-Format

    iIndex = (int)(SendDlgItemMessage(hDlg, IDC_D3DS_Z_STENCIL_BUFFER_FORMATS, CB_GETCURSEL, 0, 0));
    pTemp = ((void*)(SendDlgItemMessage(hDlg, IDC_D3DS_Z_STENCIL_BUFFER_FORMATS, CB_GETITEMDATA, iIndex, 0)));
    if(pTemp != (void*)(CB_ERR)) pOut->ZStencilBufferFormat = *((D3DFORMAT*)(pTemp));

    // Multi-Sampling-Typ

    iIndex = (int)(SendDlgItemMessage(hDlg, IDC_D3DS_MULTI_SAMPLING_TYPES, CB_GETCURSEL, 0, 0));
    pTemp = ((void*)(SendDlgItemMessage(hDlg, IDC_D3DS_MULTI_SAMPLING_TYPES, CB_GETITEMDATA, iIndex, 0)));
    if(pTemp != (void*)(CB_ERR)) pOut->MultiSamplingType = *((D3DMULTISAMPLE_TYPE*)(pTemp));

    // Multi-Sampling-Qualität

    pOut->dwMultiSamplingQuality = (DWORD)(SendDlgItemMessage(hDlg, IDC_D3DS_MULTI_SAMPLING_QUALITIES, CB_GETCURSEL, 0, 0));

    // Transformation und Beleuchtung

    if(IsDlgButtonChecked(hDlg, IDC_D3DS_HARDWARE_TNL) == BST_CHECKED) pOut->dwFlags = D3DCREATE_HARDWARE_VERTEXPROCESSING;
    else pOut->dwFlags = D3DCREATE_SOFTWARE_VERTEXPROCESSING;

    // Fähigkeiten abfragen

    g_pD3DTemp->GetDeviceCaps(pOut->iAdapter, pOut->DeviceType, &pOut->DeviceCaps);

    return TB_OK;
}

// ******************************************************************

// Diese Funktion aktiviert die Einstellungen aus einer Struktur

// so weit wie möglich.

tbResult SetParameters(HWND hDlg,
                       SDirect3DParameters* pParameters)
{
    // Alle Parameter in der Liste suchen und/oder auswählen

    SendDlgItemMessage(hDlg, IDC_D3DS_ADAPTERS, CB_SETCURSEL, pParameters->iAdapter, 0);
    EnumDeviceTypes(hDlg); SelectListElement(hDlg, IDC_D3DS_DEVICE_TYPES, &pParameters->DeviceType, sizeof(D3DDEVTYPE), NULL);
    CheckDlgButton(hDlg, IDC_D3DS_WINDOWED_MODE, pParameters->bWindowed ? BST_CHECKED : BST_UNCHECKED);
    CheckDlgButton(hDlg, IDC_D3DS_FULLSCREEN_MODE, !pParameters->bWindowed ? BST_CHECKED : BST_UNCHECKED);
    EnumVideoModes(hDlg); SelectListElement(hDlg, IDC_D3DS_VIDEO_MODES, &pParameters->VideoMode, sizeof(D3DDISPLAYMODE), NULL);
    EnumBackBufferFormats(hDlg); SelectListElement(hDlg, IDC_D3DS_BACK_BUFFER_FORMATS, &pParameters->BackBufferFormat, sizeof(D3DFORMAT), NULL);
    EnumZStencilBufferFormats(hDlg); SelectListElement(hDlg, IDC_D3DS_Z_STENCIL_BUFFER_FORMATS, &pParameters->ZStencilBufferFormat, sizeof(D3DFORMAT), NULL);
    EnumMultiSamplingTypes(hDlg); SelectListElement(hDlg, IDC_D3DS_MULTI_SAMPLING_TYPES, &pParameters->MultiSamplingType, sizeof(D3DMULTISAMPLE_TYPE), NULL);
    EnumMultiSamplingQualities(hDlg); if(pParameters->dwMultiSamplingQuality != -1) SendDlgItemMessage(hDlg, IDC_D3DS_MULTI_SAMPLING_QUALITIES, CB_SETCURSEL, pParameters->dwMultiSamplingQuality, 0);
    CheckDlgButton(hDlg, IDC_D3DS_HARDWARE_TNL, pParameters->dwFlags & D3DCREATE_HARDWARE_VERTEXPROCESSING ? BST_CHECKED : BST_UNCHECKED);
    CheckDlgButton(hDlg, IDC_D3DS_SOFTWARE_TNL, pParameters->dwFlags & D3DCREATE_SOFTWARE_VERTEXPROCESSING ? BST_CHECKED : BST_UNCHECKED);

    return TB_OK;
}

// ******************************************************************

// Dialogfunktion

INT_PTR CALLBACK D3DEnumDialogProc(HWND hDlg,
                                   unsigned int uiMsg,
                                   WPARAM WParam,
                                   LPARAM LParam)
{
    char    acFilename[256];
    FILE*   pFile;


    // Nachricht verarbeiten

    switch(uiMsg)
    {
    case WM_INITDIALOG:
        // Optionskästchen einstellen

        CheckDlgButton(hDlg, IDC_D3DS_FULLSCREEN_MODE, BST_CHECKED);
        CheckDlgButton(hDlg, IDC_D3DS_HARDWARE_TNL, BST_CHECKED);

        // Alles abzählen

        EnumAdapters(hDlg);
        EnumDeviceTypes(hDlg);
        EnumVideoModes(hDlg);
        EnumBackBufferFormats(hDlg);
        EnumZStencilBufferFormats(hDlg);
        EnumMultiSamplingTypes(hDlg);
        EnumMultiSamplingQualities(hDlg);
        break;

    case WM_CLOSE:
        // Code 2 zurückliefern; das bedeutet: Dialog abgebrochen

        EndDialog(hDlg, 2);
        break;

    case WM_DESTROY:
        // Aufräumen

        DeleteListData(hDlg, IDC_D3DS_ADAPTERS);
        DeleteListData(hDlg, IDC_D3DS_DEVICE_TYPES);
        DeleteListData(hDlg, IDC_D3DS_VIDEO_MODES);
        DeleteListData(hDlg, IDC_D3DS_BACK_BUFFER_FORMATS);
        DeleteListData(hDlg, IDC_D3DS_Z_STENCIL_BUFFER_FORMATS);
        DeleteListData(hDlg, IDC_D3DS_MULTI_SAMPLING_TYPES);
        DeleteListData(hDlg, IDC_D3DS_MULTI_SAMPLING_QUALITIES);
        break;

    case WM_COMMAND:        
        switch(LOWORD(WParam))
        {
        case IDC_D3DS_ADAPTERS:
            if(HIWORD(WParam) == CBN_SELCHANGE)
            {
                // Es wurde ein neuer Adapter gewählt! Gerätetypen neu auflisten.

                GetParameters(hDlg, &g_TempParameters);
                EnumDeviceTypes(hDlg);
                EnumVideoModes(hDlg);
                EnumBackBufferFormats(hDlg);
                EnumZStencilBufferFormats(hDlg);
                EnumMultiSamplingTypes(hDlg);
                EnumMultiSamplingQualities(hDlg);
                SetParameters(hDlg, &g_TempParameters);
            }
            else
            {
                // Informationstext anzeigen

                SetDlgItemText(hDlg, IDC_D3DS_DESCRIPTION, ADAPTER_DESCRIPTION);
            }
            break;

        case IDC_D3DS_DEVICE_TYPES:
            if(HIWORD(WParam) == CBN_SELCHANGE)
            {
                // Es wurde ein neuer Gerätetyp gewählt! Videomodi neu auflisten.

                GetParameters(hDlg, &g_TempParameters);
                EnumVideoModes(hDlg);
                EnumBackBufferFormats(hDlg);
                EnumZStencilBufferFormats(hDlg);
                EnumMultiSamplingTypes(hDlg);
                EnumMultiSamplingQualities(hDlg);
                SetParameters(hDlg, &g_TempParameters);
            }
            else
            {
                // Informationstext anzeigen

                SetDlgItemText(hDlg, IDC_D3DS_DESCRIPTION, DEVICE_TYPE_DESCRIPTION);
            }
            break;

        case IDC_D3DS_WINDOWED_MODE:
        case IDC_D3DS_FULLSCREEN_MODE:
            if(HIWORD(WParam) == BN_CLICKED)
            {
                // Es wurde zwischen Fenster- und Vollbildmodus gewechselt!

                // Die Bildpufferformate müssen neu aufgelistet werden.

                GetParameters(hDlg, &g_TempParameters);
                EnumVideoModes(hDlg);
                EnumBackBufferFormats(hDlg);
                EnumZStencilBufferFormats(hDlg);
                EnumMultiSamplingTypes(hDlg);
                EnumMultiSamplingQualities(hDlg);
                SetParameters(hDlg, &g_TempParameters);
            }

            // Informationstext anzeigen

            SetDlgItemText(hDlg, IDC_D3DS_DESCRIPTION, WINDOWED_FULLSCREEN_DESCRIPTION);
            break;

        case IDC_D3DS_VIDEO_MODES:
            if(HIWORD(WParam) == CBN_SELCHANGE)
            {
                // Es wurde ein neuer Videomodus gewählt! Bildpufferformate neu auflisten.

                GetParameters(hDlg, &g_TempParameters);
                EnumBackBufferFormats(hDlg);
                EnumZStencilBufferFormats(hDlg);
                EnumMultiSamplingTypes(hDlg);
                EnumMultiSamplingQualities(hDlg);
                SetParameters(hDlg, &g_TempParameters);
            }
            else
            {
                // Informationstext anzeigen

                SetDlgItemText(hDlg, IDC_D3DS_DESCRIPTION, VIDEO_MODE_DESCRIPTION);
            }
            break;

        case IDC_D3DS_BACK_BUFFER_FORMATS:
            if(HIWORD(WParam) == CBN_SELCHANGE)
            {
                // Es wurde ein neues Bildpufferformat gewählt! Z-Stencil-Buffer-Formate neu auflisten.

                GetParameters(hDlg, &g_TempParameters);
                EnumZStencilBufferFormats(hDlg);
                EnumMultiSamplingTypes(hDlg);
                EnumMultiSamplingQualities(hDlg);
                SetParameters(hDlg, &g_TempParameters);
            }
            else
            {
                // Informationstext anzeigen

                SetDlgItemText(hDlg, IDC_D3DS_DESCRIPTION, BACK_BUFFER_FORMAT_DESCRIPTION);
            }
            break;

        case IDC_D3DS_Z_STENCIL_BUFFER_FORMATS:
            if(HIWORD(WParam) == CBN_SELCHANGE)
            {
                // Es wurde ein neues Z-Stencil-Buffer-Format gewählt! Multi-Sampling-Typen neu auflisten.

                GetParameters(hDlg, &g_TempParameters);
                EnumMultiSamplingTypes(hDlg);
                EnumMultiSamplingQualities(hDlg);
                SetParameters(hDlg, &g_TempParameters);
            }
            else
            {
                // Informationstext anzeigen

                SetDlgItemText(hDlg, IDC_D3DS_DESCRIPTION, Z_STENCIL_BUFFER_FORMAT_DESCRIPTION);
            }
            break;

        case IDC_D3DS_MULTI_SAMPLING_TYPES:
            if(HIWORD(WParam) == CBN_SELCHANGE)
            {
                // Es wurde ein neuer Multi-Sampling-Typ gewählt! Qualitätsstufen neu auflisten.

                GetParameters(hDlg, &g_TempParameters);
                EnumMultiSamplingQualities(hDlg);
                SetParameters(hDlg, &g_TempParameters);
            }
            else
            {
                // Informationstext anzeigen

                SetDlgItemText(hDlg, IDC_D3DS_DESCRIPTION, MULTI_SAMPLING_TYPE_DESCRIPTION);
            }
            break;

        case IDC_D3DS_MULTI_SAMPLING_QUALITIES:
            if(HIWORD(WParam) != CBN_SELCHANGE)
            {
                // Informationstext anzeigen

                SetDlgItemText(hDlg, IDC_D3DS_DESCRIPTION, MULTI_SAMPLING_QUALITY_DESCRIPTION);
            }
            break;

        case IDC_D3DS_HARDWARE_TNL:
        case IDC_D3DS_SOFTWARE_TNL:
            // Informationstext anzeigen

            SetDlgItemText(hDlg, IDC_D3DS_DESCRIPTION, TNL_DESCRIPTION);
            break;

        case IDC_D3DS_SAVE:
            {
                strcpy(acFilename, "*.cfg");
                OPENFILENAME Filename = {sizeof(OPENFILENAME), hDlg, NULL, ".CFG-Dateien\0.cfg", NULL,
                                         0, 1, acFilename, 255, NULL, 0, NULL, ".CFG-Datei speichern",
                                         OFN_OVERWRITEPROMPT | OFN_HIDEREADONLY | OFN_NOCHANGEDIR,
                                         0, 1, ".cfg", 0, NULL, NULL};

                if(GetSaveFileName(&Filename))
                {
                    // Parameter abfragen und speichern

                    GetParameters(hDlg, &g_TempParameters);
                    pFile = fopen(acFilename, "wb");
                    fwrite(&g_TempParameters, sizeof(SDirect3DParameters), 1, pFile);
                    fclose(pFile);
                }
            }
            break;

        case IDC_D3DS_LOAD:
            {
                strcpy(acFilename, "*.cfg");
                OPENFILENAME Filename = {sizeof(OPENFILENAME), hDlg, NULL, ".CFG-Dateien\0.cfg\0Alle Dateien\0*.*", NULL,
                                         0, 1, acFilename, 255, NULL, 0, NULL, ".CFG-Datei laden",
                                         OFN_FILEMUSTEXIST | OFN_NOCHANGEDIR,
                                         0, 1, ".cfg", 0, NULL, NULL};
                
                if(GetOpenFileName(&Filename))
                {
                    // Parameter einlesen und aktivieren

                    pFile = fopen(acFilename, "rb");
                    GetParameters(hDlg, &g_TempParameters);
                    fread(&g_TempParameters, sizeof(SDirect3DParameters), 1, pFile);
                    fclose(pFile);
                    SetParameters(hDlg, &g_TempParameters);
                }
            }
            break;

        case IDC_D3DS_OK:
            // Parameter abfragen und einen eventuellen Fehler vermeiden

            GetParameters(hDlg, g_pDirect3DParameters);
            if(g_pDirect3DParameters->DeviceType != D3DDEVTYPE_HAL &&
               !(g_pDirect3DParameters->dwFlags & D3DCREATE_SOFTWARE_VERTEXPROCESSING))
            {
                if(g_pDirect3DParameters->dwFlags & D3DCREATE_HARDWARE_VERTEXPROCESSING) g_pDirect3DParameters->dwFlags ^= D3DCREATE_HARDWARE_VERTEXPROCESSING;
                g_pDirect3DParameters->dwFlags |= D3DCREATE_SOFTWARE_VERTEXPROCESSING;
            }
            
            // Code 0 zurückliefern; das bedeutet: alles OK.

            EndDialog(hDlg, 0);
            break;

        case IDC_D3DS_CANCEL:
            // Code 2 zurückliefern; das bedeutet: Dialog abgebrochen

            EndDialog(hDlg, 2);
            break;
        }
        break;

    default:
        // Standardverarbeitung der Nachricht

        return FALSE;
        break;
    }

    // Nachricht wurde verarbeitet.

    return TRUE;
}

// ******************************************************************

// Die Hauptfunktion: sie startet das Dialogfenster zur Auswahl aller

// Direct3D-Parameter (Adapter, Gerätetyp, Videomodus, ...) und speichert

// die Benutzerauswahl in einer Struktur vom Typ "SDirect3DParameters".

tbResult GetDirect3DParameters(SDirect3DParameters* pOut)
{
    int iResult;

    // Parameter prüfen

    if(pOut == NULL) TB_ERROR_NULL_POINTER("pOut", TB_ERROR);


    // Direct3D-Schnittstelle erzeugen. Sie wird vom Dialog zur

    // Auflistung benötigt.

    g_pD3DTemp = Direct3DCreate9(D3D_SDK_VERSION);
    if(g_pD3DTemp == NULL) return TB_ERROR;

    // Den globalen Zeiger auf die Struktur setzen, damit sie später

    // gefüllt werden kann

    g_pDirect3DParameters = pOut;

    // Dialogfenster aufrufen

    iResult = (int)(DialogBox(GetModuleHandle(NULL),
                              MAKEINTRESOURCE(IDD_DIRECT3D_SETTINGS),
                              NULL,
                              D3DEnumDialogProc));

    // Schnittstelle wieder freigeben

    TB_SAFE_RELEASE(g_pD3DTemp);

    // Rückgabewert des Dialogfensters auswerten

    if(iResult == 0) return TB_OK;                  // Alles OK!

    else if(iResult == 1) return TB_ERROR;          // Fehler!

    else /*if(iResult == 2)*/ return TB_CANCELED;   // Dialog abgebrochen

}

// ******************************************************************



// Nachrichtenschleife

    ZeroMemory(&Message, sizeof(MSG));
    while(Message.message != WM_QUIT)
    {
        // Eventuelle Nachrichten verarbeiten

        while(PeekMessage(&Message, NULL, 0, 0, PM_REMOVE))
        {
            Translate(&Message);
            Dispatch(&Message);
        }
    }
    return FALSE;
}


Doch, es gibt immer noch folgende Fehler:

[cpp]
1>------ Build started: Project: Dialog Fenster, Configuration: Debug Win32 ------
1>Compiling...
1>Direct3DEnum.cpp
1>c:\programme\microsoft visual studio 9.0\alle projekte\dialog fenster\dialog fenster\direct3denum.cpp(52) : error C2601: 'GetFormatString' : local function definitions are illegal
1> c:\programme\microsoft visual studio 9.0\alle projekte\dialog fenster\dialog fenster\direct3denum.cpp(16): this line contains a '{' which has not yet been matched
1>c:\programme\microsoft visual studio 9.0\alle projekte\dialog fenster\dialog fenster\direct3denum.cpp(120) : error C2601: 'DeleteListData' : local function definitions are illegal
1> c:\programme\microsoft visual studio 9.0\alle projekte\dialog fenster\dialog fenster\direct3denum.cpp(16): this line contains a '{' which has not yet been matched
1>c:\programme\microsoft visual studio 9.0\alle projekte\dialog fenster\dialog fenster\direct3denum.cpp(146) : error C2601: 'EnumAdapters' : local function definitions are illegal
1> c:\programme\microsoft visual studio 9.0\alle projekte\dialog fenster\dialog fenster\direct3denum.cpp(16): this line contains a '{' which has not yet been matched
1>c:\programme\microsoft visual studio 9.0\alle projekte\dialog fenster\dialog fenster\direct3denum.cpp(178) : error C2601: 'EnumDeviceTypes' : local function definitions are illegal
1> c:\programme\microsoft visual studio 9.0\alle projekte\dialog fenster\dialog fenster\direct3denum.cpp(16): this line contains a '{' which has not yet been matched
1>c:\programme\microsoft visual studio 9.0\alle projekte\dialog fenster\dialog fenster\direct3denum.cpp(229) : error C2601: 'EnumVideoModes' : local function definitions are illegal
1> c:\programme\microsoft visual studio 9.0\alle projekte\dialog fenster\dialog fenster\direct3denum.cpp(16): this line contains a '{' which has not yet been matched
1>c:\programme\microsoft visual studio 9.0\alle projekte\dialog fenster\dialog fenster\direct3denum.cpp(284) : error C2601: 'EnumBackBufferFormats' : local function definitions are illegal
1> c:\programme\microsoft visual studio 9.0\alle projekte\dialog fenster\dialog fenster\direct3denum.cpp(16): this line contains a '{' which has not yet been matched
1>c:\programme\microsoft visual studio 9.0\alle projekte\dialog fenster\dialog fenster\direct3denum.cpp(380) : error C2601: 'EnumZStencilBufferFormats' : local function definitions are illegal
1> c:\programme\microsoft visual studio 9.0\alle projekte\dialog fenster\dialog fenster\direct3denum.cpp(16): this line contains a '{' which has not yet been matched
1>c:\programme\microsoft visual studio 9.0\alle projekte\dialog fenster\dialog fenster\direct3denum.cpp(460) : error C2601: 'EnumMultiSamplingTypes' : local function definitions are illegal
1> c:\programme\microsoft visual studio 9.0\alle projekte\dialog fenster\dialog fenster\direct3denum.cpp(16): this line contains a '{' which has not yet been matched
1>c:\programme\microsoft visual studio 9.0\alle projekte\dialog fenster\dialog fenster\direct3denum.cpp(562) : error C2601: 'EnumMultiSamplingQualities' : local function definitions are illegal
1> c:\programme\microsoft visual studio 9.0\alle projekte\dialog fenster\dialog fenster\direct3denum.cpp(16): this line contains a '{' which has not yet been matched
1>c:\programme\microsoft visual studio 9.0\alle projekte\dialog fenster\dialog fenster\direct3denum.cpp(623) : error C2601: 'FindListElement' : local function definitions are illegal
1> c:\programme\microsoft visual studio 9.0\alle projekte\dialog fenster\dialog fenster\direct3denum.cpp(16): this line contains a '{' which has not yet been matched
1>c:\programme\microsoft visual studio 9.0\alle projekte\dialog fenster\dialog fenster\direct3denum.cpp(662) : error C2601: 'SelectListElement' : local function definitions are illegal
1> c:\programme\microsoft visual studio 9.0\alle projekte\dialog fenster\dialog fenster\direct3denum.cpp(16): this line contains a '{' which has not yet been matched
1>c:\programme\microsoft visual studio 9.0\alle projekte\dialog fenster\dialog fenster\direct3denum.cpp(679) : error C2601: 'GetParameters' : local function definitions are illegal
1> c:\programme\microsoft visual studio 9.0\alle projekte\dialog fenster\dialog fenster\direct3denum.cpp(16): this line contains a '{' which has not yet been matched
1>c:\programme\microsoft visual studio 9.0\alle projekte\dialog fenster\dialog fenster\direct3denum.cpp(740) : error C2601: 'SetParameters' : local function definitions are illegal
1> c:\programme\microsoft visual studio 9.0\alle projekte\dialog fenster\dialog fenster\direct3denum.cpp(16): this line contains a '{' which has not yet been matched
1>c:\programme\microsoft visual studio 9.0\alle projekte\dialog fenster\dialog fenster\direct3denum.cpp(763) : error C2601: 'D3DEnumDialogProc' : local function definitions are illegal
1> c:\programme\microsoft visual studio 9.0\alle projekte\dialog fenster\dialog fenster\direct3denum.cpp(16): this line contains a '{' which has not yet been matched
1>c:\programme\microsoft visual studio 9.0\alle projekte\dialog fenster\dialog fenster\direct3denum.cpp(1018) : error C2601: 'GetDirect3DParameters' : local function definitions are illegal
1> c:\programme\microsoft visual studio 9.0\alle projekte\dialog fenster\dialog fenster\direct3denum.cpp(16): this line contains a '{' which has not yet been matched
1>c:\programme\microsoft visual studio 9.0\alle projekte\dialog fenster\dialog fenster\direct3denum.cpp(1059) : error C3861: 'Translate': identifier not found
1>c:\programme\microsoft visual studio 9.0\alle projekte\dialog fenster\dialog fenster\direct3denum.cpp(1060) : error C3861: 'Dispatch': identifier not found
1>c:\programme\microsoft visual studio 9.0\alle projekte\dialog fenster\dialog fenster\direct3denum.cpp(152) : error C3861: 'DeleteListData': identifier not found
1>c:\programme\microsoft visual studio 9.0\alle projekte\dialog fenster\dialog fenster\direct3denum.cpp(155) : error C2065: 'g_pD3DTemp' : undeclared identifier
1>c:\programme\microsoft visual studio 9.0\alle projekte\dialog fenster\dialog fenster\direct3denum.cpp(155) : error C2227: left of '->GetAdapterCount' must point to class/struct/union/generic type
1> type is ''unknown-type''
1>c:\programme\microsoft visual studio 9.0\alle projekte\dialog fenster\dialog fenster\direct3denum.cpp(161) : error C2065: 'g_pD3DTemp' : undeclared identifier
1>c:\programme\microsoft visual studio 9.0\alle projekte\dialog fenster\dialog fenster\direct3denum.cpp(161) : error C2227: left of '->GetAdapterIdentifier' must point to class/struct/union/generic type
1> type is ''unknown-type''
1>c:\programme\microsoft visual studio 9.0\alle projekte\dialog fenster\dialog fenster\direct3denum.cpp(191) : error C3861: 'DeleteListData': identifier not found
1>c:\programme\microsoft visual studio 9.0\alle projekte\dialog fenster\dialog fenster\direct3denum.cpp(198) : error C2065: 'g_pD3DTemp' : undeclared identifier
1>c:\programme\microsoft visual studio 9.0\alle projekte\dialog fenster\dialog fenster\direct3denum.cpp(198) : error C2227: left of '->GetDeviceCaps' must point to class/struct/union/generic type
1> type is ''unknown-type''
1>c:\programme\microsoft visual studio 9.0\alle projekte\dialog fenster\dialog fenster\direct3denum.cpp(214) : error C2065: 'g_TempParameters' : undeclared identifier
1>c:\programme\microsoft visual studio 9.0\alle projekte\dialog fenster\dialog fenster\direct3denum.cpp(214) : error C2228: left of '.dwFlags' must have class/struct/union
1> type is ''unknown-type''
1>c:\programme\microsoft visual studio 9.0\alle projekte\dialog fenster\dialog fenster\direct3denum.cpp(243) : error C3861: 'DeleteListData': identifier not found
1>c:\programme\microsoft visual studio 9.0\alle projekte\dialog fenster\dialog fenster\direct3denum.cpp(249) : error C2065: 'g_pD3DTemp' : undeclared identifier
1>c:\programme\microsoft visual studio 9.0\alle projekte\dialog fenster\dialog fenster\direct3denum.cpp(249) : error C2227: left of '->GetAdapterModeCount' must point to class/struct/union/generic type
1> type is ''unknown-type''
1>c:\programme\microsoft visual studio 9.0\alle projekte\dialog fenster\dialog fenster\direct3denum.cpp(258) : error C2065: 'g_pD3DTemp' : undeclared identifier
1>c:\programme\microsoft visual studio 9.0\alle projekte\dialog fenster\dialog fenster\direct3denum.cpp(258) : error C2227: left of '->EnumAdapterModes' must point to class/struct/union/generic type
1> type is ''unknown-type''
1>c:\programme\microsoft visual studio 9.0\alle projekte\dialog fenster\dialog fenster\direct3denum.cpp(261) : error C3861: 'GetFormatString': identifier not found
1>c:\programme\microsoft visual studio 9.0\alle projekte\dialog fenster\dialog fenster\direct3denum.cpp(309) : error C3861: 'DeleteListData': identifier not found
1>c:\programme\microsoft visual studio 9.0\alle projekte\dialog fenster\dialog fenster\direct3denum.cpp(312) : error C2065: 'g_pD3DTemp' : undeclared identifier
1>c:\programme\microsoft visual studio 9.0\alle projekte\dialog fenster\dialog fenster\direct3denum.cpp(312) : error C2227: left of '->GetAdapterDisplayMode' must point to class/struct/union/generic type
1> type is ''unknown-type''
1>c:\programme\microsoft visual studio 9.0\alle projekte\dialog fenster\dialog fenster\direct3denum.cpp(318) : error C2065: 'g_pD3DTemp' : undeclared identifier
1>c:\programme\microsoft visual studio 9.0\alle projekte\dialog fenster\dialog fenster\direct3denum.cpp(318) : error C2227: left of '->CheckDeviceFormat' must point to class/struct/union/generic type
1> type is ''unknown-type''
1>c:\programme\microsoft visual studio 9.0\alle projekte\dialog fenster\dialog fenster\direct3denum.cpp(326) : error C2065: 'g_pD3DTemp' : undeclared identifier
1>c:\programme\microsoft visual studio 9.0\alle projekte\dialog fenster\dialog fenster\direct3denum.cpp(326) : error C2227: left of '->CheckDeviceType' must point to class/struct/union/generic type
1> type is ''unknown-type''
1>c:\programme\microsoft visual studio 9.0\alle projekte\dialog fenster\dialog fenster\direct3denum.cpp(337) : error C2065: 'g_pD3DTemp' : undeclared identifier
1>c:\programme\microsoft visual studio 9.0\alle projekte\dialog fenster\dialog fenster\direct3denum.cpp(337) : error C2227: left of '->CheckDeviceFormatConversion' must point to class/struct/union/generic type
1> type is ''unknown-type''
1>c:\programme\microsoft visual studio 9.0\alle projekte\dialog fenster\dialog fenster\direct3denum.cpp(350) : error C3861: 'GetFormatString': identifier not found
1>c:\programme\microsoft visual studio 9.0\alle projekte\dialog fenster\dialog fenster\direct3denum.cpp(410) : error C3861: 'DeleteListData': identifier not found
1>c:\programme\microsoft visual studio 9.0\alle projekte\dialog fenster\dialog fenster\direct3denum.cpp(413) : error C2065: 'g_pD3DTemp' : undeclared identifier
1>c:\programme\microsoft visual studio 9.0\alle projekte\dialog fenster\dialog fenster\direct3denum.cpp(413) : error C2227: left of '->GetAdapterDisplayMode' must point to class/struct/union/generic type
1> type is ''unknown-type''
1>c:\programme\microsoft visual studio 9.0\alle projekte\dialog fenster\dialog fenster\direct3denum.cpp(419) : error C2065: 'g_pD3DTemp' : undeclared identifier
1>c:\programme\microsoft visual studio 9.0\alle projekte\dialog fenster\dialog fenster\direct3denum.cpp(419) : error C2227: left of '->CheckDeviceFormat' must point to class/struct/union/generic type
1> type is ''unknown-type''
1>c:\programme\microsoft visual studio 9.0\alle projekte\dialog fenster\dialog fenster\direct3denum.cpp(428) : error C2065: 'g_pD3DTemp' : undeclared identifier
1>c:\programme\microsoft visual studio 9.0\alle projekte\dialog fenster\dialog fenster\direct3denum.cpp(428) : error C2227: left of '->CheckDepthStencilMatch' must point to class/struct/union/generic type
1> type is ''unknown-type''
1>c:\programme\microsoft visual studio 9.0\alle projekte\dialog fenster\dialog fenster\direct3denum.cpp(436) : error C3861: 'GetFormatString': identifier not found
1>c:\programme\microsoft visual studio 9.0\alle projekte\dialog fenster\dialog fenster\direct3denum.cpp(507) : error C3861: 'DeleteListData': identifier not found
1>c:\programme\microsoft visual studio 9.0\alle projekte\dialog fenster\dialog fenster\direct3denum.cpp(513) : error C2065: 'g_pD3DTemp' : undeclared identifier
1>c:\programme\microsoft visual studio 9.0\alle projekte\dialog fenster\dialog fenster\direct3denum.cpp(513) : error C2227: left of '->CheckDeviceMultiSampleType' must point to class/struct/union/generic type
1> type is ''unknown-type''
1>c:\programme\microsoft visual studio 9.0\alle projekte\dialog fenster\dialog fenster\direct3denum.cpp(523) : error C2065: 'g_pD3DTemp' : undeclared identifier
1>c:\programme\microsoft visual studio 9.0\alle projekte\dialog fenster\dialog fenster\direct3denum.cpp(523) : error C2227: left of '->CheckDeviceMultiSampleType' must point to class/struct/union/generic type
1> type is ''unknown-type''
1>c:\programme\microsoft visual studio 9.0\alle projekte\dialog fenster\dialog fenster\direct3denum.cpp(590) : error C3861: 'DeleteListData': identifier not found
1>c:\programme\microsoft visual studio 9.0\alle projekte\dialog fenster\dialog fenster\direct3denum.cpp(593) : error C2065: 'g_pD3DTemp' : undeclared identifier
1>c:\programme\microsoft visual studio 9.0\alle projekte\dialog fenster\dialog fenster\direct3denum.cpp(593) : error C2227: left of '->CheckDeviceMultiSampleType' must point to class/struct/union/generic type
1> type is ''unknown-type''
1>c:\programme\microsoft visual studio 9.0\alle projekte\dialog fenster\dialog fenster\direct3denum.cpp(666) : error C3861: 'FindListElement': identifier not found
1>c:\programme\microsoft visual studio 9.0\alle projekte\dialog fenster\dialog fenster\direct3denum.cpp(730) : error C2065: 'g_pD3DTemp' : undeclared identifier
1>c:\programme\microsoft visual studio 9.0\alle projekte\dialog fenster\dialog fenster\direct3denum.cpp(730) : error C2227: left of '->GetDeviceCaps' must point to class/struct/union/generic type
1> type is ''unknown-type''
1>c:\programme\microsoft visual studio 9.0\alle projekte\dialog fenster\dialog fenster\direct3denum.cpp(743) : error C3861: 'EnumDeviceTypes': identifier not found
1>c:\programme\microsoft visual studio 9.0\alle projekte\dialog fenster\dialog fenster\direct3denum.cpp(743) : error C3861: 'SelectListElement': identifier not found
1>c:\programme\microsoft visual studio 9.0\alle projekte\dialog fenster\dialog fenster\direct3denum.cpp(746) : error C3861: 'EnumVideoModes': identifier not found
1>c:\programme\microsoft visual studio 9.0\alle projekte\dialog fenster\dialog fenster\direct3denum.cpp(746) : error C3861: 'SelectListElement': identifier not found
1>c:\programme\microsoft visual studio 9.0\alle projekte\dialog fenster\dialog fenster\direct3denum.cpp(747) : error C3861: 'EnumBackBufferFormats': identifier not found
1>c:\programme\microsoft visual studio 9.0\alle projekte\dialog fenster\dialog fenster\direct3denum.cpp(747) : error C3861: 'SelectListElement': identifier not found
1>c:\programme\microsoft visual studio 9.0\alle projekte\dialog fenster\dialog fenster\direct3denum.cpp(748) : error C3861: 'EnumZStencilBufferFormats': identifier not found
1>c:\programme\microsoft visual studio 9.0\alle projekte\dialog fenster\dialog fenster\direct3denum.cpp(748) : error C3861: 'SelectListElement': identifier not found
1>c:\programme\microsoft visual studio 9.0\alle projekte\dialog fenster\dialog fenster\direct3denum.cpp(749) : error C3861: 'EnumMultiSamplingTypes': identifier not found
1>c:\programme\microsoft visual studio 9.0\alle projekte\dialog fenster\dialog fenster\direct3denum.cpp(749) : error C3861: 'SelectListElement': identifier not found
1>c:\programme\microsoft visual studio 9.0\alle projekte\dialog fenster\dialog fenster\direct3denum.cpp(750) : error C3861: 'EnumMultiSamplingQualities': identifier not found
1>c:\programme\microsoft visual studio 9.0\alle projekte\dialog fenster\dialog fenster\direct3denum.cpp(777) : error C3861: 'EnumAdapters': identifier not found
1>c:\programme\microsoft visual studio 9.0\alle projekte\dialog fenster\dialog fenster\direct3denum.cpp(778) : error C3861: 'EnumDeviceTypes': identifier not found
1>c:\programme\microsoft visual studio 9.0\alle projekte\dialog fenster\dialog fenster\direct3denum.cpp(779) : error C3861: 'EnumVideoModes': identifier not found
1>c:\programme\microsoft visual studio 9.0\alle projekte\dialog fenster\dialog fenster\direct3denum.cpp(780) : error C3861: 'EnumBackBufferFormats': identifier not found
1>c:\programme\microsoft visual studio 9.0\alle projekte\dialog fenster\dialog fenster\direct3denum.cpp(781) : error C3861: 'EnumZStencilBufferFormats': identifier not found
1>c:\programme\microsoft visual studio 9.0\alle projekte\dialog fenster\dialog fenster\direct3denum.cpp(782) : error C3861: 'EnumMultiSamplingTypes': identifier not found
1>c:\programme\microsoft visual studio 9.0\alle projekte\dialog fenster\dialog fenster\direct3denum.cpp(783) : error C3861: 'EnumMultiSamplingQualities': identifier not found
1>c:\programme\microsoft visual studio 9.0\alle projekte\dialog fenster\dialog fenster\direct3denum.cpp(793) : error C3861: 'DeleteListData': identifier not found
1>c:\programme\microsoft visual studio 9.0\alle projekte\dialog fenster\dialog fenster\direct3denum.cpp(794) : error C3861: 'DeleteListData': identifier not found
1>c:\programme\microsoft visual studio 9.0\alle projekte\dialog fenster\dialog fenster\direct3denum.cpp(795) : error C3861: 'DeleteListData': identifier not found
1>c:\programme\microsoft visual studio 9.0\alle projekte\dialog fenster\dialog fenster\direct3denum.cpp(796) : error C3861: 'DeleteListData': identifier not found
1>c:\programme\microsoft visual studio 9.0\alle projekte\dialog fenster\dialog fenster\direct3denum.cpp(797) : error C3861: 'DeleteListData': identifier not found
1>c:\programme\microsoft visual studio 9.0\alle projekte\dialog fenster\dialog fenster\direct3denum.cpp(798) : error C3861: 'DeleteListData': identifier not found
1>c:\programme\microsoft visual studio 9.0\alle projekte\dialog fenster\dialog fenster\direct3denum.cpp(799) : error C3861: 'DeleteListData': identifier not found
1>c:\programme\microsoft visual studio 9.0\alle projekte\dialog fenster\dialog fenster\direct3denum.cpp(809) : error C2065: 'g_TempParameters' : undeclared identifier
1>c:\programme\microsoft visual studio 9.0\alle projekte\dialog fenster\dialog fenster\direct3denum.cpp(809) : error C3861: 'GetParameters': identifier not found
1>c:\programme\microsoft visual studio 9.0\alle projekte\dialog fenster\dialog fenster\direct3denum.cpp(810) : error C3861: 'EnumDeviceTypes': identifier not found
1>c:\programme\microsoft visual studio 9.0\alle projekte\dialog fenster\dialog fenster\direct3denum.cpp(811) : error C3861: 'EnumVideoModes': identifier not found
1>c:\programme\microsoft visual studio 9.0\alle projekte\dialog fenster\dialog fenster\direct3denum.cpp(812) : error C3861: 'EnumBackBufferFormats': identifier not found
1>c:\programme\microsoft visual studio 9.0\alle projekte\dialog fenster\dialog fenster\direct3denum.cpp(813) : error C3861: 'EnumZStencilBufferFormats': identifier not found
1>c:\programme\microsoft visual studio 9.0\alle projekte\dialog fenster\dialog fenster\direct3denum.cpp(814) : error C3861: 'EnumMultiSamplingTypes': identifier not found
1>c:\programme\microsoft visual studio 9.0\alle projekte\dialog fenster\dialog fenster\direct3denum.cpp(815) : error C3861: 'EnumMultiSamplingQualities': identifier not found
1>c:\programme\microsoft visual studio 9.0\alle projekte\dialog fenster\dialog fenster\direct3denum.cpp(816) : error C2065: 'g_TempParameters' : undeclared identifier
1>c:\programme\microsoft visual studio 9.0\alle projekte\dialog fenster\dialog fenster\direct3denum.cpp(816) : e

rewb0rn

Supermoderator

Beiträge: 2 773

Wohnort: Berlin

Beruf: Indie Game Dev

  • Private Nachricht senden

6

14.12.2007, 23:57

1. Hör bitte damit auf, hier seitenweise Code reinzuposten. Du musst doch in der Lage dazu sein, dein Problem auf das wesentliche zu reduzieren, und nicht jedem hier zumuten, erstmal 500 Zeilen durchzuwälzen. Das sollte auch deine Chance auf Hilfe erhöhen, denn die Bereitschaft sich sowas anzugucken sinkt mit der Größe des Textes.

2. Der erste Fehler in deinem Code ist, dass du deine main Funktion überhaupt nicht abschließt, das sollte eigentlich direkt ins Auge stechen. Das tut doch weh:

Zitat

C-/C++-Quelltext

1
2
3
4
int WINAPI WinMain (HINSTANCE hInstance, HINSTANCE HPrevInstance,
                    char* pcCommandLine, int iShowCommand)
{
    MSG Message; // Nachricht


Weiter gucke ich jetzt nicht, das ist mir zuviel.

David Scherfgen

Administrator

Beiträge: 10 382

Wohnort: Hildesheim

Beruf: Wissenschaftlicher Mitarbeiter

  • Private Nachricht senden

7

15.12.2007, 01:40

Patrick, lerne bitte C++, denn offensichtlich hast du überhaupt keine Ahnung von der Sprache. Vorher bringt es überhaupt nichts, mit 3D-Spielen anzufangen. Ich sage dir das jetzt zum letzten Mal.

Werbeanzeige