You are on page 1of 7

UNIT I 1. What do you mean by SDK? It is an acronym for Software Development Kit.

It is a set of tools designed to help C programmers create Windows applications. The Windows SDK consists of the following elements: A large set of books describing f nctions messages! str ct res! macros and reso rces. "ario s tools incl ding a dialog editor and an image editor. #n$line help files. A set of Windows libraries and header files. Sample Windows programs in C. 2. ive !ome "ommon Simple Win#2 data type! defined in the Window! header file!. Data types are %##&! %'T(! C)A*! DW#*D! )A+D&(! &#+,! &-CST*! &-ST*! S)#*T! .I+T! W#*D. #. Define !tati" data. Static data is any portion of the program that is not e/ec ted as machine instr ctions and which does not change as the programs e/ec tes. The Windows term for static data is $e!tore data or $e!our"e!. %. What do you mean by "allin& "onvention? Calling con0entions indicate the order in which the arg ments are passed to a f nction when a f nction call is made. "C11 s pports different con0entions like 2cdecl !2stdcall ! 2fastcall! thiscall. '. What i! (un&arian Notation or Namin& "onvention? It is a 0ariable$naming con0ention so called in the hono r of the legendary 3icrosoft programmer Charles Simonyi. According to this con0ention the 0ariable name begins with a lower case letter that denotes the data type of the 0ariable. )*+ Prefix Data Type c by n i x, y cx, cy char or WCHAR or TCHAR BYTE (unsigned char) short int int used as x-coordinate or y-coordinate int used as x or y length; c stands or !count!

b or f w l dw fn s sz h p

B""# (int); stands or ! lag! W"R$ (unsigned short) #"%& (long) $W"R$ (unsigned long) unction string string ter'inated (y ) character handle *ointer

,. What i! a handle? A handle is simply a n mber 4 s ally 56 bits in si7e8 that refers to an entity. The entity co ld be a window! an icon! a br sh! a c rsor! a file or any s ch entity. -. What i! Window! .ro&rammin&? Windows -rogramming ses ,.I concept. It is an e0ent$dri0en -rogramming. An Application Window will respond to the e0ents by generating a message by the #perating System. It ses graphics for organi7ing ser workspace. -rograms that r n within Windows also se ,.I. ).&.+ Word! (/cel. These application programs se some b ilt$in f nctions present in A-I. /. 0i!t the main header file! in Window! .ro&rammin&? WI+D#WS.)! WI+D(9.)! WI++T.)! WI+%AS(.)! WI+.S(*.)! WI+,DI.) 1. What i! an 2.I? A-I is an acronym for Application -rogramming Interface. It is simply a set of f nctions that are part of Windows #S. Calling the f nctions present in the A-I can create programs. 13. What are the !tep! re4uired to "reate a window? The steps re: ired to create a window are! a. *egistering Window Class b. Create a Window sing create f nction c. 3essage &oop to process e0ents d. Window -roced re with specific tasks for messages. 11. What are the !tep! to di!play the window? After the window is created to display the window on the screen two

f nctions are sed. i. Show window ;p ts the window on the display ShowWindow5hwnd6 i7mdShow89 ii. .pdate window$ca ses the client area to be painted. Ca ses the client area to be painted by sending the window proced re a W32-AI+T message. UpdateWindow5hwnd89 12. Define me!!a&e loop. Windows maintains a <message : e e= for each Windows program c rrently r nning nder Windows. When an inp t occ rs! Windows translates the e0ent into a <message= then it places in the program>s message : e e. A program retrie0es these messages from the message : e e by e/ec ting a block of code known as the <message loop=: while4,et3essage4?msg! +.&&! @! @88 A Translate3essage4?msg8B Dispatch3essage4?msg8B C 1#. Define Default Window .ro"edure. When a window proced re processes a message! it sho ld ret rn @ from the window proced re. All the messages that a window proced re chooses not to process m st be passed for defa lt processing. This defa lt processing is done by a WindowDs f nction named DefWindow-roc. DefWindow.ro"5(WND hwnd6 UINT me!!a&e6 W.2$2: w.aram6 0.2$2: l.aram89 1%. Define Devi"e 7onte*t. The de0ice conte/t 4<DC=8 is a data str ct re maintained internally by ,DI. A de0ice conte/t is associated with a partic lar display de0ice! s ch as a 0ideo display or a printer. 9or a 0ideo display! a de0ice conte/t is s ally associated with a partic lar window on the display. Some of the 0al es in the de0ice conte/t are graphics <attrib tes=. These attrib tes define some partic lars of how ,DI drawing f nctions work. 1'. 0i!t any two method! for &ettin& a devi"e "onte*t handle? :ethod 1+ This method is sed when W32-AI+T messages is processed.

Two f nctions are in0ol0ed: %egin -aint and (nd -aint. "a!e W:;.2INT+ hd" < =e&in.aint 5hwnd6 >p!89 ?u!e DI fun"tion!@ )nd.aint5hwnd6>p!89 return 39 :ethod 2+ To get a handle to the de0ice conte/t of the client area of the window ,etDC is called. *eleaseDC is sed to release the DC handle. hd"< etD75hwnd89 ?u!e DI fun"tion!@ $elea!eD75hwnd6hd"89 1,. What i! the u!e of et:e!!a&e? The ,et3essage f nction retrie0es a message from the : e e and copies it to a str ct re of Type 3S,. 1-. What i! the u!e of Tran!late:e!!a&e? A message &oop incl des Translate3essage. If the messages loop recei0e character inp t from the keyboard! the system generates 0irt al key messages CW2K('D#W+ and W32K('.- to each key the ser process. 1/. What i! the u!e of Di!pat"h :e!!a&e? The Dispatch 3essage f nction sends a message to the window proced re associated with the window handle specified in the 3S, str ct re. 11. What i! W:;.2INT me!!a&e? The message is generated when a part or all of the windows client area is <in0alid= and m st be < pdated= which means that it m st be redrawn or <painted=. 23. ive !ome 7ommon Stru"tured Win#2 data type! defined in the Window! header file! Data types are %IT3A-! &#,%*.S)! &#,9#+T! &#,-(+! 3S,! -#I+T! *(CT! W+DC&ASS.

21. ive !ome $e!our"e! E Icons

E C rsors E Character strings E C stom reso rces E 3en s E Keyboard accelerators E Dialog bo/es E %itmaps 22. Define event driven? (0ent dri0en means the flow of program e/ec tion is controlled by that e0ent that occ rs as the program is r nning. 2#. What i! W:;D)ST$AB me!!a&e? W32D(ST*#' message indicates that a window is in the process of destroying a window based on a command from the ser. The message is a res lt of the ser clicking on the close b tton or selecting close from the program>s System message. 2%. (ow a Window pro&ram i! terminated? When the postF it message f nction is in0oked it inserts a W32F.IT message in the -rogram>s message : e e. ,et3essage ret rns 7ero for W32F.IT message. This ca ses Win3ain to come o t of the 3essage &oop. The program then ret rns msgW-aram and is terminated. 2'. What i! DI? The ,raphics De0ice Interface 4,DI8 pro0ides f nctions and related str ct res that an application can se to generate graphical o tp t for displays! printers and other de0ices. 2,. 7la!!ify DI fun"tion!. The se0eral f nctions that comprise ,DI can be classified into: i. 9 nctions that get DC and release DC. ii. 9 nctions that get information abo t DC. iii 9 nctions that draw something on the client area. i0. 9 nctions that set and get attrib tes of DC. 0. 9 nctions that work with ,DI primiti0es. 2-. What are DI primitive! or obCe"t!? ,DI primiti0es or obGects refer to the types of graphics that can be displayed on the client area. They are: i. &ines and c r0es ii. 9illed areas iii. %itmaps i0. Te/t 2/. What i! a window and Window!? Windows is an #perating System 4sHw that controls hHw8 and window is a rectang lar area which recei0es inp t and displays o tp t in the form of te/t and graphics. 21. Define 7hild window!.

A window can ha0e a parent window. A window that has a parent is called a child window. The parent window pro0ides the coordinate system sed for positioning the child window. A window that has no parent or whose parent is desktop window is called a top$le0el window. #3. ive !ome "hild window "ontrol!. Some of the child window controls are (dit bo/! ,ro p bo/! - sh % tton! Check bo/! *adio b tton! static bo/. #1. What are the field! in :S !tru"ture? )W+D: The handle to the window which the message is directed to 3(SSA,(: The message identifier. This is a n mber that identifies an e0ent W-A*A3: A 56$bit message parameter .The meaning and 0al e of which depend on the partic lar message. &-A*A3: Another 56$bit message parameter dependent on the message. TI3(: The time the message was place in message : e e. -T: The mo se coordinates at the time the message was placed. #2. What are 4ueued and nonD4ueued me!!a&e!? The : e ed messages are those that are placed in a programs message : e e by Windows. The non$: e ed messages are not posted to a message : e e. The non$: e ed messages are the res lts of calls by Windows directly to window proced re. ##. ive !ome me!!a&e! u!ed in window!? W32C*(AT(: This message is sent when a window is being created. W32&%.TT#+D#W+: This message is sent when the ser press the left. W32C)A*: This message is sent when the ser types a character. W32C&#S(: This message is sent when the ser closes a window. W32C#33A+D: This message is sent to appropriate window in response to ser men choices! dialog b tton clicks and so on. #%. Write the prototype of Win:ain fun"tion? Win3ain 9 nction -rototype: int WI+A-I Win3ain 4)I+STA+C( hinstance! )I+STA+C( hpre0instance! -ST* s7cmdline! int icmdshow8 #'. Name the important D00 file! whi"h are u!ed for window! pro&rammin&? K(*+(&56.D&&! .S(*56.D&&! ,DI56.D&& 5J. What are the mappin& mode!? #-. What i! Window .ro"edure in window! pro&rammin&. #/. When the W:;.2INT me!!a&e i! invoEed in a window! pro&ram #1. (ow will you di!play te*t in window! pro&rammin&? %3. Write a !imple window! pro&ram to print F(ello WorldG

%1. %2. %#. %%. %'.

Define and li!t down the DI .rimitive!. )*plain in brief the window! :S Stru"ture. 0i!t the !tyle! for a .u!h button "hild window "ontrol. Define $e&i!terin& of window "la!!. What are the event! &eneratin& W:;.2INT me!!a&e?