Computer Graphics1 Windows NT Graphics Interface.

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.
Using Macros and Visual Basic for Applications (VBA) with Excel
Introduction to Windows Programming. First Windows Program This program simply displays a blank window. The following code is the minimum necessary to.
Civil 114 Civil Engineering Drawing AutoCAD
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.
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)
COMPREHENSIVE Excel Tutorial 8 Developing an Excel Application.
XP Tutorial 7 New Perspectives on Microsoft Windows XP 1 Microsoft Windows XP Working with Graphics Tutorial 7.
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.
Microsoft Word 2000 Presentation 5. Major Word Topics Columns Tables Lists.
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.
Basic Computer and Word Functions, part 1 Read the information and use to answer the questions in the Basic Computer and Word Functions Study Guide.
Enhancing the Graphical User Interface Multiple Forms, Controls, and Menus.
CSE3AGT Paul Taylor Stupid Conventions! l = Long p = Pointer h = handle g = global wnd = Windows WM = Windows Message d3d = Direct3D hr = HRESULT.
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.
Laboratory Exercise # 9 – Inserting Graphics to Documents Office Productivity Tools 1 Laboratory Exercise # 9 Inserting Graphics to Documents Objectives:
GAM666 – Introduction To Game Programming You must use special libraries (aka APIs – application programming interfaces) to make something other than a.
Lecture 7 Menu, controls, scroll bars. Menu Menu item sends WM_COMMAND message to the application window Menu is attached to window when the window is.
Presentation Outline Introduction Painting and Repainting GDI.
Bitmap (Chapter 15).
By Felixberto Dominic B. Eruela.  Using a computer to create, edit, and print documents. Of all computer applications, word processing is the most common.
Registering a window class Windows allows many styles of window to be created. To tell Windows to create a window as you want it you need to define a class.
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.
 2002 Prentice Hall. All rights reserved. 1 Chapter 2 – Introduction to the Visual Studio.NET IDE Outline 2.1Introduction 2.2Visual Studio.NET Integrated.
Word 2003 The Word Screen. Word 2003 Screen File Menu –Holds the options for creating a new document, opening a document, saving a document, printing.
INFORMATION SYSTEM – SOFTWARE TOPIC: GRAPHICAL USER INTERFACE.
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
Learning Programming Windows API Morpheus Feb-28, 2008.
Overview of Previous Lesson(s) Over View  Windows Programming  WinMain()  Where execution of the program begins and basic program initialization is.
 2002 Prentice Hall. All rights reserved. 1 Introduction to the Visual Studio.NET IDE Outline Introduction Visual Studio.NET Integrated Development Environment.
1. Using word you can create the document and edit them later, as and when required,by adding more text, modifying the existing text, deleting/moving.
Drawing in Windows. To help with drawing on the Windows operating system, Microsoft created the Graphical Device Interface, abbreviated as GDI. – It 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.
Word processing is the software package that enables you to create,edit, print and save documents for future retrieval reference. creating a document.
Windows Programming Lecture 14. WM_PAINT message Whenever an application receives the WM_PAINT message, whether the entire window needs repainting? WM_PAINT.
Chapter 11 Enhancing an Online Form and Using Macros Microsoft Word 2013.
Visual Info Processing Programming Guide
Excel Tutorial 8 Developing an Excel Application
Presentation Outline Introduction Painting and Repainting GDI.
Microsoft Visual Basic 2005 BASICS
Windows Programming Lecture 10.
Visual Programming Lecture 1 & 2
Windows Programming Lecture 09.
Window.
Windows Programming Model
Understand Windows Forms Applications and Console-based Applications
Queued and Nonqueued Messages
The program in traditional OS
Chapter 2 – Introduction to the Visual Studio .NET IDE
Windows Programming Lecture 13
CS 1253 Visual Programming Unit I Windows Environment
Windows Programming Lecture 15
Console A presentation by Inti Vincenzo Pizzoni.
Windows Development Dynadata Copyright, 2014 © DynaData S.A. 1/10.
Graphics Laboratory Korea University
Chapter 4 Enhancing the Graphical User Interface
Presentation transcript:

Computer Graphics1 Windows NT Graphics Interface

Computer Graphics2 References n Since a complete study of the Windows NT programming isn’t possible within the time limits we have, for additional information you can use any of the following: u Windows 95 Programming Nuts & Bolts for experienced Programmers / Herbert Schildt u Microsoft Visual C++ X.X help. u Any other windows NT programming guides.

Computer Graphics3 Some Application Fundamentals n WinMain int WINAPI WinMain( HINSTANCE hInstance, // handle to current instance HINSTANCE hInstance, // handle to current instance HINSTANCE hPrevInstance, // handle to previous // instance HINSTANCE hPrevInstance, // handle to previous // instance LPSTR lpCmdLine,// pointer to command line int nCmdShow // show state of window ); u All Windows NT programs begin execution with a call to WinMain(), except for console applications, which begin in main().

Computer Graphics4 Some Application Fundamentals n The Window Function u All Windows NT programs must contain a special function that is not called by your program, but is called by Windows NT. u It is through this function that Windows communicates with your program. The window function is called whenever Windows needs to pass a “message” to your program. u Example: ViewProc(HWND hWnd, UINT wMessage, UINT wParam, LONG lParam) UINT wParam, LONG lParam)

Computer Graphics5 Some Application Fundamentals u It is passed the first four members of the MSG structure as parameters: n Message structure: typedef struct tagMSG { HWND wnd;// window that message is for UINT message; // message WPARAM wParam; // message-dependent info LPARAM lParam;// more message-dependent info DWORD time;// time message posted POINT pt;// x,y location of mouse } MSG;

Computer Graphics6 Message Macros WM_PAINT - WM_PAINT - Windows or another application makes a request to paint a portion of an application's window. WM_LBUTTONUP - WM_LBUTTONUP - the user releases the left mouse button while the cursor is in the client area of a window. WM_LBUTTONDOWN - WM_LBUTTONDOWN - the user presses the left mouse button while the cursor is in the client area of a window. WM_MOUSEMOVE - WM_MOUSEMOVE - the cursor moves

Computer Graphics7 Drawing in Windows NT: n HDC - Device Context u Contains the information on the way it is possible to draw on the screen: F color (background, foreground) F Paint structure F Pen F Other info. n HPEN - Type of pen to draw lines on the screen u line color u line width u line style

Computer Graphics8 Drawing in Windows NT - Cont. n To get the default pen of the screen: HPEN hPen = SelectObject(hDC,GetStockObject(BLACK_PEN)); n Drawing a line: u Moving a pen to location (x,y): MoveToEx(hDC, x, y, NULL); MoveToEx(hDC, x, y, NULL); u Drawing a line from the current point to (x,y): LineTo(hDC, x, y);

Computer Graphics9 Toolbar n A Toolbar is One of the most important common controls because it can speed up menu selection when you are using a mouse. n Often, a Toolbar is used in conjunction with a standard menu. n To create a Tollbar, use the CreateToolbarEx() function: HWND CreateToolbarEx( HWND hwnd, DWORD ws,UINT wID, int nBitmaps, HINSTANCE hBMInst, UINT wBMID, LPCTBBUTTON lpButtons, int iNumButtons, int dxButton, int dyButton, int dxBitmap, int dyBitmap, UINT uStructSize );

Computer Graphics10 Example n In your header file, there should be definitions for the names of the buttons you are using, so that they can be identified when pressed. For example, in Skeleton.h: #define CG_TOOLBAR (WM_USER) #define CG_PERSP (CG_TOOLBAR + 1) #define CG_ORTHO (CG_TOOLBAR + 2) n Also, the style of each button, and the way they appear is determined in a TBBUTTON struct.

Computer Graphics11 TBBUTTON typedef struct _TBBUTTON { int iBitmap;// int iBitmap;// Zero-based index of button image int idCommand; // int idCommand; // Command identifier associated with // the button BYTE fsState; // BYTE fsState; // Button state flags BYTE fsStyle; // BYTE fsStyle; // Button style DWORD dwData; // DWORD dwData; // Application-defined value. int iString; // int iString; // Zero-based index of button string. } TBBUTTON, NEAR* PTBBUTTON, FAR* LPTBBUTTON; FAR* LPTBBUTTON;

Computer Graphics12 TBBUTTON - Cont. n For example, in Skeleton.C: static TBBUTTON tbButtons[] = { { 0, 0, TBSTATE_ENABLED, TBSTYLE_SEP }, { 0, CG_ORTHO, TBSTATE_ENABLED | TBSTATE_CHECKED, TBSTYLE_CHECKGROUP }, { 1, CG_PERSP, TBSTATE_ENABLED, TBSTYLE_CHECKGROUP }, { 0, 0, TBSTATE_ENABLED, TBSTYLE_SEP }, TBSTYLE_SEP }, { 2, CG_ROTAT, TBSTATE_ENABLED | TBSTATE_CHECKED, TBSTYLE_CHECKGROUP },... { 8, CG_SAVE, TBSTATE_ENABLED, TBSTYLE_BUTTON }, { 8, CG_SAVE, TBSTATE_ENABLED, TBSTYLE_BUTTON },...

Computer Graphics13 Summarize of the exercises skeleton n In the skeleton, 2 windows are created. The first (szAppName) is initially 512x512, and contains a tool bar child, and contains a child window (szViewName). n The parent window is not seen, but it handles the messages that are sent from the tool bar, any time a button is pressed. n The child window receives the messages of the mouse pressing and moving, which cause the calls to the functions that you will have to write.