ReactOS Fundraising Campaign 2012
 
€ 4,410 / € 30,000

Information | Donate

Home | Info | Community | Development | myReactOS | Contact Us

  1. Home
  2. Community
  3. Development
  4. myReactOS
  5. Fundraiser 2012

  1. Main Page
  2. Alphabetical List
  3. Data Structures
  4. Directories
  5. File List
  6. Data Fields
  7. Globals
  8. Related Pages

ReactOS Development > Doxygen

d3dtest.c
Go to the documentation of this file.
00001 /*
00002  * PROJECT:         ReactX Diagnosis Application
00003  * LICENSE:         GPL - See COPYING in the top level directory
00004  * FILE:            base/applications/dxdiag/d3dtest.c
00005  * PURPOSE:         ReactX Direct3D 7, 8 and 9 tests
00006  * PROGRAMMERS:     Gregor Gullwi <gbrunmar (dot) ros (at) gmail (dot) com>
00007  */
00008 
00009 #include "precomp.h"
00010 
00011 #define WIDTH   800
00012 #define HEIGHT  600
00013 
00014 BOOL D3D7Test(HWND hWnd);
00015 BOOL D3D8Test(HWND hWnd);
00016 BOOL D3D9Test(HWND hWnd);
00017 
00018 BOOL StartD3DTest(HWND hWnd, HINSTANCE hInstance, WCHAR* pszCaption, INT TestNr)
00019 {
00020     WCHAR szTestDescriptionRaw[256];
00021     WCHAR szTestDescription[256];
00022     WCHAR szCaption[256];
00023     WCHAR szResult[256];
00024     WCHAR szError[256];
00025     BOOL Result;
00026 
00027     LoadStringW(hInstance, IDS_MAIN_DIALOG, szCaption, sizeof(szCaption) / sizeof(WCHAR));
00028     LoadStringW(hInstance, IDS_DDTEST_ERROR, szError, sizeof(szError) / sizeof(WCHAR));
00029     LoadStringW(hInstance, IDS_D3DTEST_D3Dx, szTestDescriptionRaw, sizeof(szTestDescriptionRaw) / sizeof(WCHAR));
00030     //LoadStringW(hInstance, resResult, szResult, sizeof(szResult) / sizeof(WCHAR));
00031 
00032     swprintf(szTestDescription, szTestDescriptionRaw, TestNr);
00033     if (MessageBox(NULL, szTestDescription, szCaption, MB_YESNO | MB_ICONQUESTION) == IDNO)
00034         return FALSE;
00035 
00036     ShowWindow(hWnd, SW_SHOW);
00037 
00038     switch(TestNr){
00039         case 7:
00040             Result = D3D7Test(hWnd);
00041             break;
00042         case 8:
00043             Result = D3D8Test(hWnd);
00044             break;
00045         case 9:
00046             Result = D3D9Test(hWnd);
00047             break;
00048         default:
00049             Result = FALSE;
00050     }
00051 
00052     ShowWindow(hWnd, SW_HIDE);
00053 
00054     if(!Result)
00055     {
00056         MessageBox(NULL, szError, szCaption, MB_OK | MB_ICONERROR);
00057         return FALSE;
00058     }
00059 
00060     if(MessageBox(NULL, szResult, szCaption, MB_YESNO | MB_ICONQUESTION) == IDYES)
00061         return TRUE;
00062 
00063     return FALSE;
00064 }
00065 
00066 static LRESULT CALLBACK WindowProc(HWND hWnd, UINT msg, WPARAM wParam, LPARAM lParam)
00067 {
00068     return DefWindowProc(hWnd, msg, wParam, lParam);
00069 }
00070 
00071 VOID D3DTests()
00072 {
00073     WNDCLASSEX winClass;
00074     HWND hWnd;
00075     HINSTANCE hInstance = GetModuleHandle(NULL);
00076     WCHAR szDescription[256];
00077     WCHAR szCaption[256];
00078 
00079     winClass.cbSize = sizeof(WNDCLASSEX);
00080     winClass.style = CS_DBLCLKS | CS_OWNDC | CS_HREDRAW | CS_VREDRAW;
00081     winClass.lpfnWndProc = WindowProc;
00082     winClass.cbClsExtra = 0;
00083     winClass.cbWndExtra = 0;
00084     winClass.hInstance = hInstance;
00085     winClass.hIcon = 0;
00086     winClass.hCursor = 0;
00087     winClass.hbrBackground = (HBRUSH)GetStockObject(BLACK_BRUSH);
00088     winClass.lpszMenuName = NULL;
00089     winClass.lpszClassName = L"d3dtest";
00090     winClass.hIconSm = LoadIcon(NULL, IDI_APPLICATION);
00091 
00092     if (!RegisterClassEx(&winClass))
00093         return;
00094 
00095     hWnd = CreateWindowEx(
00096         0,
00097         winClass.lpszClassName,
00098         NULL,
00099         WS_POPUP,
00100         (GetSystemMetrics(SM_CXSCREEN) - WIDTH)/2,
00101         (GetSystemMetrics(SM_CYSCREEN) - HEIGHT)/2,
00102         WIDTH,
00103         HEIGHT,
00104         NULL,
00105         NULL,
00106         hInstance,
00107         NULL);
00108 
00109     if (!hWnd)
00110         goto cleanup;
00111 
00112     LoadStringW(hInstance, IDS_D3DTEST_DESCRIPTION, szDescription, sizeof(szDescription) / sizeof(WCHAR));
00113     LoadStringW(hInstance, IDS_MAIN_DIALOG, szCaption, sizeof(szCaption) / sizeof(WCHAR));
00114     if(MessageBox(NULL, szDescription, szCaption, MB_YESNO | MB_ICONQUESTION) == IDNO)
00115         goto cleanup;
00116 
00117     StartD3DTest(hWnd, hInstance, szCaption, 7);
00118     StartD3DTest(hWnd, hInstance, szCaption, 8);
00119     StartD3DTest(hWnd, hInstance, szCaption, 9);
00120 
00121 cleanup:
00122     DestroyWindow(hWnd);
00123     UnregisterClass(winClass.lpszClassName, hInstance);
00124 }

Generated on Sat May 26 2012 04:15:35 for ReactOS by doxygen 1.7.6.1

ReactOS is a registered trademark or a trademark of ReactOS Foundation in the United States and other countries.