Learning Programming Windows API Morpheus Feb-28, 2008.

Slides:



Advertisements
Similar presentations
Prof. Muhammad Saeed. Procedure-Driven Programming Event-Driven Programming Events Messages Event Handlers GUI Windows and Multitasking Queues ( System.
Advertisements

1 Windows Programming CIS 577 Bruce R. Maxim UM-Dearborn.
Computer Graphics1 Windows NT Graphics Interface.
Chapter 16 Graphical User Interfaces John Keyser’s Modifications of Slides by Bjarne Stroustrup
BGI graphics library And Visual Studio.
QT – Introduction C++ GUI Programming with Qt 4 Blanchette and Summerfield, Ch. 1 Miller, 2004.
Introduction to Windows Programming. First Windows Program This program simply displays a blank window. The following code is the minimum necessary to.
IN-LAB # 1 - GETTING STARTED - BUT FIRST: 1.Project ideas - watch the scope!!! 2.Check accounts 3. Either myself or the TA need to check you off BEFORE.
ISP – 3 rd Recitation “The joy of Windows API” Processes Threads Handles Relevant functions A simple code example.
Simple Gui in C++. Project Selecting So Far Registering the window class Creating the window.
2: OS Structures 1 Jerry Breecher OPERATING SYSTEMS STRUCTURES.
Simple Gui in C++. Project Selecting So Far Registering the window class Creating the window.
First Windows Program Hello Windows. 2 HELLOWIN.C #include LRESULT CALLBACK WndProc (HWND, UINT, WPARAM, LPARAM) ; int WINAPI WinMain (HINSTANCE hInstance,
Intro to Windows Programming Basic Ideas. Program Entry Point Int WINAPI WinMain (HINSTANCE hInstance, HINSTANCE hPrevInstance, PSTR szCmdLine, int iCmdShow)
Chapter 8: I/O Streams and Data Files. In this chapter, you will learn about: – I/O file stream objects and functions – Reading and writing character-based.
Building a Win32API Application Raw access to the API.
1 Threads Chapter 4 Reading: 4.1,4.4, Process Characteristics l Unit of resource ownership - process is allocated: n a virtual address space to.
GVE, Hallym University, Song, Chang Geun, Ph.D. 컴퓨터 그래픽스 응용 한림대학교 컴퓨터공학부 송 창근.
Win32 API Programming Event-driven, graphics oriented Example: User clicks mouse over a program’s window area (an event) -- – Windows decodes HW signals.
Graphics Graphics Korea University cgvr.korea.ac.kr Raster Graphics 고려대학교 컴퓨터 그래픽스 연구실.
Prepared by Fareeha Lecturer DCS IIUI 1 Windows API.
Overview of Previous Lesson(s) Over View  Visual C++ provides us with 3 basic ways of creating an interactive Windows application  Using the Windows.
Chapter 1: Hello, MFC Windows Programming Model Department of Digital Contents Sang Il Park.
Chapter 1: Hello, MFC Your first MFC Application Department of Digital Contents Sang Il Park.
Windows Programming Text and Fonts This presentation will probably involve audience discussion, which will create action items. Use PowerPoint to keep.
Introduction to the Windows API n API - Application Programming Interface n an API is the software interface for things such as the OS n an API is the.
Data Structure & File Systems Hun Myoung Park, Ph.D., Public Management and Policy Analysis Program Graduate School of International Relations International.
Server Core is the preferred deployment configuration.
CSE3AGT Paul Taylor Stupid Conventions! l = Long p = Pointer h = handle g = global wnd = Windows WM = Windows Message d3d = Direct3D hr = HRESULT.
Winsock Programming Blocking and Asynchronous Sockets for Windows.
BZUPAGES.COM Visual Programming Lecture – 2 Miss. SADAF MAJEED SIAL Computer Science Department Bahauddin Zakariya University Multan.
Direct3D Workshop November 17, 2005 Workshop by Geoff Cagle Presented by Players 2 Professionals.
1 Windows GDI Programming CIS 487/587 Bruce R. Maxim UM-Dearborn.
Presentation Outline Introduction Painting and Repainting GDI.
CS1372: HELPING TO PUT THE COMPUTING IN ECE CS1372 Some Basics.
GUI-Based Programming ECE 417/617: Elements of Software Engineering Stan Birchfield Clemson University.
Dialog boxes Modal and modeless dialog boxes Displaying about dialog box: case WM_COMMAND : switch (LOWORD (wParam)) { case IDM_APP_ABOUT : DialogBox (hInstance,
Quanta Confidential QUANTA WBU Study Report 1 昭正 2008/08/01.
How to write a MSGQ Transport (MQT) Overview Nov 29, 2005 Todd Mullanix.
Introduction to Game Programming Pertemuan 11 Matakuliah: T0944-Game Design and Programming Tahun: 2010.
Written module activity, Page 16 1.We refer to the physical parts of a computer that we can touch and see as hardware. Examples include the mouse, the.
The WM_NCHITTEST Message  This is an internal message used by Windows for generating all the other mouse messages.  Though it almost never needs to be.
Menus  Menus is a feature which is common to almost every windows applications. It is the one of the most common user interface elements around.  Windows.
Introduction to OpenGL
Programming with Visual Studio MFC and OpenGL. Outline Creating a project Adding OpenGL initialization code and libraries Creating a mouse event Drawing.
Overview of Previous Lesson(s) Over View  Windows Programming  WinMain()  Where execution of the program begins and basic program initialization is.
Our good old first Win32 programme of lecture 8 #include int WINAPI WinMain(HINSTANCE hInstance, HINSTANCE hPrevInstance, LPSTR lpCmdLine, int nCmdShow)
Introduction To GDI GDI Definition : It is a interface present in windows which provide function and related structures that an application can use to.
W indows Programming Lecture 08. Brief History of Win Windows is announced 1984 Work begins on Word for Windows 1.0 November 1985: Windows 1.0.
Lecture 8: Discussion of papers OpenGL programming Lecturer: Simon Winberg Attribution-ShareAlike 4.0 International (CC BY-SA 4.0)
Windows Programming Lecture 14. WM_PAINT message Whenever an application receives the WM_PAINT message, whether the entire window needs repainting? WM_PAINT.
Clean Code Meaningful names Masaki Hayashi
Presentation Outline Introduction Painting and Repainting GDI.
Windows Programming Lecture 10.
Visual Programming Lecture 1 & 2
Windows Programming Lecture 09.
Window.
18 & 19.
Windows Programming Model
Aspect-Oriented Programming
Queued and Nonqueued Messages
The program in traditional OS
Windows Controls & Concepts
Windows Programming Lecture 13
CS 1253 Visual Programming Unit I Windows Environment
Windows Programming Lecture 15
19.
Windows Development Dynadata Copyright, 2014 © DynaData S.A. 1/10.
Graphics Laboratory Korea University
GUI Socket Application
Presentation transcript:

Learning Programming Windows API Morpheus Feb-28, 2008

Ralation ApplicationMessage Queue OS IO Device

Create Windows Design Windows Class Register Windows Create Windows Display and Update Windows Destroy Windows

Design Windows Class Syntax HWND CreateWindow( LPCTSTR lpClassName LPCTSTR lpWindowName, DWORD dwStyle, int x, int y, int nWidth, int nHeight, HWND hWndParent, HMENU hMenu, HINSTANCE hInstance, LPVOID lpParam );

Message Loop A program retrieves these messages from the message queue by executing a block of code known as the "message loop": while (GetMessage (&msg, NULL, 0, 0)) { TranslateMessage (&msg) ; DispatchMessage (&msg) ; }

Message structure The msg variable is a structure of type MSG, which is defined in the WINUSER.H header file like this: typedef struct tagMSG { HWND hwnd ; UINT message ; WPARAM wParam ; LPARAM lParam ; DWORD time ; POINT pt ; }MSG, * PMSG ;

Basic Drawing The GDI Primitives Line and Cures Bresenham DDA Filled areas Bitmaps Text

The Device Context When you want to draw on a graphics output device such as the screen or printer, you must first obtain a handle to a device context. The most common method for obtaining a device context handle: Hdc = BeginPaint (hwnd, &ps); //program lines EndPaint (hwnd, &ps);

Other stuff HDC hdc = GetDC(hwnd); //coding ReleaseDC(hwnd); HDC hdc = GetWIndowDC(hwnd); //coding ReleaseDC(hwnd): HDC = hdc = CreateDC(pszDriver…..); //coding DeleteDC(hdc);

800 * 600 ? 800 * 800 Most video displays these days have screens that are 33 percent wider than they are high. This represents an aspect ratio of 1.33:1 or (as it's more commonly written) 4:3.

Color takes three arguments representing red, green, and blue values and combines them into an unsigned long: #define RGB(r,g,b) …..

Handle A handle is simply a number (usually 32 bits in size) that refers to an object. The handles in Windows are similar to file handles used in conventional C or MS-DOS programming. A program almost always obtains a handle by calling a Windows function. The program uses the handle in other Windows functions to refer to the object. The actual value of the handle is unimportant to your program, but the Windows module that gives your program the handle knows how to use it to reference the object.

HINSTANCE

HWND

Handle HINSTANCE Handle to an "instance"—the program itself HWND Handle to a window HDC Handle to a device context

CommonControls InitCommonControlsEx void InitCommonControls(void);

List control A list-view control is a window that displays a collection of items; each item consists of an icon and a label. List-view controls provide several ways to arrange and display items.

Create List control

Tree Control A tree view control displays a hierarchical list of items using lines to connect related items in a hierarchy. Each item consists of a label and an optional bitmap. Windows Explorer uses a tree view control to display directories.

Create Tree Control

Thank You