Binghamton University. EngiNet. State University of New York

Similar documents
Contacting Me. CS-460: Computer Graphics. Excellent Visual C++ Programming Reference. Course Materials

An Introduction to Windows Programming Using VC++ Computer Graphics. Binghamton University. EngiNet. Thomas J. Watson

Introduction. Key features and lab exercises to familiarize new users to the Visual environment

Module 2: Getting Started with Visual C AppWizard

Opening Microsoft Visual Studio. On Microsoft Windows Vista and XP to open the visual studio do the following:

CST8152 Compilers Creating a C Language Console Project with Microsoft Visual Studio.Net 2010

CST8152 Compilers Creating a C Language Console Project with Microsoft Visual Studio.Net 2005

CST8152 Compilers Creating a C Language Console Project with Microsoft Visual Studio.Net 2003

HOW TO USE CODE::BLOCKS IDE FOR COMPUTER PROGRAMMING LABORATORY SESSIONS

Getting Started. 1.1 A look at Developer Studio

Windows Programming Using MFC and Visual C ++.Net

CodeWarrior Development Studio for Power Architecture Processors FAQ Guide

Code::Blocks Student Manual

CodeWarrior Development Studio for Advanced Packet Processing FAQ Guide

KINGS COLLEGE OF ENGINEERING PUNALKULAM DEPARTMENT OF INFORMATION TECHNOLOGY QUESTION BANK UNIT - I WINDOWS PROGRAMMING PART A (2 MARKS)

DEPARTMENT OF INFORMATION TECHNOLOGY ACADEMIC YEAR EVEN SEMESTER QUESTION BANK. UNIT I WINDOWS PROGRAMMING Part-A (2-MARKS)

SCSI TOOLBOX, LLC. Developer Toolbox API - Getting Started. Copyright 2011 SCSI Toolbox, LLC Sales: General:

Advantech Windows CE.net Application Hand on Lab

TREX Set-Up Guide: Creating a TREX Executable File for Windows

Module 3: Working with C/C++

SHRI ANGALAMMAN COLLEGE OF ENGINEERING AND TECHNOLOGY DEPARTMENT OF COMPUTER SCIENCE VISUAL PROGRAMMING UNIT I

Laboratory Assignment #3 Eclipse CDT

ECE 480 Application Note. By: Jacob Hersha 4/3/15. Creating a Sequence of Media with Visual Studio

Programming in Microsoft Visual C++ Programming in Microsoft Visual C++

At the shell prompt, enter idlde

Text box. Command button. 1. Click the tool for the control you choose to draw in this case, the text box.

Start Menu Log off Turn Off Computer Run Search Help and Support

Visual C++ 2. Developing Professional Applications in Windows 95 and NT Using MFC. Marshall Brain th Lance Lovette

Code::Blocks Student Manual

CPE 323: Laboratory Assignment #1 Getting Started with the MSP430 IAR Embedded Workbench

Intro to MS Visual C++ Debugging

Installing a Custom AutoCAD Toolbar (CUI interface)

Adjusting the view. Magnifying the page view. Working with large page sizes. Choosing a page layout for scrolling ease. Setting a default view

Module 1: Microsoft Windows, Visual C++ and Microsoft Foundation Class (MFC)

Developing Professional Applications in Windows 95 and NT sing MFC

There are six main steps in creating web pages in FrontPage98:

An Introduction to MFC (builds on your lecture on MFC)

Engr 123 Spring 2018 Notes on Visual Studio

DataViews Visual C++ Tutorial Guide. DataViews for Windows Version 2.2

Newforma Contact Directory Quick Reference Guide

Image Loader Program (ILP) for High Performance Controllers. Book E33 - version 1.03

Required Setup for 32-bit Applications

Zend Studio 3.0. Quick Start Guide

Programming in graphical environment. Introduction

Developing a Power Point Presentation

Qno.2 Write a complete syantax of "Getparents" functions? What kind of value it return and when this function is use? Answer:-

Visual Studio.NET. Although it is possible to program.net using only the command OVERVIEW OF VISUAL STUDIO.NET

NetBeans Tutorial. For Introduction to Java Programming By Y. Daniel Liang. This tutorial applies to NetBeans 6, 7, or a higher version.

Setting Up Your Drawing Environment

Visual Studio 2010 Silverlight No Symbols Have Been Loaded For This Document

Here is a step-by-step guide to creating a custom toolbar with text

with TestComplete 12 Desktop, Web, and Mobile Testing Tutorials

LabWindows /CVI Release Notes Version 9.0

CodeWarrior Development Studio for Power Architecture Processors V10.X FAQ Guide

PowerPoint 2003 Intermediate PowerPoint: Tips and Tricks

LSN 4 GUI Programming Using The WIN32 API

Getting Started with Visual Studio

Different Ways of Writing Windows Programs

Binghamton University. EngiNet. Thomas J. Watson. School of Engineering and Applied Science. Computer Graphics. State University of New York.

GIMP TEXT EFFECTS. GIMP is all about IT (Images and Text) OPEN GIMP

Eclipse CDT Tutorial. Eclipse CDT Homepage: Tutorial written by: James D Aniello

Text in OpenGL and Windows. Computer Graphics Attributes. Computer Graphics. Binghamton University. EngiNet. Thomas J. Watson

CHAPTER 1. Interface Overview 3 CHAPTER 2. Menus 17 CHAPTER 3. Toolbars and Tools 33 CHAPTER 4. Timelines and Screens 61 CHAPTER 5.

Introduction to MS Word XP 2002: An Overview

Tools Basics. Getting Started with Renesas Development Tools R8C/3LX Family

2 TUTORIAL. Overview. VisualDSP Getting Started Guide 2-1 for SHARC DSPs

A Tour of the Scripting System. Contents

Getting started 7. Setting properties 23

GUI and API Application Note

TriCore Free Entry Tool Chain. AURIX family and AUDO Future, AUDO MAX

SpyLite User s Guide for BTW

Microsoft Word (97, 98, 2000) Word Processing Instructions

SlickEdit Gadgets. SlickEdit Gadgets

Supplement H.1: JBuilder X Tutorial. For Introduction to Java Programming, 5E By Y. Daniel Liang

Ocean Wizards and Developers Tools in Visual Studio

Supplement II.B(1): JBuilder X Tutorial. For Introduction to Java Programming By Y. Daniel Liang

Introduction to MS Visual C/C++

Microsoft PowerPoint 2013 Beginning

Introductory Exercises in Microsoft Access XP

TOON BOOM HARMONY Paint Preferences Guide

PowerPoint Basics (Office 2000 PC Version)

Scientific Visualization A Programming Guide using Fltk and Visual Studio

25. DECUS Symposium THE Application Development Environment for OpenVMS

Understanding the Interface

1.00 Lecture 2. What s an IDE?

Lab 1: Introduction to C Programming. (Creating a program using the Microsoft developer Studio, Compiling and Linking)

Module 4: Working with MPI

User Guide. Introduction. Requirements. Installing and Configuring. C Interface for NI myrio

Microsoft Office 2000 & Microsoft Word 2000 Page 1. ***** Help Options ***** To access [? ] quickly & for specific use then

Instruction: Download and Install R and RStudio

My First iphone App. 1. Tutorial Overview

Getting started 7. Setting properties 23

AURIX family and AUDO Future, AUDO MAX

Getting Started with Python and the PyCharm IDE

A Quick Tour GETTING STARTED WHAT S IN THIS CHAPTER?

ECE QNX Real-time Lab

Quick Start Guide - Contents. Opening Word Locating Big Lottery Fund Templates The Word 2013 Screen... 3

Hello World on the ATLYS Board. Building the Hardware

WARNING: UNAUTHORIZED USE OF ALLEN ISD NETWORK RESOURCES IS PROHIBITED.

Work Smart: Microsoft Office 2010 User Interface

Transcription:

Binghamton University EngiNet State University of New York 1

Thomas J. Watson School of Engineering and Applied Science EngiNet WARNING All rights reserved. No Part of this video lecture series may be reproduced in any form or by any electronic or mechanical means, including the use of information storage and retrieval systems, without written approval from the copyright owner. 2001 The Research Foundation of the State University of New York 2

CS 560 Computer Graphics Professor Richard Eckert Lecture # 2 January 24, 2001 3

Lecture 2 Wednesday, 1-24-01 A. Using Microsoft Visual C++ Developer Studio 97 B. An Introduction to Windows Programming A. Microsoft Visual C++ Developer Studio IDE See notes & example programs from CS-360 URLs: http://www.cs.binghamton.edu/~reckert/360/360notes.html http://www.cs.binghamton.edu/~reckert/360/360pgms.html Especially MFC notes and examples 4

Using Microsoft Visual C++ Developer Studio Self-contained environment for Windows program development: creating compiling linking testing/debugging IDE that accompanies Visual C++ Visual Studio Components The Editors C or C++ source program text editor cut/paste color cues, indentation, generates text files Resource Editor icons, bitmaps, cursors, menus, dialog boxes, etc. graphical, WYSIWYG, Integrated generates resource script (.rc) files integrated with text editor 5

C/C++ Compiler The Compilers translates source programs to machine language detects and reports errors generates object (.obj) files for linker Resource Compiler Reads.rc file Generates binary resource (.res) file for linker The Linker reads compiler.obj/.res files accesses C/C++/Windows libraries generates executable (.exe or.dll) 6

The Debugger powerful source code debugger integrated with all parts of Dev Studio Features breakpoints tracing through/over functions variable watch windows much more 7

AppWizard The Wizards Windows code generator for MFC apps automatically creates working program skeletons ClassWizard facilitates easy extension of AppWizardgenerated classes used to tailor AppWizard-generated MFC skeletons Online Help Can be accessed by: InfoViewer book/chapter Topic (keyword search-->relevant topics/articles) F1 help (help on item under mouse cursor) The Web: MSDN (Microsoft Developer Network) 8

InfoViewer Online Help (Win32 API Programming) Platform, SDK, and DDK Documentation Platform SDK Reference Functions Win32 Functions (Alphabetical listing) Messages Win32 Messages (Alphabetical listing) Structures Win32 Structures (Alphabetical listing) InfoViewer Online Help (MFC Programming) Developer Products Visual C++ Microsoft Foundation Class Reference Class Library Reference Select Desired Class 9

MSDN Library http://msdn.microsoft.com/siteguide/sitemap.asp Go to MSDN Library: Visual Studio 6.0 Documentation Visual C++ Documentation Reference Microsoft Foundation Class Library & Templates Microsoft Foundation Class Library Class Library Reference Platform SDK Graphics and Multimedia Win32 API Reference Win32 Functions in Alphabetical Order Other Advanced Tools SPY++ PVIEW ActiveX utilities, a gallery of software components More 10

Using Developer Studio 97 and Visual C++ 5.0/6.0 To prepare many kinds of applications Win32 Console Applications (DOS programs) Win32 API Apps Win32 MFC apps DLLs Lots of others 11

Components Menu bar Several tool bars Project Workspace Window (left) InfoView, FileView, ClassView, ResourceView Editor Window (right) Use Text Editor to Enter C/C++ code Use Resource Editors Output Window (bottom). System messages (errors) Toolbars Contain icons--instant routes to main menu functions Output, Workspace, Standard, Build, Edit, InfoViewer, Resource, etc. May not be visible If not, right click on any visible toolbar Brings up following popup window Can activate a toolbar by clicking on its check box 12

Projects and Workspaces Project collection of interrelated source files compiled/linked to generate a Windows executable Project Workspace folder with all information relating to a project or combinations of projects also used to refer to Visual Studio desktop window Project info stored in.dsw and.dsp text files 13

Important Dev Studio Generated Files.dsp.c or.cpp.h.dsw.rc.res.ico.bmp.exe.dll.obj Project file C/C++ source C/C++ header Workspace file Resource script Compiled resource Icon Bitmap image Executable program Dynamic Link Library (if used) Machine code translations Temporary Dev Studio generated files Many are huge and can (should) be removed!.ilk Incremental link file.pch Precompiled header.pdb Precompiled debugging info.idb Incremental debug info.ncb Supports viewing classes.aps Supports viewing resources.bsc Browser information file.clw Supports ClassWizard.opt Workspace configuration.plg Build log file 14

Debug Windows Program Configurations appends debugging info produces more and larger files Release no debugging info optimized for size & efficiency Setting the Configuration Click "Build" on Main Menu Choose "Select Active Configuration Choose configuration ( Debug or Release ) Default is Debug 15

Create a Win32 App w/ Dev Studio Startup click Start on Task Bar Programs Microsoft Visual Studio Microsoft Visual C++ Creating Project File New from menu Projects Tab (if not chosen) Win32 Application Name the project (e.g. winapp1) OK Win32 Application, Step 1 of 1 Window Select An Empty Project Click Finish New Project Information Window Click OK 16

Inserting source files into project: Open new C++ file, type or copy/paste the code into the program File New Files tab C++ Source Make sure Add to Project is checked Enter a file name (e.g., winapp1) Type or paste in the resulting Edit window To see/modify a file added to project: click FileView tab in Workspace Window click on file name in FileView window Building Project: Build Build winapp1 from menu Shortcut key: F7 Project will be compiled/linked Messages will appear in Output Window Running Program: Build Execute winapp1 Shortcut key: Ctrl-F5, or click exclamation point 17

Cleanup: Copy workspace, project, source, header, resource files to disk Copy.exe from project's Debug directory Best: Delete all temporary files & copy entire workspace (project directory) to floppy Delete project directory from hard drive Exiting Developer Studio: File Exit from menu B. An Introduction to Windows Programming 18

Windows Programming Event-driven, graphics oriented Example: User clicks mouse over a program s window area-- Windows decodes HW signals from mouse figures out which window user has selected sends a message to that window s pgm: "User has clicked over (X,Y) "Do something and return control to me Program reads message data, does what's needed, returns control to Windows 19

Overview of Win32 API Program Structure--2 main tasks: Initial activities Process messages from Windows (the message loop) Pseudocode Initialize variables, memory space Create & show program's Window Loop Fetch any msg sent from Windows to this pgm If message is QUIT terminate program, return control to Windows If message is something else take actions based on msg & parameters return control to Windows End Loop 20

Essential Parts of a Windows Program I. The source pgm (.c/.cpp file): A. WinMain() function 0. declarations, initialization, etc. 1. register window class 2. create a window based on a registered class 3. show window, make it update its client area 4. the message loop (get messages from Windows, dispatch back to Windows for forwarding to correct callback messageprocessing function) B. WndProc(): the message-processing function a big switch/case statement Under Win32 API, programmer must write WinMain() and the WndProc() Under MFC, Wizards do most of the work WinMain() and WndProc() are buried in the framework Write message mapped handler functions instead 21

II. The resource script (.rc file): contains resource (Windows static) data separate from code and dynamic data compiled by a separate "Resource Compiler Examples: Keyboard Accelerators, Bitmaps, Cursors, Dialog Box, Fonts, Icons, Menus, String Tables Separation of resources and program code==> separates tasks of programmer & designer can change user interface w/o touching code Some Important Messages WM_DESTROY-- User does action to kill window WM_COMMAND--User clicked on menu item (menu item ID provided) WM_*BUTTONDOWN--left/right mouse button pressed (* = L or R; x,y coordinates provided) WM_MOUSEMOVE--mouse moved WM_CHAR--User pressed valid ANSI code character keyboard key combination (ANSI code provided) WM_PAINT--Part of window was exposed & should be redrawn WM_KEYDOWN--keyboard key pressed (virtual key code provided) 22

TEXT AND GRAPHICS OUTPUT Displaying something in a window Text & graphics done one pixel at a time Any size/shape/position possible Design goal: Device Independence Device Independent Graphics Interface Windows programs don t access hardware devices directly Make calls to generic drawing functions within the Windows Graphics Device Interface (GDI) -- a DLL The GDI translates these into HW commands Program GDI Hardware 23

Device Independent Graphics Interface Program GDI Driver Hardware May use device drivers (HW control programs) Thus graphics I/O done in a standard way Programs will run unaltered on other HW platforms Device Context Windows programs don t draw directly on HW Draw on Device Context (DC) Abstracts the device it represents Like a painter s canvas Specifies drawing attribute settings e.g., text color Contains drawing objects e.g., pens, brushes, bitmaps, fonts 24

The DC and the GDI Some GDI Attribute Settings ATTRIBUTE DEFAULT FUNCTION ----------------------------------------------------------------- Background color white SetBkColor() Background mode OPAQUE SetBkMode() Clipping Region whole surf. SelectClipRgn() Current Position (0,0) MoveToEx() Drawing Mode R2COPYPEN SetROP2() Mapping Mode MM_TEXT SetMapMode() Text Color Black SetTextColor() 25

Some GDI Drawing Objects Object Default What it is ---------------------------------------------------------------------- Bitmap none image object Brush WHITE_BRUSH area fill object Font SYSTEM_FONT text font object Pen BLACK_PEN line-drawing object Color Palette DEFAULT_PALETTE color combinations ---------------------------------------------------------------------- Can be created with GDI functions Must be selected into a DC to be used 26