0% found this document useful (0 votes)
34 views14 pages

Question Bank For SDK

This document is a question bank for the Win32 SDK, containing fill-in-the-blank questions, true or false statements, matching exercises, and multiple-choice questions. It covers various aspects of Windows programming, including message handling, GDI functions, and dialog procedures. The content is structured to help learners test their knowledge and understanding of the Win32 API.

Uploaded by

shubham wagh
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
34 views14 pages

Question Bank For SDK

This document is a question bank for the Win32 SDK, containing fill-in-the-blank questions, true or false statements, matching exercises, and multiple-choice questions. It covers various aspects of Windows programming, including message handling, GDI functions, and dialog procedures. The content is structured to help learners test their knowledge and understanding of the Win32 API.

Uploaded by

shubham wagh
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd
You are on page 1/ 14

ACTS National Resource Center, Pune

Question Bank –Win32 SDK (Solved)

Fill in the Blanks:

1. Just as the entry point to a C program is the function main(), the entry point to a Windows program is ________.
(WinMain() )
2. The three main Windows libraries are _______, __________ & ___________. (Kernel.32, User32, GDI32)
3. The size of Unicode character is ___ bits. (32)
4. CreateWindow() function sends the __________ message. (WM_CREATE)
5. UpdateWindow() function sends the __________ message. (WM_PAINT)
6. PostQuitMessage() function posts the __________ message. (WM_QUIT)
7. GetMessage() function retrieves a message from the _____________. (message queue)
8. GetMessage() returns_____, when it retrieve WM_QUIT message form the message queue. (0)
9. TranslateMessage() function is used for _______ translation. (Keyboard)
10. Window procedure function is a ____________ function. (CALLBACK)
11. TA program can call its own window procedure by using the _________ function. (SendMessage)
12. DispatchMessage() function passes the MSG structure back to __________. (Windows)
13. The very first message that a window procedure receives is ___________. (WM_CREATE)
14. RegisterClass() associates a window procedure to the __________. (window class)
15. Window messages are defined in both windows.h and __________ header files. (winuser.h)
16. Everything that happens to a window is relayed to the __________ in the form of message. (Window Procedure)
17. __________ API is used for subclassing. (SetWindowLong() )
18. __________ API is used for character translation of keystrokes. (TranslateMessage() )
19. Message __________ occurs when the user clicks an item on the menu bar or presses a menu key.
(WM_INITMENU)
20. __________ API is used to kill a modal dialog box. (EndDialog() )
21. _________, _________ and ___________ are windows resources defined in a .Res file. (Any three of these -
ICON / CURSOR / STRINGTABLE / DIALOG / MENU / BITMAP)
22. _________ API is used to set the text of an edit control. (SetWindowText() )
23. ________ and _________ are GDI objects. (Any two from Brush / Pen / Region / Font / Palette / Bitmap)
24. When there is no message in the queue, PeekMessage() function returns ____. (FALSE or 0)
25. System keystrokes are generated for keys typed in combination with the ____ key. (Alt)
26. System keystroke messages are _________ and ________. (WM_SYSKEYDOWN, WM_SYSKEYUP)
27. The virtual key code is stored in the _________ parameter of the WM_KEYDOWN message. (wParam)
28. The repeat count field is stored in the _________ parameter of the keystroke messages. (lParam)
29. _________ function is used for checking the type of information available in clipboard.
(IsClipboardFormatAvailable())
30. _________ function is used to open the clipboard. (OpenClipboard())
31. _________ function is used to clear the clipboard. (EmptyClipboard())

Page 1 of 1
ACTS National Resource Center, Pune
Question Bank –Win32 SDK (Solved)

32. There are only two messages to ask for user confirmation before ending a program. These are _________ and
_________ messages. (WM_CLOSE, WM_QUERYENDSESSION)
33. After processing WM_QUERYENDSESSION message, the system sends the _________ message with the wParam
parameter set to the results of the WM_QUERYENDSESSION message. (WM_ENDSESSION)
34. The complete prototype of the MessageBox() function is _____________________. (int WINAPI
MessageBox(HWND, LPCSTR, LPCSTR, UINT))
35. There are two type of bitmap in Windows. These are __________ and __________ bitmaps. (device-independent,
device-dependent)
36. Metafiles are to _________ graphics as bitmaps are to raster graphics. (Vector)
37. A metafile consists of a series of _________ records that corresponds to graphics functions calls. (Binary)
38. The filename extension for the enhanced metafile is _____. (.EMF)
39. The enhanced metafile is created by using the _________ function. (CreateEnhMetaFile())
40. The ____________ function is use to get rid of all memory resources required to maintain the metafile.
(DeleteEnhMetaFile())
41. The _________ function displays the picture stored in the given Windows-format metafile on the specified device.
(PlayMetaFile())
42. The process to get access to the individual records of a metafile is called metafile __________. (Enumeration)
43. The _________ function enumerates the records within an enhanced-format metafile by retrieving each record and
passing it to the specified callback function. (EnumEnhMetaFile())
44. The ________ and _________ functions are used to create a new thread of execution. (CreateWindow() and
_beginthread())
45. The function _beginthread() requires the __________ header file. (process.h)
46. The ________ function returns the thread identifier, which is used as a handle of the calling thread.
(GetCurrentThreadId())
47. To initialize a CRITICAL_SECTION data type’s object, the __________ function is used. (InitializeCriticalSection())
48. Instead of a critical section, a ________ object is used for coordinating threads within two different processes that
share a resource. (mutex)
49. To create a logical font, the ___________ and _________ functions are used. (CreateFont(), CreateFontIndirect())
50. The LOGFONT structure has ______ fields. (14)
51. The _________ function is used to open common dialog box. (ChooseFont)

Page 2 of 2
ACTS National Resource Center, Pune
Question Bank –Win32 SDK (Solved)

Select True or False:

1. Windows.h is a master include file that includes other Windows header files. (True)
2. The Unicode character and a wide character are same. (False)
3. DispatchMessage() function passes the MSG structure back to Windows. (True)
4. Generally a program can call its own window procedure directly. (False)
5. Window procedure receives the WM_CREATE message after Windows completed the processing of CreateWindow()
function. (False)
6. BeginPaint() always erases the background of the client area even if it already erased. (False)
7. PostQuitMessage(0) directly closes the program. (False)
8. PostQuitMessage(0) inserts a WM_QUIT message in the program’s message queue. (True)
9. Only one window can be created based on a single window. (False)
10. The values of wParam and lParam are message-dependent. (True)
11. One window procedure cannot handle messages for multiple windows of the same window class. (False)
12. The queued messages are sent to a message queue and the nonqueued messages are posted to the window
procedure. (False)
13. WM_TIMER is a queued message. (True)
14. WM_QUIT is a nonqueued message. (False)
15. WM_COMMAND is a queued message. (False)
16. WPARAM in Win32 API is a form of long data type. (True)
17. LPARAM in Win32 API is a form of long data type. (True)
18. A window class can have multiple Window Procedures at a time. (False)
19. Rich Text control is a part of COMCTL32.DLL. (False)
20. PushButtons, Edit controls, Check Boxes are all windows. (True)
21. A menu attached to a window can be changed dynamically. (True)
22. PeekMessage() API may not be used to remove the messages from the message queue. (False)
23. SendMessage() is a blocking function. (True)
24. Timer messages are high priority messages. (False)
25. SendMessage(WM_QUIT) should be used to terminate a Windows application. (False)
26. Both the DeleteMenu() and RemoveMenu() functions are same. (False)
27. WM_TIMER messages are not asynchronous. (True)
28. WM_PAINT message has low priority. (True)
29. There can be multiple WM_PAINT messages in message queue. (False)
30. There cannot be multiple WM_TIMER messages in message queue. (True)
31. KillTimer() function cannot purge the pending WM_TIMER messages in message queue. (False)
32. One can not convert screen coordinate to client-area coordinates. (False)

Page 3 of 3
ACTS National Resource Center, Pune
Question Bank –Win32 SDK (Solved)

33. Windows directly places the keyboard messages into the application’s message queue, when a key is pressed and
released. (False)
34. Windows maintains a system message queue for the keyboard messages. (True)
35. GetMessage() function always returns control to a program regardless whether a message is present or not in the
message queue. (False)
36. Two applications using a same DLL can use the global variable defined in the DLL to shared data between them.
(False)
37. Every thread has its own private address space. (False)
38.Only RegisterClassEx function should be used to register a class whose attributes are stored in WNDCLASSEX
structure. (True)
39. Only CreateWindowEx function should be used to create window based on a window class registered using
RegisterClassEx function. (False)
40. Dialog box procedure must handle WM_PAINT message. (False)
41. Dialog box template for modal and modeless dialog box can be same. (True)
42. Once a menu is added to a window, it can’t be changed later. (False)
43. Metafiles are used for raster graphics. (False)
44. A metafile can be converted to a bitmap, without any loss of information. (False)
45. The default background mode is OPAQUE. (True)
46. In Windows only one program can have the clipboard open at any time. (True)
47. In Windows, to allocate memory for clipboard data, malloc() function can be used. (False)
48. The return type of the OpenClipboard() function is handle to clipboard. (False)
49. In Windows, one cannot store metafile in the clipboard. (False)
50. In Windows, a region cannot generate a WM_PAINT message. (False)
51. WM_COMMAND message is generated only by child window controls. (False)
52. DeleteEnhMetaFile() function delete the metafile from the hard disk. (False)
53. CreateMetaFile() function can be used to create enhanced metafile. (False)
54. One limitation with critical sections is that they can used for coordinating threads within a single process only. (True)
55. A dynamic-link library file can have any file extension. (True)

Page 4 of 4
ACTS National Resource Center, Pune
Question Bank –Win32 SDK (Solved)

Match the following:

A B
1. DispatchMessage() A. A Macro
2. MAKEINTRESOURCE() B. Windows NT
3. DestroyWindow() C. WndProc()
4. Security API D. Replacement for .INI files
5. Windows Registry E. Modeless Dialog Boxes

(1-C, 2-A, 3-E, 4-B, 5-D)

A B
a) List box 1) InterTask Communication
b) Metafile 2) System Global Class
c) Pen Plotter 3) Pseudo Device
d) Laser Printer 4) GDI Object
e) Region 5) Raster Output Device
f) Clipboard 6) Vector Output Device

(a-2, b-3, c-6, d-5, e-4, f-1)

Page 5 of 5
ACTS National Resource Center, Pune
Question Bank –Win32 SDK (Solved)

Select the Best Choice(s):

1. You can place a message in application message queue by


a) SendMessage() b) PostMessage()
c) PeekMessage() d) SetMessage()

2. From the following, which is the message that dialog box processes?
a) WM_DESTROY b) WM_QUIT
c) WM_COMMAND d) WM_CLOSE

3. The return type of dialog procedure is...


a) BOOL b) LRESULT
c) int d) void

4. Find out the odd function


a) BeginPaint()......EndPaint() b) GetDC()..........ReleaseDc()
c) CreateDc().........DeleteDc() d) CreateIC()

5. Which API is used to close a modeless dialog box?


a) EndDialog() b) KillDialog()
c) CloseDialog() d) DestroyWindow()

6. Which button style is used to group the buttons?


a) BS_AUTOGROUP b) BS_GROUPBOX
c) BS_SETCHECK d) BS_GROUPBUTTON

7. Which of the following is the correct declaration for Window Procedure WndProc?
a) LRESULT CALLBACK WndProc(HWND, UINT, LPARAM, WPARAM);
b) LRESULT CALLBACK WndProc(UINT, HWND, WPARAM, LPARAM);
c) LRESULT CALLBACK WndProc(HWND, UINT, WPARAM, LPARAM);
d) LRESULT far WndProc(HWND, UINT,WPARAM, LPARAM);

8. A child window control sends WM_COMMAND message to the parent window. The handle of child window control is
contained in the following message parameter.
a) wParam b) lParam
c) LOWORD (wParam) d) HIWORD (wParam)

9. The name of the system defined class for a check box control is-
a) CheckBox b) option
c) RadioButton d) button

10. In an MDI application, the responsibility of rearranging/ cascading document windows lies with
a) MDI Client b) MDI Frame Window
c) Main Window d) Child Window

11. This message is sent by the windows common controls (TreeView/ ListViews) to the parent window.
a) WM_COMMAND b) WM_COPY
c) WM_CREATE d) WM_NOTIFY

12. The function _beginthread() requires this header file.


a) THREAD.H b) PROCESS.H
c) WINDOWS.H d) AFX.H

Page 6 of 6
ACTS National Resource Center, Pune
Question Bank –Win32 SDK (Solved)

13. While processing WM_PAINT message this GDI function can be used to get the handle of device context.
a) GetDC() b) GetWindowDC()
c) BeginPaint() d) CreateCompatibleDC()

14. While writing a DLL this function has to be implemented.


a) LibMain() b) DllMain()
c) LibDll() d) WinDll()

15. This API is used to stretch and transfer a bitmap.


a) Bitblt() b) Stretchblt()
c) Patblt() d) Transferblt()

16. Windows NT is
a) Non Preemptive b) Preemptive
c) Co-operative preemptive d) Multi Preemptive

17. Which of the following messages terminates the message loop in WinMain() ?
a) WM_DESTROY b) WM_CLOSE
c) WM_QUERYENDSESSION d) WM_QUIT

18. Which is a 32-bit message parameter?


a) WPARAM b) LPARAM
c) Both d) None

19. TranslateMessage() converts


a) Keystroke messages to Character messages
b) Character messages to Keystroke messages
c) Menu messages to Accelerator messages
d) Accelerator messages to Menu messages

20. Which of the following message does a scroll bar to its parent window not send?
a) WM_VSCROLL b) WM_HSCROLL
c) WM_COMMAND d) WM_CTLCOLORSCROLLBAR

22. Which of the following is a blocking function?


a) CreateDialog() b) PeekMessage()
c) SendMessage() d) GetMessage()

23. Which of the following header file is required for an application using a common dialog?
a) CommCtl32.h b) Commdlg.h
c) Comdlg.h d) Commctl.h

24. Which of the following structures has a field that gives the offset of the pixel bits from the beginning of a device
independent bitmap file?
a) BITMAPFILEHEADER b) BITMAPINFO
c) BITMAPINFOHEADER d) RGBQUAD

25. The virtual key code for the page down key is
a) VK_DOWN b) VK_PGDOWN
c) VK_NEXT d) VK_PAGE

26. Which of the following API can be used to get a pointer to a global memory block if it’s handle is available.
a) GlobalLock() b) GlobalAllock()
c) Both d) None

Page 7 of 7
ACTS National Resource Center, Pune
Question Bank –Win32 SDK (Solved)

27. Which of the following APIs can be used to get the HINSTANCE of the application?
a) GetModuleInstance() b) GetClassLong()
c) GetWindowLong() d) SetClassLong()

28. In an MDI application, sending the WM_MDICREATE message with the following structure as lParam to the MDI
Client window can create a document window.
a) MDICREATESTRUCT b) CLIENTCREATESTRUCT
c) CREATECLIENTSTRUCT d) CREATEMDISTRUCT

29. Which of the following structure is used with the APIs related to kernel objects?
a) SECURITY_DESCRIPTOR b) SECURITY_ATTRIBUTES
c) SECURITY_INFORMATION d) SECURITY_MESSAGE
30. Which state a thread acquires when it is created by CreateThread()?
a) Running b) Sleeping
c) Ready d) Blocked
31. When a DLL is unmapped from a process’s address space, the system calls the DLL’s DllMain function passing it
the following value as the fdwReason argument.
a) DLL_THREAD_ATTACH b) DLL_PROCESS_ATTACH
c) DLL_THREAD_DETACH d) DLL_PROCESS_DETACH
32. You can set the Viewport extent and Window extent in:
a) MM_ANISOTROPIC mapping mode
b) MM_ISOTROPIC mapping mode
c) In both the MM_ISOTROPIC and MM_ANISOTROPIC mapping modes
d) In none of these modes

33. Which API is used to draw a circle?


a) Circle() b) Ellipse()
c) RoundRect() d) Pie()

34. Which function is used to create a modal dialog box?


a) CreateDialog() b) DialogBox()
c) CreateDC() d) AddDialog()

35. Which API is used to close a modal dialog box?


a) EndDialog() b) KillDialog()
c) CloseDialog() d) DestroyWindow()

36. Which function is used to create a modeless dialog box?


a) CreateDialog() b) DialogBox()
c) CreateDC() d) AddDialog()

37. Which is the first message that is send to a dialog box procedure ?
a) WM_INITDIALOG b) WM_NOTIFY
c) WM_COMMAND d) WM_CREATE

38. Which is the entry point function in a DLL?


a) WinMain() b) DllMain()
c) MainDll() d) DllEntry()

39. Which of the following is the correct prototype for DLL entry point function?
a) int WINAPI DllMain(HINSTANCE, DWORD, PVOID)
b) BOOL WINAPI DllMain(HINSTANCE, DWORD, PVOID)
c) int WINAPI DllMain(HINSTANCE, HINSTANCE, DWORD, PVOID)
d) int WINAPI DllMain(HINSTANCE, DWORD)

Page 8 of 8
ACTS National Resource Center, Pune
Question Bank –Win32 SDK (Solved)

40. Which function is used to create a child control?


a) CreateDialog() b) CreateChildWindow()
c) CreateWindow() d) AddControl()

41. Which function is used to add a string in a list box?


a) SendMessage() b) SendString()
c) AddToList() d) AddMessagel()

42. Which message is used to remove all items from a list box?
a) LB_CLEAR b) LB_RESETALL
c) LB_CLEARCONTENT d) LB_RESETCONTENT

43. Which message is used to retrieve the number of items in a list box?
a) LB_COUNT b) LB_COUNTALL
c) LB_GETCONTENT d) LB_GETCOUNT

44. Which function is used to get the text of the edit box?
a) GetWindowMessage() b) GetWindowText()
c) GetText() d) GetWindowContent()

45. Which function is used to change the text of a button?


a) SetWindowMessage() b) SetWindowText()
c) ChangeWindowText() d) SetWindowContent()

46. To hide a child control window, which function is used?


a) SendMessage() b) ShowWindow()
c) HideWindow() d) ShowChild()

47. Which function can be used to add a menu item to a menu at runtime?
a) AddMenu() b) InsertMenu()
c) InsertMenuItem() d) ModifyMenu()

48. Which function is used to get the system time?


a) GetLocalTime() b) GetTime()
c) GetSysTime() d) GetLocal()

49. Which function is used to determine the number of buttons on the installed mouse?
a) GetSystemMetrics() b) GetSystemMouse()
c) GetMouseButtons() d) GetMouseInfo()

50. Which one is not a mouse message?


a) WM_MBUTTONUP b) WM_MBUTTONDOWN
c) WM_MBUTTONCLK d) WM_MBUTTONDBLCLK

51. Which one is not a keyboard message?


a) WM_KEYUP b) WM_KEYDOWN
c) WM_SYSKEYUP d) WM_KEYPRESS

52. To get the handle of the system fonts, which function is used?
a) GetStockObject() b) GetFontHandle()
c) SelectObject() d) GetObjectHandle()
53. Which message should be processed by an application’s main window procedure?
a) WM_COMMAND b) WM_PAINT
c) WM_CREATE d) WM_DESTROY

Page 9 of 9
ACTS National Resource Center, Pune
Question Bank –Win32 SDK (Solved)

54. What message is generated by CreateWindowEx() function?


a) WM_COMMAND b) WM_COPY
c) WM_CREATE d) WM_NOTIFY

55. Which of the following message is not send to the window procedure?
a) WM_COMMAND b) WM_QUIT
c) WM_CLOSE d) WM_SETFOCUS

56. Which function returns an HDC that can be used to paint any where on the window?
a) BeginPaint() b) GetDC()
c) GetWindowDc() d) CreateIC()

57. Which functions should be called to get an HDC and free it while processing WM_PAINT message?
a) BeginPaint()......EndPaint() b) GetDC()..........ReleaseDc()
c) CreateDc().........DeleteDc() d) GetWindowDC()..........ReleaseDc()

58. Which function is used to change the current pen present in HDC?
a) SelectObject() b) CreatePen()
c) SelectPen() d) CreateObject()

59. Which function is used to create a brush from a bitmap?


a) CreateBrush() b) CreateSolidBrush()
b) CreatePatternBrush() d) CreateBitmap()

60. Which is the message for which TranslateMessage() function generate WM_DEADCHAR message.
a) WM_KEYUP b) WM_KEYDOWN
c) WM_COMMAND d) WM_CHAR

61. Which is the first message that is generated for any mouse event?
a) WM_KEYUP b) WM_NCHITTEST
c) WM_COMMAND d) WM_MOUSEMOVE

62. Which key generates system keyboard messages?


a) Shift key b) window key
c) Alt key d) Ctrl key

63. To stop timer messages, which function is used?


a) StopTimer() b) KillTimer()
c) FreeTimer() d) ReleaseTimer()

64. Which message is send from a child control to parent window containing notification code?
a) WM_CLICKED b) WM_CHILD
c) WM_COMMAND d) WM_CREATE

65. Which child control never sends WM_COMMAND to its parent window?
a) listbox b) edit
c) static d) scrollbar

66. Which child control does not send WM_COMMAND message to its parent window by default?
a) listbox b) edit
c) static d) scrollbar

Page 10 of 10
ACTS National Resource Center, Pune
Question Bank –Win32 SDK (Solved)

67. Which function is used to get the handle of an icon?


a) SetIcon() b) CreateIcon()
c) Icon() e) GetIcon()

68. Which function is used for checking the type of information available in clipboard?
a) GetClipboard() b) IsClipboardFormatAvailable
c) GetClipboardData() d) GetClipboardFormat()

69. The return type of the OpenClipboard() function is


a) BOOL b) LRESULT
c) Handle to clipboard d) void

70. Which identifier is used in the SetClipboardData(), to store metafile in the clipboard?
a) CF_TEXT b) CF_META
c) CF_METAFILE d) CF_METAFILEPIC

71. Which function is used to delete all the data stored in the clipboard?
a) CloseClipboard() b) EmptyClipboard()
c) DeleteClipboard() d) ClearClipboard()

72. Which function is used to determine all the formats stored in the clipboard?
a) SelectAllClipFormats() b) EnumClipboardFormats()
c) GetClipboardData() d) EnumClipFormats()

73. Which function is used to create circle region?


a) CreateRoundRectRgn() b) CreateEllipticRgn()
b) CreatePolygonRgn d) CreateRgn()

74. Which function is used to combine two regions?


a) CombineRgn() b) AddRgn
c) AddRegions() d) CombineRegions()

75. Which is the default GDI mapping mode in windows?


a) MM_TEXT b) MM_TWIPS
c) MM_HIMETRIC d) MM_LOMETRIC

76. Which one is not a GDI mapping mode in windows?


a) MM_MIMETRIC b) MM_TWIPS
c) MM_HIMETRIC d) MM_LOMETRIC

77. Which one is not a constant for the fourth argument of the MessageBox() function?
a) MB_YES b) MB_OK
c) MB_YESNO d) MB_OKCANCEL

78. The WM_NCHITTEST message is generated, when


a) mouse is clicked b) a key is hit
c) a window is created d) a timer event is occurred

Page 11 of 11
ACTS National Resource Center, Pune
Question Bank –Win32 SDK (Solved)

Answers the followings in brief:

1. What is MSG structure?


2. What function does the API DispatchMessage() perform ?
3. Explain all four parameters to a WndProc() function.
4. Write the three most important members of the structure WNDCLASSEX.
5. How is ShowWindow()different from CreateWindow() ?
6. What is a CALLBACK function? Give an example.
7. How do you establish a message loop in a Windows program?
8. Name any 5 mouse messages.
9. Name any 5 keyboard messages.
10. What are virtual key codes? How they are different from Scan codes? How they are different from ASCII
codes?
11. What arrangements have to be made with the WNDCLASSEX structure of a Window class to start getting
WM_DBLCLKS messages for double clicks of mouse?
12. What are the contents of wParam and lParam for a mouse message?
13. Which APIs are used to set and destroy Timers?
14. What are the contents of wParam and lParam for the WM_COMMAND message related with a menu?
15. Write the steps involved in creating a menu through a resource editor.
16. What are the contents of LOWORD(wParam), HIWORD(wParam) and lParam for messages related with
child window control?
17. A check box is created from a CheckBox class. (T/F)
18. Explain the purpose of the API GetDlgItem()
19. Write a code snippet to demonstrate the use of SendMessage() in context of child window controls.
20. Name any four system control classes.
21. What are common dialogs? Name three common dialogs.
22. What are windows resources?
23. Name any 5 resources.
24. What is the difference between a modal and a modeless dialog box?
25. Name any 5 GDI objects.
26. What are stock GDI objects?
27. What is a clipboard? What are different clipboard formats?
28. How many bytes are there in a UNICODE character?
29. A dynamic link library gives us better speed performance than a static link library. (T/F)
30. What is a Resource Only Library?
31. Show the hierarchical relationship among a Frame window, Client window and Child window in a MDI
application.
32. “While programming for Windows in C using SDK, we simulate Object Oriented Programming”. Justify
this statement
33. In a typical Windows program we have one WinMain() function and one WndProc() function. 34. How is
WndProc() called automatically when there is no explicit call to it in the WinMain() ?
35. When do you get the message WM_PAINT? Why do you trap the WM_PAINT message and not the
WM_CREATE message to write TextOut() in a typical “HelloWorld” program?
36. What is GDI? Why it is advised to use BeginPaint() and EndPaint() in pairs?
37. What happens when you register a window? How is RegisterClassEx()different from CreateWindow()?
38. Is it always necessary to call DefWindowProc() at the end of your WndProc()? If not what extra piece of
code will have to be written by the programmer?
39. What is the difference between the members hIcon and hIconSm of the WNDCLASSEX structure ?
40. How does Windows achieve device independence by the use of GDI?
41. What type of translation is carried out in the API TranslateMessage() ?

Page 12 of 12
ACTS National Resource Center, Pune
Question Bank –Win32 SDK (Solved)

42. Is it possible to have more WM_KEYDOWN messages than WM_KEYUP messages? When does such
situation occur?
43. Write an appropriate code snippet to demonstrate the use of InvalidateRect() in response to a
WM_CHAR message?
44. How do you get the status of SHIFT keys while processing a mouse message?
45. Name any 5 menu related messages.
46. What is subclassing? Write the steps and necessary APIs to subclass an edit class.
47. Write a code snippet that is required to bring a Color Dialog Box on screen.
48. In a small piece of code show the use of the API SetCursor().
49. Write the message loop for a program which uses a modeless dialog box.
50. Explain the use of the following APIs:
GetDlgItemText() GetDlgItemInt()
51. Explain the meaning of the following style flags related with a Window Class. CS_CLASSDC,
CS_PARENTDC, CS_OWNDC.
52. Explain with example the use of BitBlit() API.
53. How a logical font is created? Explain with appropriate APIs and Structures.
54. What are Meta files ?
55. Write a small piece of code to demonstrate the creation of a meta file.
56. Explain the following APIs.:
OpenClipboard() IsClipboardFormatAvailable()
57. Explain the following APIs.:
EmptyClipboard(), SetClipboardData(), SetClipboardViewer()
58. How these messages are used.
WM_COPY WM_PASTE
WM_PAINTCLIPBOARD WM_CHANGECBCHAIN
59. How UNICODE can be useful in bringing all the languages on computers?
60. A dynamic link library gives us better speed performance than a static link library. (T/F)Justify your
answer.

Answer the following in details:

1. Write the steps involved in creating a DLL and then using it in a program. Put two functions
AddTwoNums() and MultiplyTwoNums() inside the DLL. Write the code snippets to create the DLL.
2. What do you understand by Entry/Exit function in a DLL? How they are used?
3. Explain with example code snippets, the use of following structures.
MDICREATESTRUCT CLIENTCREATESTRUCT
4. Write the messages generated in proper order when a key is pressed which indicates:
• System keystroke message
• Non-system keystroke message
5. What is meant by a CALLBACK function. Which functions should be declared as CALLBACK?
6. What is window subclassing ? Write the skeleton of the steps required in subclassing a window.
7. What is the significance of the value returned by the Window Procedure while handling WM_CREATE
message?
8. What are the values send in WPARAM and LPARAM with the following messages?
• WM_PAINT
• WM_CREATE
• WM_COMMAND
• WM_MOUSEMOVE

Page 13 of 13
ACTS National Resource Center, Pune
Question Bank –Win32 SDK (Solved)

9. Write Win32 statements for the following


a. Copy the selected text in a text box to clipboard.
b. Change the state of a radio button.
10. Write Win32 statements for the following
a) Count the number of items in a list box.
b) Change the title of any window.
11. Describe the use of the following APIs/C Library Functions by writing your own sample code:
a) _beginthread()
b) StretchBlt()
c) StretchDIBits()
d) SetViewportExtEx()
e) SetScrollInfo()
f) CreateCompatibleDC()
12. What will be the result of following lines of code?
Case WM_LBUTTONDOWN:
HBITMAP hBitmap;
HMENU hMenu;

hBitmap = LoadBitMap(hInstance, MAKEINTRESOURCE(IDB_BMP));


hMenu = GetSystemMenu(hwnd, FALSE);

AppendMenu(hMenu, MF_SEPARATOR, 0, NULL);


AppendMenu(hMenu, MF_BITMAP, IDM_BITMAP, hBitmap);
Return 0;

13. Write the pseudo code for your own function MyTranslateMessage() that replaces system’s API
TranslateMessage().
14. A DllMain() function has this declaration :-
int CALLBACK DllMain(HINSTANCE hInstance, DWORD dwReason, PVOID pReserved)
What is contained in dwReason and how it can be used?
15. CenterHorz() is a user defined function to center a given string in a given row on the client area of a given
window. Its declaration is as follows -
void CenterHorz(HWND, int, char *);
Implement it.
16. Write the steps required to use accelerators in your application.
17. How can you utilise the idle time of your application? Which portion of your code will you alter to achieve
this? Write the portion of the code, which will undergo change. 18. Write in brief the steps required to
create a DLL.
19. Explain the purpose and use of the API CreateThread().
20. Explain with example the purpose and use of the following APIs/structures/messages:
a. SetDIBitsToDevice()
b. EnterCriticalSection()
c. WaitForMultipleObjects()
d. NMHDR
e. WM_RENDERFORMAT

Page 14 of 14

You might also like