Anda di halaman 1dari 6

MicroSoft SDK Paper:

1. 3 most important libraries which a 32 bit program links to are:


Kernel32.dll, User32.dll, Gdi32.dll
__OR__
Kernel32.lib, user32.lib, gdi32.lib
2. The most important include file in any program of SDK is
windows.h
3. Please write the prototype of WinMain
int WINAPI WinMain(HINSTANCE hInstance, HINSTANCE hPrevInstance,
PSTR szCmdLine, int iCmdShow);
__OR__
int WINAPI WinMain(HINSTANCE, HINSTANCE, PSTR, int);
A student may write LPSTR instead of PSTR, it is agreeable.
4. Why hPrevInstance is always NULL in 32 bit platforms ?
a. Because it was never needed and was extra argument
b. Because we could create multiple instances of a prog in 16 bit platform
c. Because hPrevInstance points to resources at startup, and we dont have
them when our program starts.
d. None of the above.
5. The default configurations given by SDK for building your programs are
Debug and Release
6. Can we compile and link our programs if we dont have Microsoft VC++ IDE ? If
yes, kindly tell the name of the tool
Yes, Name is nmake
7. If we create five windows from a window class mywindow, how many window
procedure will there be in my code ?
1
8. How many message queues will be created if I create 5 windows from a class
mywindow?
1
9. How many message queues will be created if I create 5 windows from a class
mywindow and 3 windows from another class mywindow2 which is in
another thread?
2
10. Windows has a total repository of brushes and other such objects which are
standard these standard objects can be consumed using which API ?
a. GetClientRect
b. GetWindowObject
c. GetStockObject
d. GetRepositoryObject
11. To register a class with windows, we have to fire which API ?
a. RegisterClass
b. BookClass
c. RegisterWindows
d. None of the above

12. To get the last error encountered in any application, which API can we use ?
a. GetError
b. GetWindowError
c. GetLastError
d. None of the above
13. WM_CREATE message is generated when we call
a. ShowWindow
b. UpdateWindow
c. CreateWindow
d. RegisterClass
14. GetMessages last 3 parameters are set to NULL or zero
a. Because we are interested in all the messages for all the windows that we
have constructed.
b. Because we are interested in messages only from client area
c. Because we wish to TranslateMessage
d. None of the above.
15. SendMessage is a blocking call ? True / False
16. PostMessage directly send messages to windows procedure. True/False
17. First WM_PAINT message it given to windows proc when we call
a. UpdateWindow
b. CreateWindow
c. ShowWindow
d. RegisterClass
18. How many WM_PAINT messages can be there in MessageQueue of a program ?
a. 1
b. 2
c. Infinite
d. 0
19. Can we write a code like this ?
case WM_PAINT:
return 0;
a. Yes
b. No, because we wont get WM_PAINT messages out of message queue
c. No, because we wont be validating the invalidate region
d. Yes, because we have already processed the message.
20. When we close an application using X on the right hand top corner, windows
sends the following messages in sequence
a. WM_SYSCOMMAND / WM_DESTROY / WM_CLOSE / WM_QUIT
b. WM_SYSCOMMAND / WM_CLOSE / WM_DESTROY / WM_QUIT
c. WM_LBUTTONDOWN / WM_SYSCOMMAND / WM_CLOSE /
WM_DESTROY / WM_QUIT
d. WM_SYSCLOSE / WM_CLOSE / WM_DESTROY / WM_QUIT
21. There are two major types of messages in Windows. What are these two types ?
Queued and Non-Queued
22. To force an application to generate WM_PAINT message, we have to fire
a. WM_PAINT using sendmessage

b. WM_PAINT using postmessage


c. InvalidateRect
d. We can t force windows to send us WM_PAINT
23. What all API can be used to get the windows client area device context ?
a. GetWindowsDC / BeginPaint
b. GetWindowDC / GetDC
c. GetDC / BeginPaint
d. There is only one way to get Client area DC
24. To get the size associated with text on windows, we use
a. GetFontSize
b. GetTextMetrics
c. GetSystemMetrics
d. GetFontMetrics
25. To set the range of scroll bars we use
a. SetScrollRange
b. SetScrollBar
c. SetRangeOfScroll
d. SetWindowsScroll
26. To create a line we use
LineTo
27. To make permanent changes to Device Context we use
a. CS_OWNDC
b. Global Variable of types HDC
c. SetPermDC
d. None of the above
28. To create a round corner rectangle we use
RoundRect
29. To get current position on the screen we can use
GetCurrentPositionEx
30. To Create a pen we use
CreatePen
31. To set a created brush into device context we use
SelectObject
32. To create a hatched brush we use
CreateHatchedBrush
33. The window that receives a particular keyboard message is the window that has
the input focus __OR__ focus
34. There are two types of messages generated from a keyboard
WM_KEYDOWN , WM_SYSKEYDOWN
35. The virtual key code used for tracking backspace is
a. VK_BACK
b. VK_BACKSPACE
c. VK_DEL
d. VK_ERASE

36. If we keep on holding a particular key on keyboard, window increments a counter


before sending a WM_KEYDOWN message. What is the name of that counter ?
Repeat Count
37. While processing a keyboard message, if you wish to check for SHIFT /
CONTROL / NUM LOCK / SCROLL LOCK keys being pressed, you will use
a. GetKeyToggle
b. GetKeyState
c. GetKeyPressed
d. GetKeysDown
38. For receiving double click message we have to do the following
a. ReceiveDblkMessages
b. RegisterWithDBLK
c. Register an option CS_DBLCLKS while defining the class
d. Set DBLK while receiving messages in GetMessage
39. Which is the message that is received first by any windows application ?
a. WM_HTCLIENT
b. WM_NCHITTEST
c. WM_HTERROR
d. WM_NONCLIENT
40. For requesting windows to send all the mouse messages even if your window is
not the active window, we use
a. SetCapture
b. SetMouseCapture
c. SetFocusMouse
d. SetMouseFocus
41. How many timers can be there in any message queue ?
1
42. SetTimer can be used to set the timer for any application. What message is
generated in such a case ?
a. WM_TIMERS or we can use different function to get the messages which
can be the last argument of SetTimer
b. WM_TIMERPROC
c. WM_TIME
d. WM_TIMER or we can use different function to get the messages which
can be the last argument of SetTimer
43. The parent window procedure uses ____________ for communicating with the
child control
a. Timer
b. Controller
c. SendMessage
d. WM_CHILD
44. The child control communicates with parent window using ________
a. Timer
b. Controller
c. SendMessage
d. WM_COMMAND

45. What API do we use to create Child Controls ? CreateWindow


46. To get the value of HINSTANCE in window procedure what technique can we
follow ?
a. Get the HINSTANCE from WM_PAINT message
b. Get the HINSTANCE from WM_LBUTTONDOWN message
c. Get the HINSTANCE from WM_CREATE message
d. Get the HINSTANCE from WM_SYSCREATE message
47. To set and get text from any window we use
a. SetWindowText and GetWindowText
48. For using Scrollbar control, we have to use CS_VSCROLL or CS_HSCROLL
identifiers while creating WNDCLASS object True / False
49. To trap the window messages of child control before they reach the child control
we have to use a technique called _____________
a. ( WindowSubclassing )
b. TrapWindowMessages
c. HookWindowMessages
d. PullChildProc
50. To load a cursor which has an id of ID_MYCURSOR, we have to use
a. LoadCursor with ID_MYCURSOR
b. MAKEINTRESOURCE within LoadCursor
c. LoadCursor with ID_MYCURSOR
d. None of the above
51. Two types of Dialog boxes are
a. Modeless and Modal
52. To create Modeless dialog box we use
a. DialogBox
b. CreateDialog
c. DialogBoxLess
d. None of the above
53. 3 types of libraries in SDK are
a. Static , Import and Dynamic
54. For capturing a DC compatible to current DC we use
a. CreateCompatibleDC
55. Without using threads if we wish to NOT BLOCK for windows messages, we
should use
a. PeekMessage
b. GetMessage with last argument as 1
c. WM_IGNORE
d. Not possible
Practicals:
Either of below:
1. Create a notepad without edit button class. Use a menu bar with Save and Open
option to save the contents to a FIXED HARDCODED LOCATION. Use

modeless dialog box to search for any word within the buffer. If you find that
word, make some identification such as change background color or change
alignment etc.
2. Create 2 edit boxes with 1 add button. 1 more edit box for the result. Make a call
to add function from a library. The result should be displayed with help of a
thread which does the task of sending data to edit box. ( HINT: Thread should
block on Event object and when library returns, you should notify the thread to
display the data )

Anda mungkin juga menyukai