Page 78 - DCAP408_WEB_PROGRAMMING
P. 78

Windows Programming




                    Notes                      PostQuitMessage(WM_QUIT);
                                               break;
                                           default:
                                               // Process the left-over messages
                                               return DefWindowProc(hWnd, Msg, wParam, lParam);
                                           }
                                           // If something was not done, let it go
                                           return 0;
                                       }
                                   2.  Test the application


                                   4.8.3 Control-based Scroll Bars

                                   Microsoft Windows offers another type of scroll bar. Treated as its own control, a scroll bar is
                                   created like any other window and can be positioned anywhere on its host.
                                   To create a scroll bar as a Windows control, call the CreateWindow() or the CreateWindowEx()
                                   functions and specify the class name as SCROLLBAR.

                                   Using Scroll Bar Controls

                                   1.  Begin a new GUI Application and name it CtrlScrollBars
                                   2.  Create its accompanying file as Exercise.cpp
                                   3.  To create a resource header file, on the main menu, click File -> New File...

                                   4.  In the Create New File dialog box, in the Name, type resource
                                   5.  In the Type combo box, select h



















                                   6.  Click OK
                                   7.  In the file, type:
                                   8.  #define IDD_CONTROLS_DLG  101
                                       #define IDC_CLOSE_BTN     1000
                                   9.  To create a resource script, on the main menu, click File -> New File...






          72                                LOVELY PROFESSIONAL UNIVERSITY
   73   74   75   76   77   78   79   80   81   82   83