systemove programovanie win32 programovanie

Similar documents
Window programming. Programming

Windows Programming. 1 st Week, 2011

/*********************************************************************

Game Programming I. Introduction to Windows Programming. Sample Program hello.cpp. 5 th Week,

We display some text in the middle of a window, and see how the text remains there whenever the window is re-sized or moved.

hinstance = ((LPCREATESTRUCT)lParam)->hInstance obtains the program's instance handle and stores it in the static variable, hinstance.

Getting Started. 1 st Week, Sun-Jeong Kim. Computer Graphics Applications

LSN 4 GUI Programming Using The WIN32 API

We take a look at implementing some file menu options: New, Open, Save, Save As and Exit.

Programmer s Manual MM/104 Multimedia Board

Designing Interactive Systems II

: Lập trình Win32. Lập trình Win32 API. vncoding.net Page 1. Date : 07/09/2014

Course 3D_OpenGL: 3D-Graphics with C++ and OpenGL Chapter 1: Moving Triangles

Windows Printer Driver User Guide for NCR Retail Printers. B Issue G

2. On the main menu, click File -> New... or File -> New -> Other... Windows Fundamentals

Chapter 15 Programming Paradigm

C Windows 16. Visual C++ VC Borland C++ Compiler BCC 2. Windows. c:\develop

Tutorial 3: A Simple Window

Introduction to Computer Graphics (CS602) Lecture No 04 Point

Using DAQ Event Messaging under Windows NT/95/3.1

. DRAFT version 0.681

Creating a DirectX Project

Windows and Messages. Creating the Window

MOBILE COMPUTING Practical 1: Graphic representation

HANNAH HOWARD #ABOUTME

Programming in graphical environment. Introduction

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

Computer Programming Lecture 11 이윤진서울대학교

Tutorial 9:Child Window Controls

Task Toolkit Manual for InduSoft Web Studio v6.1+sp3

Front Panel: Free Kit for Prototyping Embedded Systems on Windows

Guide to Good Practice in using Open Source Compilers with the AGCC Lexical Analyzer

Programming In Windows. By Minh Nguyen

Tutorial 7: Mouse Input

4 th (Programmatic Branch ) Advance Windows Programming class

Windows Programming in C++

Alisson Sol Knowledge Engineer Engineering Excellence June 08, Public version

Windows Programming. Krzysztof Mossakowski, MSc

Aspect-Oriented Programming with C++ and AspectC++ AOSD 2007 Tutorial. Part V Examples. Examples V/1

Application Note QWinTM GUI Kit for Prototyping Embedded Systems on Windows

// handle of dialog box

Win32 Multilingual IME Overview for IME Development

Advantech Windows CE.net Application Hand on Lab

Lecture 5: Introducing Dialog Boxes & Child Window Controls for Win 32 API

CS410 Visual Programming Solved Online Quiz No. 01, 02, 03 and 04. For Final Term Exam Preparation by Virtualians Social Network

Game Programming Genesis Part II : Using Resources in Win32 Programs by Joseph "Ironblayde" Farrell

Review. Designing Interactive Systems II. The Apple Macintosh

Abstract. MSc. Electronics: Computer Graphics. Sept Abstract.

uvi ... Universal Validator Interface Software Developers Kit Revision /29/04 Happ Controls

Modern GUI applications may be composed from a number of different software components.

Question No: 1 (Marks: 1) - Please choose one For showing Dialog we can use "ShowWindow(...)" function.

x86.virtualizer source code

Windows Sockets: A Quick And Dirty Primer

Thecontentsofthismanualdescribetheproduct, BDS-PROLOG forwindows(hereinafter

Windows Socket Message-Driven/WSAAsyncSelect Model. Prof. Lin Weiguo Copyleft 2009~2015, College of Computing, CUC

Multithreading Multi-Threaded Programming. Prof. Lin Weiguo Copyleft 2009~2017, School of Computing, CUC

Detecting USB Device Insertion and Removal Using Windows API

Input and Interaction

VYLEPŠOVANIE KONCEPTU TRIEDY

Spájanie tabuliek. Jaroslav Porubän, Miroslav Biňas, Milan Nosáľ (c)

arxiv: v1 [physics.med-ph] 22 Aug 2016

Message-Passing Interface for Microsoft Windows 3.1

A Short Course for REU Students Summer Instructor: Ben Ransford

zhx.ch 收集整理 MFC for that matter) so you can't build ATL or WTL projects with the Express version. If you are using VC 6, then you need the Platf

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

Digital Storage Oscilloscope. Appendix

Animated 3D Worlds Using Java and SketchUp Chonmaphat Roonnapak

WTL for MFC Programmers, Part I - ATL GUI Classes By Michael Dunn

Databázové systémy. SQL Window functions

Different Ways of Writing Windows Programs

CS1253-VISUAL PROGRAMMING S4 CSE & S6 IT 2 MARKS & 16 MARKS PREPARED BY S.VINILA JINNY, L/CSE Y. JEYA SHEELA, L/IT

Charles River Media. A part of Course Technology, Cengage Learning

CC Pilot XS. Video interface description

CS410 Visual Programming Solved Objective Midterm Papers For Preparation of Midterm Exam

Lecture 6 : Multitasking & DLL

Socket I/Os in Windows. Dae-Ki Kang

CS410. Note: VuGujranwala.com is not responsible for any solved solution, but honestly we are trying our best to Guide correctly.

D.Signer prostriedok pre vytváranie zaručeného elektronického podpisu. Inštalačná príručka

Client and Server (DirectX)

How to Integrate 32-Bit LabWindows/CVI 4.0 Libraries into Microsoft Visual C/C++ or Borland C/C++ Patrick Williams

Hands-On Lab. Multitouch Gestures - Native. Lab version: Last updated: 12/3/2010

Developing a Prototype Window s Mobile Application

Lambda Expression & Concurrency API. 김명신부장 Principal Technical Evangelist

Important Data Types Compared

Profiling FlashFX Disk Performance Christopher Tacke, emvp Windows CE Product Manager, Applied Data Systems Columbia, Maryland April 23, 2002

Windows Programming DCAP509

SHORT QUESTIONS & ANSWERS

1 Komplexný príklad využitia OOP

#include <commctrl.h> #include "resource.h" #include "paintpic.h" //----- Global Variables

BÀI 2. CÁC CHẾ ĐỘ VÀO RA TRÊN WINSOCK

Binghamton University. EngiNet. State University of New York

The Amazing DX Workshop

Mobile Application Development (Part 1)-Program a Sound-Monitoring Prototype

ADSmartIO Driver Specification for Windows CE

Introducing MFC. Programming Windows with MFC, Second Edition. Jeff Prosise

Translating Python to C++ for palmtop software development - 1 Acknowledgments 1 Acknowledgments

Interrupt-Driven Digital Control

Databázy (1) Prednáška 11. Alexander Šimko

Game Programming Genesis Part III : Tracking Your Window and Using GDI by Joseph "Ironblayde" Farrell

On Typesafe Aspect Implementations in C++

Transcription:

systemove programovanie win32 programovanie

zakladny princip uzivatel interaguje so systemom klavesnicou, mysou tym generuje udalosti, ktore sa radia do,,message queue" (front sprav) aplikacia vytahuje v cykle spravy z MQ a spracovava ich nekonecny while() = *message loop*

zakladny princip sprava vytiahnuta z message queue je odoslana na spracovanie do vhodnej funkcie dispatch message v aplikacii je teda cyklus: 1. vytiahni spravu 2. urci jej typ 3. posli do metody 4. goto 1

zakladny princip tento princip sa pouziva takmer vsade, kde je gui java swing MQ je schovana EDT vlakno manazuje MQ gtk jediny problem: message dispatch musi byt rychly inak sa,,kotvi" user interface

vykreslovanie vykreslovanie vo windowse riesi GDI (resp. GDI+) (nie global defense initiative z C&C) GDI ma klasicke operacie nakresli obdlznik elipsu vykresli text vo Viste a novsom je GDI na odchode nemozno hw akcelerovat atd

programovanie v c zakladne kroky: #include <windows.h> jemny rozdiel: entry point je WINMAIN nie main() int WINAPI WinMain( HINSTANCE hinstance, HINSTANCE hprevinstance, LPSTR lpcmdline, int ncmdshow )

vytvorenie okna: WNDCLASS,,trieda okna" vsetky okna s rovnakou WNDCLASS zdielaju *window procedure* teda proceduru spracovavajucu spravy cez triedu mozno nastavit spolocne atributy okna titulok, pozadie,...

MSG msg ; WNDCLASS wc = {0}; wc.lpszclassname = TEXT( "Center" ); wc.hinstance = hinstance ; wc.hbrbackground = GetSysColorBrush(COLOR_3DFACE); wc.lpfnwndproc = WndProc ; wc.hcursor = LoadCursor(0,IDC_ARROW); ukazkovy WINMAIN RegisterClass(&wc); CreateWindow( wc.lpszclassname, TEXT("Center"), WS_OVERLAPPEDWINDOW WS_VISIBLE, 100, 100, 250, 150, 0, 0, hinstance, 0); while( GetMessage(&msg, NULL, 0, 0)) { TranslateMessage(&msg); DispatchMessage(&msg); } return (int) msg.wparam;

vytvorenie okna: CreateWindow okno (window) je kazdy ovladaci prvok vytvorenie,,instancie": HWND WINAPI CreateWindow( LPCTSTR lpclassname, LPCTSTR lpwindowname, DWORD dwstyle, int x, int y, int nwidth, int nheight, HWND hwndparent, HMENU hmenu, HINSTANCE hinstance, LPVOID lpparam );

vytvorenie okna: CreateWindow nazov triedy ookna titulok styl koordinaty (x, y, sirka, vyska) identifikator a vlastnika (hinstance) CreateWindow( wc.lpszclassname, TEXT("Center"), WS_OVERLAPPEDWINDOW WS_VISIBLE, 100, 100, 250, 150, 0, 0, hinstance, 0);

message loop MSG: window message správa okna (prakticky int) Get: vytiahne z queue Translate: vyriesi kombinacie klaves Dispatch: odosle window procedure MSG msg; while( GetMessage(&msg, NULL, 0, 0)) { TranslateMessage(&msg); DispatchMessage(&msg); }

window procedure procedura, ktora prijima message prakticky mega-switch, kde na zaklade typu spravy povie, co sa ma stat priklad: po sprave DESTROY zavrie okno LRESULT CALLBACK WndProc( HWND hwnd, UINT msg, WPARAM wparam, LPARAM lparam ) { switch(msg) { case WM_DESTROY: { PostQuitMessage(0); return 0; } } return DefWindowProc(hwnd, msg, wparam, lparam); }

vytvaranie komponentov formulara vo window procedure reagujeme na WM_CREATE povytvarame komponenty CreateWindow kazdy komponent Windows ma svoj preddefinovany window class priklad: label = "static"

vytvarame label vo WndProc, class: STATIC hwnd: handle rodica (HMENU) 1: identifikator konkretneho komponentu, ktorym sa mozeme riadit v obsluhe udalosti case WM_CREATE: { CreateWindow(TEXT("STATIC"), TEXT("Hello"), WS_CHILD WS_VISIBLE SS_LEFT, 20, 20, 300, 230, hwnd, (HMENU) 1, NULL, NULL); return 0; }

vytvarame button vo WndProc, class: button hwnd: handle rodica (HMENU) 2: identifikator konkretneho komponentu, ktorym sa mozeme riadit v obsluhe udalosti CreateWindow(TEXT("button"), TEXT("Quit"), WS_VISIBLE WS_CHILD, 120, 50, 80, 25, hwnd, (HMENU) 2, NULL, NULL);

obsluha udalosti window procedure ma parametre suvisiace so spravou HWND: handle okna UINT msg: cislo spravy existuje kilometrovy zoznam preddefinovanych sprav aplikacia moze definovat vlastne vid WinAmp WPARAM, LPARAM: semantika zavisi od konkretnej spravy

obsluha udalosti reagujeme typicky na WM_COMMAND priklad: po kliknuti na tlacidlo s HMENU 2 koncime aplikaciu case WM_COMMAND: { if (LOWORD(wParam) == 2) { PostQuitMessage(0); } } break;

poznamky window procedure musi obsluzit vsetky spravy tie, ktore nevie, musi delegovat na defaultnu window procedure return DefWindowProc(hwnd, msg, wparam, lparam);

ako dalej, pan programator MSDN tutorialy: husty, ale dostatocny: http://zetcode.com/tutorials/winapi/ jemne obsiahlejsi http://www.winprog.org/tutorial