280 likes | 505 Views
Visual Programming. Lecture – 1 Miss. SADAF MAJEED SIAL Computer Science Department Bahauddin Zakariya University Multan. Visual Programming.
E N D
Visual Programming Lecture – 1 Miss. SADAF MAJEED SIAL Computer Science Department Bahauddin Zakariya University Multan.
Visual Programming • Visual programming is used to provide a user-friendly interface for interacting with the program. Different objects like windows, menus, buttons are used to develop GUI. • In VPE(Visual Programming Environment), the programmer designs user interface visually instead of writing code, It also provides the facility to attach code with each components. • VPE in which the user can drag-n-drop objects to build programs. Advantages: • Easy to learn & use • Dsn’t have to write code to create components • Components can be moved, resized & deleted. • Visual Components can react to different events. Dis-Advantages: • Heavy and require more memory • Requires a computer with higher capacity of HD. • Faster processor for execution • Implemented on Graphical Operating System.
IDE • Also known as integrated design environment or integrated debugging environment is a s/w application that provides comprehensive facilities to computer programmers for s/w development. • An IDE normally consist of: • A source code editor • Compiler/interpreter • Build automation tools • Debugger • IDEs typically present a single program in which all development is done. • This program typically provides many features for • Authoring • Modifying • Compiling • Deploying • Debugging
Visual programming means basically a windows programming, e-g…. • VB, VC++ • Before starting visual programming we should know about DOS programming e-g… • c/c++ , Pascal, COBOL , ….etc
Difference b/w DOS and Windows programming • Sequential programming. • 16-bit application. • Static library • Hardware dependent • Its output is on blank screen, we can say that it is TUI. • Different Style programs. • Event-driven programming. • 32-bit application. • Dynamic Library. • Hardware independent. • Its output is on Graphical User Interface. • Same style programs.
Visual C++ • Also abbreviated as MSVC. • It has tools for developing and debugging c++ code, especially code written for the • Microsoft windows API, • DirectX API & • MS.Net Framework. • It has two versions that is: • 16-bit version • 32-bit version
Visualc++ is a textual language which uses a graphical user interface builder to make programming decent interfaces easier on the programmer. • VC++ also includes a large & elaborate collection of SDK, all used through a windowed interface tools of VC++. • MFC • AppWizard • Class Wizard • App Studio
Visual C++ development Environment • Today our focus will be on learning about the Visual c++ development environment and some of the tools that it provides for building applications. • The primary areas of VC++ development environment. • Application Wizard • Dialog Painter • Class Wizard
First you start visual c++ developer, then the area of visual studio divide in some parts as • Workspace: area of left side of developer studio, that allows you to view the parts of your applications in three different tabs: • Class view • Resource view • File view • The Output Pane: its not visible when we start VC++, after you compile your first application, it appears at the bottom of the developer studio environment, we see there • Compiler progress statement • Warnings • Error messages • The Editor area: The area on the right side of developer. This is the area where you perform all your editing. • Menu bars: • Standard toolbar • Wizard bar enables you to perform a number of class wizard action without opening class wizard. • Build minibar used to build and Run Commands
VC++ Projects • When we make a program in VC++, that consists more than one files that’s why we called it projects rather than program. • It is mostly consist of following files: • Header file (.H) • Source file (.cpp) • Workspace file (.dsw) • Resource file (.rc)
Header file : contains the function prototype and constant declaration. • Source Code file: contains the coding of program. • Workspace File: contains the information about project and its files. • Resource file: contains the information's about menus, toolbars, status bar, icons, bitmap, accelerations and string tables…..etc
VC++ project types • Win32 Console application • Win32 application • MFC application wizard (exe) • Application wizard (dll) • Database wizard
What is an API? • Application Programming Interface. • API is a collection of functions used to create windows applications. • Programs can be created by calling the functions present in the API. • Windows itself uses the API to perform its amazing tasks. • The windows API are of two basic varieties: • API for 16-bit Windows (Win-16 API) • Windows 3.1 • API for 32-bit Windows (Win-32 API) • Windows 95, NT….etc
Difference b/w OS & API • Most programmers says these two are synonymous. An OS contains data structures, commands and one or more programming interfaces. • Windows support multiple programming interfaces. • For example: windows 95 supports 3 programming interfaces: • MS-DOS • Win-16 • Win-32 • Windows NT supports 5 API : • DOS • Win-16 • Win-32 • POSIX (Portable Operating System Interface) • OS/2 console API.
Difference b/w Win16 and Win32 APIs? • Win16 is a 16-bit API that was created for 16-bit processors, and it relies on 16-bit values. • Win16 APIs can be considered as a subset of Win32 API. • It relies on 3 main components that is • USER.EXE • GDI.EXE • KRNL386.EXE • All components have .exe extensions. • Win32 is a 32-bit API created for the current generation of 32-bit CPUs and it relies on 32-bit values. • Win32 API contains almost everything that the win16 API has , and much more. • It relies on 3 main components: • USER32.DLL • GDI32.DLL • KERNEL32.DLL • All components are files of Dynamic Link Libraries.
What is DLL? • DLL stands for Dynamic Link Libraries, A DLL is a binary file that provides a library of functions, objects and resources. • All the API functions are contained in DLL. • The functions present in DLLs can be linked during execution. • These functions can also be shared between several applications running in Windows.
How do I run a simple DOS program containing main() in place of WinMain(), in VC++?
How do I write the world’s smallest Windows Program? #include<windows.h> Int _stdcall WinMain(HINSTANCE hInstance, HINSTANCE hPrevInstance, LPSTR lpszCmdline, int nCmdShow) { MessageBox(0,”Hello”,”Title”,0); return(0); }
Calling Conventions • Calling conventions indicates the order in which the arguments are passed to a function when a function call is made. • VC++ supports several different conventions for calling functions • These are: _cdecl , _stdcall , _fastcall , _pascal………etc
Hungarian Notations? • Hungarian Notation is a variable-naming convention. • According to this convention the variable name begins with a lower case letter or letters that denotes the data type of the variable. • For example: • The prefix sz in szCmdLine stands for “String terminated by Zero” • The prefix h in hInstance stands for “handle”. • The prefix n in nCmdShow stands for Int
Handle? • A handle is simply a number that refers to an entity. • Its s 32 bits in size. • The entity could be a window, an icon, a brush, a cursor, a file or any such entity. • The actual value of the handle is unimportant to your programs, but the Windows module that gives your program the handle knows how to use it to refer to the entity.
WinMain() • Its a main function of Windows Programming. • WinMain() receives four parameters: • hInstance This is the ‘instance handle’ for the running application. Windows creates this unique ID number when the application starts. • hPrevInstance More than one copy of the same Windows application can run at the same time, if another copy is started, hPrevInstance will contain the hInstance value for the last copy started. • lpszCmdLine A pointer to a character string containing the command line arguments passed to the program. • nCmdShow An integer value that is passed to the function. This number tells the program whether that it creates should appear which mode as maximize, minimize or normal.
MessageBox( ): • function pops up a message box whose title is “title” and which contains a message “Hello”. • Return(0): • Returning 0 from WinMain() indicates success, whereas, returning a nonzero value indicates failure.
Thanks!!! Dated: 14/10/2010