文档详情

全屏幕窗口创建实验报告.doc

发布:2017-06-06约4.16千字共8页下载文档
文本预览下载声明
实验四实验报告 课程:全屏幕窗口的创建 班级:2010级远程教育班 专业:教育技术学(远程教育方向) 实验人:XXX 学号: 实验时间: 实验室:数字媒体实验室 指导老师:XXX 一、实验目的 1.熟悉窗口基本创建; 2.学会对窗口模式改为全屏模式; 3.熟悉全屏窗口的创建; 二、实验任务 1.创建全屏窗口模式; 实验过程 源代码为: #include windows.h #include windowsx.h #include d3d9.h // define the screen resolution(定义屏幕分辨率) #define SCREEN_WIDTH 800 #define SCREEN_HEIGHT 600 // include the Direct3D Library file #pragma comment (lib, d3d9.lib) // global declarations LPDIRECT3D9 d3d; // the pointer to our Direct3D interface LPDIRECT3DDEVICE9 d3ddev; // the pointer to the device class // function prototypes void initD3D(HWND hWnd); // sets up and initializes Direct3D(建立和初始化装置) void render_frame(void); // renders a single frame void cleanD3D(void); // closes Direct3D and releases memory // the WindowProc function prototype LRESULT CALLBACK WindowProc(HWND hWnd, UINT message, WPARAM wParam, LPARAM lParam); // the entry point for any Windows program(入口点的任何窗口程序) int WINAPI WinMain(HINSTANCE hInstance, HINSTANCE hPrevInstance, LPSTR lpCmdLine, int nCmdShow) { HWND hWnd; WNDCLASSEX wc; ZeroMemory(wc, sizeof(WNDCLASSEX)); wc.cbSize = sizeof(WNDCLASSEX); wc.style = CS_HREDRAW | CS_VREDRAW; wc.lpfnWndProc = WindowProc; wc.hInstance = hInstance; wc.hCursor = LoadCursor(NULL, IDC_ARROW); // wc.hbrBackground = (HBRUSH)COLOR_WINDOW; // not needed any more wc.lpszClassName = LWindowClass; RegisterClassEx(wc); hWnd = CreateWindowEx(NULL, LWindowClass, LOur Direct3D Program, WS_EX_TOPMOST | WS_POPUP, // 全屏模式的代码 0, 0, // the starting x and y positions should be 0 SCREEN_WIDTH, SCREEN_HEIGHT, // set the window to 640 x 480(设置窗口为×) NULL, NULL, hInstance, NULL); ShowWindow(hWnd, nCmdShow); // set up and initialize Direct3D initD3D(hWnd); // enter the main loop: MSG msg; while(TRUE) { while(PeekMessage(msg, NULL, 0, 0, PM_REMOVE)) { TranslateMessage(msg); DispatchMessage(msg); } if(msg.message == WM_QUIT) break; render_frame(); } // clean up DirectX and COM c
显示全部
相似文档