WindowsProgramming

WindowsProgramming - Windows & DirectX...

Info iconThis preview shows pages 1–16. Sign up to view the full content.

View Full Document Right Arrow Icon

Info iconThis preview has intentionally blurred sections. Sign up to view the full version.

View Full DocumentRight Arrow Icon

Info iconThis preview has intentionally blurred sections. Sign up to view the full version.

View Full DocumentRight Arrow Icon

Info iconThis preview has intentionally blurred sections. Sign up to view the full version.

View Full DocumentRight Arrow Icon

Info iconThis preview has intentionally blurred sections. Sign up to view the full version.

View Full DocumentRight Arrow Icon

Info iconThis preview has intentionally blurred sections. Sign up to view the full version.

View Full DocumentRight Arrow Icon

Info iconThis preview has intentionally blurred sections. Sign up to view the full version.

View Full DocumentRight Arrow Icon

Info iconThis preview has intentionally blurred sections. Sign up to view the full version.

View Full DocumentRight Arrow Icon

Info iconThis preview has intentionally blurred sections. Sign up to view the full version.

View Full DocumentRight Arrow Icon
This is the end of the preview. Sign up to access the rest of the document.

Unformatted text preview: Windows & DirectX Programming #1 Kang, Seong-tae Computer Graphics, 2009 Spring CGLab Contents Basic Windows Programming Windows GDI Preparing for DirectX Programming CGLab Prerequisites Windows 2000/XP or later Microsoft Visual Studio Development tool for Windows programming Compiler and linker MFC : Microsoft Foundation Class Visual C++ 6 is not recommended Too old - grammatical flaws and bugs Microsoft‟s technical support expired in Sep. 2005 Recent DirectX SDKs don‟t support VC++ 6 any more Visual C++ 2005 or 2008 You can download express version for free from Microsoft homepage Microsoft DirectX SDK 9.0c or later A DirectX 9 compatible graphic card ATI Radeon 9500+ or later nVidia GeForce FX, 6/7/8/9 Series or later Intel GMA900 integrated graphics or later ATI Express-200 integrated graphics or later Basic Windows Programming Computer Graphics, 2009 Spring CGLab What is Win32 API API : Application Programming Interface Set of Windows functions for applications Win32 API : APIs for 32-bit Windows H/W 1 H/W 2 APIs OS Application 1 Application 2 Application 3 CGLab How to Program a Win32 Application Win32 API The most primitive method CreateWindow(), DispatchMessage(), ShowWindow() C-based definitions MFC(Microsoft Foundation Class) Object oriented framework C++ based encapsulation of Win32 API Intuitive UI coding Eg) Move mouse : OnMouseMove (…) Default event handler Complicated internal structures Other third-party frameworks like MFC Qt, GTK, GLUT… CGLab Example : File Dialog Win32 OPENFILENAME ofn; TCHAR szTotalFileName[1024]; memset(szTotalFileName, 0, sizeof(TCHAR)*1024); TCHAR szAbsDirectory[1024]; memset(szAbsDirectory, 0, sizeof(TCHAR)*1024); TCHAR szFileName[1024]; memset(szFileName, 0, sizeof(TCHAR)*1024); ZeroMemory(&ofn, sizeof(ofn)); ofn.lStructSize = sizeof(ofn); ofn.hwndOwner = hWnd; ofn.lpstrFilter = _T("txt Files (*.txt)\0*.txt\0All Files (*.*)\0*.*\0"); ofn.lpstrFile = szTotalFileName; ofn.nMaxFile = 10000; ofn.Flags = OFN_PATHMUSTEXIST|OFN_EXPLORER|OFN_FILEMUSTEXIST; ofn.lpstrDefExt = _T("txt"); CGLab Example : File Dialog MFC CFileDialog cfd(true, NULL, NULL, OFN_OVERWRITEPROMPT|OFN_FILEMUSTEXIST|OFN_EX PLORER|OFN_LONGNAMES, NULL); CGLab How to Program a Win32 Application We use primitive Win32 API MFC is not supported by VC++ express version CGLab Creating a Win32 Project CGLab Creating a Win32 Project CGLab Creating a Win32 Project If yo u want an empty project and to write whole code, check „Empty project‟. CGLab Creating a Win32 Project If you are *really* not interested in Win32 API at all, this is all you should know. CGLab Creating a Win32 Project CGLab Win32 Application Structure : Brief Description WinMain Entry point : the application starts from here Contains a message loop WM_PAINT, WM_DESTROY, WM_MOUSEMOVE … WndProc Callback function The actual message processing routine CGLab...
View Full Document

Page1 / 54

WindowsProgramming - Windows & DirectX...

This preview shows document pages 1 - 16. Sign up to view the full document.

View Full Document Right Arrow Icon
Ask a homework question - tutors are online