Answered step by step
Verified Expert Solution
Link Copied!

Question

1 Approved Answer

The Windows Operating System and applications are event-driven. Describe how a Windows application is decoding event messages in its main message procedure WndProc. How

   

The Windows Operating System and applications are event-driven. Describe how a Windows application is decoding event messages in its main message procedure WndProc. How does the application decode a WM_COMMAND message to call the DialogBox? Refer to the source code example below. Discuss how such an approach is beneficial for interactive applications. LRESULT CALLBACK WndProc (HWND hWnd, UINT message, WPARAM wParam, LPARAM 1Param) { int wmId, wmEvent; PAINTSTRUCT ps; HDC hdc; switch (message) { case WM_COMMAND: wm Id = LOWORD (wParam); wmEvent = HIWORD (wParam); // Parse the menu selections: switch (wmId) } { case IDM_ABOUT: break; case IDM_EXIT: DialogBox (hInst, MAKEINTRESOURCE (IDD_ABOUTBOX), hwnd, About); DestroyWindow(hWnd); default: break; return DefWindowProc(hWnd, message, wParam, 1Param); } break; case WM_PAINT: hdc = BeginPaint (hWnd, &ps); // TODO: Add any drawing code here... EndPaint (hWnd, &ps); break; case WM_DESTROY: default: } return 0; PostQuitMessage(0); break; return DefWindowProc(hWnd, message, wParam, 1Param);

Step by Step Solution

3.45 Rating (161 Votes )

There are 3 Steps involved in it

Step: 1

In the provided source code example the WndProc function serves as the main message handler for a Wi... blur-text-image

Get Instant Access to Expert-Tailored Solutions

See step-by-step solutions with expert insights and AI powered tools for academic success

Step: 2

blur-text-image

Step: 3

blur-text-image

Ace Your Homework with AI

Get the answers you need in no time with our AI-driven, step-by-step assistance

Get Started

Recommended Textbook for

Accounting Information Systems

Authors: Marshall B. Romney, Paul J. Steinbart

13th edition

133428532, 978-0133428537

More Books

Students also viewed these Programming questions