throbber
II Wndews CE Bascs
`
`Part
`
`to specify which bands wont be displayed when the com
`allows the programmer
`vertical orientation Bands containing menus or wide controls are
`mand band is in
`for this flag because they wont be displayed correctly on vertical bands
`candidates
`color that the command band
`You can fill
`the cirFore and cirBack fields with
`will use for the foreground and background color when your application draws the
`flag is set in the mask field
`the RBBIM_COLORS
`band These fields are used only if
`These fields along with the hbmBack field which specifies
`background bitmap for
`transparent command bar Otherwise
`the band contains
`the band are useful only if
`the command bar covers most of the area of the band obscuring any background
`bitmap or special colors Ill explain how to make
`command bar transparent
`in the
`section Configuring individual bands
`text that labels the individual band This
`The lpText field specifies the optional
`text is displayed at the left end of the bar immediately right of the gripper The ilmage
`bitmap that will also be displayed on the left end of the bar
`field is used to specify
`The ilmage field is filled with an index to the list of images contained in the image
`list control The text and bitmap fields take added significance when paired with the
`RBS_SMARTLABELS style of the command band control When that style is specified
`is displayed when the band is restored or maximized and the bitmap is dis
`the text
`played when the band is minimized This technique is used by the H/PC Explorer on
`its command band control
`The wID field should be set to an ID value that you use to identify the band
`if you plan on configuring the bands after they have been
`The band ID is important
`created or if you think youll be querying their state Even if you dont plan to use
`that each band ID be unique because the
`band IDs in your program its important
`itself uses the IDs to manage the bands This field is checked only if
`the
`control
`RBBIM_ID flag is set in the fMask field
`the default command bar control
`The hwndChild field is used if
`replaced by another control To replace the command bar control
`the new control
`first be created and the window handle of the control
`then placed in the
`must
`the RBBIM_CHILD flag is set
`hwndChild field The hwndChild field is checked only if
`
`band is
`
`in
`
`in the jMask field
`The cxMinGhild and cyMinChild fields define the minimum dimensions to which
`band can shrink When youre using control other than the default command bar these
`fields are useful for defining the height and minimumwidth the width when minimized
`the RBBIM_CHILDSIZE
`of the band These two fields are checked only if
`flag is set
`field is used when
`band is maximized by the user
`The cxldeal
`isnt initialized maximized command band stretches across the entire width of the
`band
`the maximized width of
`the application can limit
`control By setting cxldeal
`the controls on the band take up only part of the total width of the
`which is handy if
`control This field is checked only if
`the EBBIM_IDEALSIZE
`flag is set in the JMask field
`value with
`The iParam field gives you
`space to store an application-defined
`the RBBIM_LPARAM flag is set in
`the band information This field is checked only if
`
`this field
`
`If
`
`298
`
`Page 00321
`
`

`
`Chapter
`
`Common Controls and Windows CE
`
`the fMask field The other fields in the REBARBANDINFO apply to the more flexible
`the command band control The code below creates
`rebar control not
`command
`initializes an array of three REBARBANDINFO
`bands control
`stmctures and adds the
`bands to the control
`
`II Create
`
`hwndCB
`
`bands ctl
`command
`CommandBands_Create hlnst
`IDC_CMDBAND RBS_SMARTLABELS
`hWnd
`RBS_VARHEIGHT himi
`
`II mit common REBARBANDINFO
`dimrbi
`for
`
`structure fields
`
`RBBIM_IMAGE
`
`RBBIM_SIZE
`
`RBBIM_STYLE
`
`IDB_CMDBANDi
`
`rbi sizeof REBARBANDINFO
`rbi RBBIMID
`rbi RBBS_FIXEDBMP
`rbi
`rbi
`rbi
`rbi
`rbi
`rbi
`rbirbi TEXT Std Btns
`
`II mit REBARBANDINFO
`Menu band
`II
`
`structure for each band
`
`RBBS_NOGRIPPER
`
`130
`
`II
`
`Standard
`
`button band
`
`RBBIM_TEXT
`
`200
`
`II
`
`Edit control
`
`band
`
`hwndChild
`
`CreateWindow TEXT edit TEXT edit ctl
`
`WSVISIBLE
`10
`hlnst NULL
`
`WS_BORDER
`WS_CHILD
`hWnd HMENUIDC_EDITCTL
`
`RBBIM_CHILDSIZE
`
`RBBIM_CI-IILD
`
`rbi2.fMask
`
`RBBIM_STYLE
`RBBIM_TEXT
`RBBS_CHILDEDGE
`
`rbi
`rbi hwndChild
`rbirbi 25
`rbi 55
`rbi
`rbirbi TEXT Edit field
`
`130
`
`II Add bands
`
`CommandBarids_AddBands
`
`hwndCB hlnst
`
`rbi
`
`299
`
`Page 00322
`
`

`
`II Windows CE Easics
`
`Part
`
`style
`
`The command bands control created above has three bands one contain
`set of buttons and one containing an edit control
`ing menu one containing
`is created with the RBS_SMARTLABELS
`command bar The control
`instead of
`styles The smart labels display an icon when the bar is mini
`and RBS_VARHEIGHT
`text label when the band isnt minimized The RBS_VARHEIGHT
`mized and
`to have
`different height
`allows each line on the control
`structures are then initialized in
`The common fields of the REBARBANDINFO
`loop Then the remaining fields of the structures are customized for each band on
`is the most complex to ini
`the control The third band containing the edit control
`tialize This band needs more initialization since the edit control needs to be prop
`erly sized to match the standard height of the command bar controls in the other bands
`The ilmage field for each band is initialized using an index into an image list
`was created and passed to the CommandBands_Create function The text fields for
`the second and third bands are filled with labels for those bands The first band which
`text label because theres no need to label the menu
`contains menu doesnt contain
`You also use the RBBSNOGfflPPER style for the first band so that it cant be moved
`around the control This fixes the menu band at its proper place in the control
`Now that weve created the bands its time to see how to initialize them
`
`that
`
`Configuring individual bands
`in the process the command bands control has been created and the
`At this point
`individual bands have been added to the control We have one more task which is
`to configure the individual command bar controls in each band Actually theres little
`more to configuring the command bar controls than what Ive already described for
`command bars
`
`The handle to
`
`command bar contained in
`
`band is retrieved using
`
`HWND CommandBands_GetCommafldBar
`
`hwndCnidBands UINT uBand
`HWND
`The uBand parameter is the zero-based band index for the band containing the com
`this function when the command bands control
`is being initial
`mand bar If you call
`ized the index value correlates directly with the order in which the bands were added
`new
`chance to drag the bands into
`to the control However once the user has
`order your application must obtain this index indirectly by sending RB_IDTOINDEX
`message to the command bands control as in
`RB_IDTOINDEX
`
`nlndex
`
`SendMessage
`
`hwndCmdBands
`
`ID_BAND
`
`for managing the bands because many of the functions and
`This message is critical
`require the band index as the method to identify the band
`messages for the control
`the index values are fluid As the user moves the bands around
`The problem is that
`these index values change You cant even count on the index values being consecu
`rule never blindly use the index value without
`first querying the proper
`tive So as
`value by translating an ID value to an index value with RB_IDTOINDEX
`
`300
`
`Page 00323
`
`

`
`Chapters Common Controls and Windows CE
`
`Once you have the window handle to the command bar simply add the menu
`or buttons to the bar using the standard command bar control
`functions and mes
`sages Most of the time youll specify only menu in the first bar only buttons in the
`second bar and other controls in the third and subsequent bars
`The following code completes the creation process shown in the earlier code
`fragments This code initializes the command bar controls in the first
`two bands Since
`the third band has an edit control you dont need to initialize that band The final act
`to complete the command band control
`initialization is to add the close
`necessary
`box to the control using
`to CommandBands_AddAdornments
`
`call
`
`II Add menu to first
`hwndCB
`CommandBands_GetCommandBar
`hwndBand
`hwndBand hlnst
`CommandBar_InsertMenubar
`ID_MENU
`
`band
`
`II Add std buttons to second band
`hwndCB
`CommandBands_GetCommandBar
`hwndBand
`ComniandBar_AddBitmap hwndBand HINST_COMMCTRL
`15
`hwndBand dimtbCBStdBtns
`
`CommandBar_AddButtons
`
`IDB_STD_SMALL_COLOR
`
`tbCBStdBtns
`
`II Add exit button to command band
`CommandBands_AddAdornments hwndCB hlnst
`
`NULL
`
`Saving the band layout
`The configurability of the command bands control presents
`problem to the pro
`grammer Users who rearrange the bands expect
`to be re
`their customized layout
`stored the next time the application is started This task is supposed to be made easy
`using the following function
`
`HWND
`800L CommandBands_GetRestorelnformation
`hwndCmdBands
`LPCOMMANDBANDSRESTOREINFO
`
`UINT uBand
`
`pcbr
`
`This function saves the positioning information from an individual band into
`COMMANDBANDSRFSTOREINFO structure The function takes the handle of the
`command bands control and an index value for the band to be queried The follow
`ing code fragment shows how to query the information from each of the bands in
`command band control
`
`II Get
`
`hwndCB
`
`bands control
`the handle of
`the command
`GetDlgltem hWnd IDC_CMDBAND
`
`II Get
`
`for
`
`information for each band
`NUMBANDS
`
`continued
`
`301
`
`Page 00324
`
`

`
`II Whidows CE asics
`
`Part
`
`II Get band
`
`nBand
`
`index from ID value
`hwndCB RB_.IDTOINDEX
`
`SendMessage
`
`IDB_CMDBANDi
`
`II
`
`Initialize the size field and get
`
`the restore information
`
`cbr sizeof COMMANDBANDSRESTOREINFO
`hwndCB nBand cbr
`
`CommandBands_GetRestorelnformation
`
`The code above uses the RB_IDTOINDEX message to convert known band IDs
`into the unknown band indexes required by CommandBands_GetRestorelnformation
`The data from the structure would normally be stored in the system registry Ill
`talk
`about how to read and write registry data in Chapter
`Files Databases and the
`Registry
`The restore information should be read from the registry when the application
`is restarted and used when creating the command bands control
`
`II Restore
`
`configuration to
`
`command band
`
`COMMANDBANDSRESTOREINFO cbr
`
`REBARBANDINFO
`
`rbi
`
`II
`
`Initialize
`
`rbi.cbSize
`
`size field
`sizeof REBARBANDINFO
`
`II Set only style and size fields
`RBBIM_SIZE
`rbi.fMask
`RBBIM_STYLE
`
`II Set
`
`for
`
`the size and style for all
`NUMBANDS
`
`bands
`
`rbi.cx cbr
`rbi.fStyle cbr
`hwndCB RB_IDTOINDEX cbr
`
`nBand
`
`SendMessage
`hwndCB RB_SETBANDINFO
`SendMessage
`
`nBand LPARAMrbi
`
`for all
`II Only after the size is set
`needing maximizing be maximized
`NUMBANDS
`
`II
`
`for
`
`if cbr
`
`nBand
`
`SendMessage
`
`bands can the bands
`
`hwndCB RB_IDTOINDEX cbr
`
`nBand TRUE
`
`SendMessage
`hwndCB RB_MAXIMIZEBAND
`
`This code assumes that the command bands control has already been created
`In
`in its default configuration
`real-world application the restore information for
`the size and style could be used when first creating the control
`In that case all that
`would remain would be to maximize the bands depending on the state of the
`
`302
`
`Page 00325
`
`

`
`Chapter
`
`Common Controls and Windows CE
`
`jMaximized field in the COMMANDBANDSRESTOREINFO
`structure This last step must
`take place only after all bands have been created and properly resized
`One limitation of this system of saving and restoring the band layout is that you
`have no method for determining the order of the bands in the control The band in
`dex isnt likely to provide reliable clues because after the user has rearranged the bands
`few times the indexes are neither consecutive
`nor in any defined order The only
`way around this problem is to constrain the arrangement of the bands so that the user
`cant reorder the bands You do this by setting the RBS_F1XEDORDER style This solves
`your problem but doesnt help users if
`they want
`different order In the example
`program at the end of this section
`use the band index value to guess at the order
`But this method isnt guaranteed to work
`Handling command band messages
`The command bands control needs
`command bar
`bit more maintenance than
`The difference is that the control can change height and thus the window contain
`ing the command bands control must monitor the control and redraw and perhaps
`its client area when the control
`reformat
`is resized
`The command bands control sends
`number of different WM_NOTIFY
`messages when the user rearranges the control To monitor the height of the
`control your application needs to check for RBN_HEIGHTCHANGE notifica
`tion and to react accordingly The code below does just this
`
`II This
`
`code
`
`is inside
`
`WM_NOTIFY message handler
`
`LPNMHDR
`
`pnmh
`
`LPNMHDRlParam
`pnmh
`if pnmh-code
`RBN_HEIGHTCHANGE
`hWnd NULL
`TRUE
`InvalidateRect
`
`If
`
`RBN_HEIGHTCHANGE notification is detected the routine simply invali
`dates the client area of the window forcing WM_PAINT message The code in the
`paint message then calls
`
`UINT CommandBands_Height
`
`HWND
`
`hwndCmdBands
`
`to query the height of the command bands control and subtracts this height from the
`client area rectangle
`As with the command bar the command bands control can be hidden and shown
`function
`
`with
`
`helper
`
`BOOL CommandBands_Show
`
`HWND
`
`hwndCmdBands
`
`BOOL
`
`fShow
`
`The visibility state of the control can be queried using
`
`BOOL CommandBands_Isvisjbje HWND
`
`hwndCmdBands
`
`303
`
`Page 00326
`
`

`
`Part
`
`II
`
`The CmdBand Example Program
`fairly complete command bands control The
`fhe CmdBand prograin demonstrates
`fixed menu band
`example creates three bands
`number
`band containing
`hand containing an edit control Transparent command bars and
`buttons and
`command bands control with
`background bitmap in each band are used to create
`
`background image
`You can use the View menu to replace the command bands control with
`simple
`command bar by choosing Command Bar from the View menu You can then recre
`ate and restore the command bands control
`by choosing
`to its last configuration
`Command Bands from the View menLi The code for the Cmd Rand program is shown
`in Figure S-5
`
`CmdBand.rc
`
`II Resource file
`
`II Written
`
`II Copyright
`
`for the book Programming Windows
`1998 Douglas Boling
`
`CE
`
`II
`
`II Program-specific stuff
`
`include windows.h
`include CmdBand.h
`
`ii
`
`II
`
`/1
`
`Icons
`
`and bitmaps
`
`ID.ICON
`
`CmdBarBnips
`CmdBarEditBmp
`CmndBarBack
`
`ICON
`
`BITMAP
`
`BITMAP
`
`BITMAP
`
`cmdbandico
`cbarbmps.bmp
`cbarbmp2.bmp
`backg2.bmp
`
`1/
`
`II Menu
`
`II
`
`ID...MENU
`
`MENU DISCARDABLE
`
`BEGIN
`POPUP File
`BEGIN
`MENUITEM Exit
`
`END
`POPUP View
`
`Figure 55 The Gmdflaud program
`
`304
`
`II Program icon
`1/
`in cmdband
`Bmp used
`Bmp used
`Bmp used
`
`in cmdband
`
`for cmdband
`
`1/
`
`II
`
`image list
`image list
`background
`
`1DM_EXIT
`
`Page 00327
`
`

`
`Chapier
`
`Common Controls and Windows CE
`
`BEGIN
`MENUITEM Command Bar
`MENUITEM Command Band
`
`END
`POPUP Hel
`
`BEGIN
`MENUITEM About
`
`END
`
`END
`
`II
`
`II About box dialog template
`
`IDM_VIEWCMDBAR
`IDM_VIEWCMDBAND
`
`1DM_ABOUT
`
`/1
`aboutbox DIALOG discardable
`WS_POPUP
`
`STYLE
`
`WS_VISIBLE
`RAM
`
`S_MO DA
`CAPTION About
`BEGIN
`
`10 10 160 40
`WS_CAPTION
`
`WS_SYSMENIJ
`
`DS_CENTER
`
`ID_ICON
`ICON
`LTEXT CmdBand Written
`
`CE Copyright
`
`10
`-1
`10
`for the book Programming Windows
`1998 Douglas Baling
`-1 40
`
`CmdBand.h/r_II Header
`
`END
`
`file
`
`110
`
`30
`
`1/
`II Written
`
`1/ Copyright
`
`for the book Programming Windows
`1998 Douglas Baling
`
`CE
`
`II Returns
`
`number of elements
`
`define dimx sizeofx sizeofx
`
`II
`
`1/ Generic defines
`
`and data types
`
`II
`
`decodeUlNT
`struct
`UINT Code
`
`II Structure associates
`
`ii messages
`function
`II with
`
`continued
`
`305
`
`Page 00328
`
`

`
`II Whidows CE Bascs
`
`Part
`
`Figure 5-5 continued
`gc
`
`41N R1 wAL IM
`
`rm
`1_
`
`t1L4
`
`dR$
`
`jrc WQ
`wh
`fvp
`
`..
`
`tmi
`fflTn
`
`Ip
`
`IIFF1
`
`.c
`
`etji rn bd
`4L
`-fr 2L
`
`\f
`
`i1
`
`I\
`
`I4MN
`
`14
`
`v/
`
`..
`
`.k
`
`df4
`fr
`IM4ii D.FIl
`dt1
`i_t 1ppJr
`4bn AUV
`5k
`
`lf iFiLI
`j4
`1di
`
`IkPiUbd
`1j1tp TM tNsY
`H11
`L1
`
`1tt
`
`hfld
`
`11
`
`çjjiPrq
`
`41 /dW4 Lk1h
`
`.i
`
`NT
`
`306
`
`Page 00329
`
`

`
`Chapter
`
`Common Controls and Windows CE
`
`LRESULT
`
`DoCojninandMain
`
`LRESULT Dol3estroyMain
`
`HWND UINT WPARAM
`HWNO UINI WPARAM
`
`LPARAM
`LPARAM
`
`II Command functions
`LPARAM DoMainCommandViewCmdBar
`
`HWND WORD
`HWND WORD
`HWND WORD
`HWND WORD
`LPARAM floMainCornrnandVcmdBand
`LPARAM DoMainCommandExit HWND WORD
`FIWNO WORD
`HWND WORD
`I-1WND WORD
`LPARAM DoMainCommandAbout
`
`/1 DIalog procedures
`BOOL CALLBACK AboutDlgProc
`
`HWND UINT WPARAM
`
`LPARAM
`
`CmdBand..c
`
`_________
`
`/1 CmdBand
`
`Dialog box demonstration
`
`1/
`/1 Written
`
`for the book Programming Windows
`1/ Copyright
`1998 Douglas Boling
`
`CE
`
`include wtndows.h
`include commctrlh
`
`include CmdBand.h
`
`/1 --------
`II Global data
`
`II
`
`conat
`
`TCHAR szAppNameU
`FIINSTANCE hlnst
`
`/1 For all
`
`that Windows stuff
`includes
`1/ Command bar
`
`II Program specific stuff
`
`TEXT CmdBand
`1/ Program instance handle
`
`dispatch table for MainWindowProc
`/1 Message
`decodeUlNT MainMessages
`const struct
`WMCREATE
`DoCreatel4a in
`WM_PAINT
`floPaintHain
`WM NOTIFY floNotifyMain
`MM COMMAND
`DoCommandMain
`DoDostroyMa in
`MM_DESTROY
`
`II Command message dispatch for MainWindowProc
`decodetMO MalnCommandltenisf
`const struct
`ION VIEWCMDBAR DoNalnComniandVj
`ewCmdBar
`IDM_VIEWCMDRAND
`DoMai nCommandvCmdBand
`1DM EXIT LloMainCommandExit
`1DM_ABOUT DoMainCommandAbout
`
`continued
`
`307
`
`Page 00330
`
`

`
`II Wndows CE Basics
`
`Part
`
`Figure 5-5 continued
`
`WijPs1E
`
`rwI4M 1J_L$q$
`iadi
`tjIz$ii
`44P if
`Uv
`qf
`iFMi1L
`
`1i
`
`Vi P%
`
`51
`
`jIc
`
`iLit
`
`swig
`
`tL\jrALDrI
`
`tj
`
`tTENL1
`
`qi4
`
`1q
`
`308
`
`Page 00331
`
`

`
`chapter
`
`Common Controls and Windows CE
`
`HWND hwridMain
`MSG msg
`mt rc
`
`1/
`
`rc
`
`application
`Initialize
`InitApp hinstance
`if rc return rc
`
`this instance
`Initialize
`II
`Initlnstance hlnstance lpCmdLine nCrndShow
`hwndMain
`hwndMain
`return OxlO
`
`if
`
`II Application message
`while GetMessage msg NULL
`TranslateMessage msg
`DispatchMessage msg
`
`loop
`
`Instance cleanup
`II
`return Termlnstance hlnstance msg.wParam
`
`II
`
`II
`
`1/
`
`mt
`
`InitApp
`
`Application initialization
`
`HINSTANCE hlnstance
`InitApp
`WNDCLASS wc
`INITCOMMONCONTROLSEX
`
`cex
`
`II Register application main window class
`wc.style
`wc.lpfnWndproc
`wc.cbClsExtra
`wc.cbWndExtra
`wc.hlnstance
`wc.hlcon
`wc.hCursor
`
`MainWndProc
`
`hlnstance
`
`II Window style
`
`II Callback function
`
`II Extra class data
`II Extra window data
`
`II Owner handle
`
`NULL
`NULL
`
`wc.hbrBackground
`wc.lpszMenuName
`wc.lpszClassName
`
`II Application icon
`II Default
`cursor
`HBRUSH GetStockObject WHITE_BRUSH
`NULL
`1/ Menu
`name
`II Window class name
`szAppName
`
`if RegisterClass wc
`
`return
`
`Load the command bar common control class
`II
`icex.dwSize
`INITCOMMONCONTROLSEX
`sizeof
`ICC_COOL_CLASSES
`InitommoncontrolsEx icex
`
`icex.dwICC
`
`continued
`
`309
`
`Page 00332
`
`

`
`Partil
`
`Figure 55 coutiiwcl
`
`return
`
`II
`
`//
`
`II
`
`Initlnstance
`
`Instance initialization
`
`HWND
`
`Initlnstance
`hWnd
`
`HWND
`
`HINSTANCE
`
`hlnstance LPWSTR
`
`lpCmdLine mt nCmdShow
`
`II Save program instance
`hlnstance
`hlnst
`
`II Create main window
`
`handle
`
`in global variable
`
`hWnd
`
`CreateWindow szAppName
`II Window class
`TEXT CmdBand Demo II Window title
`II Style flags
`position
`position
`Initial width
`
`/1
`
`II
`
`II
`
`WS..VISIBLE
`
`CW..USEDEFAULT
`CW_USEDEFAULT
`CW_USEDEFAULT
`CW.USEDEFAULT
`NULL
`NULL
`hlnstance
`NULL
`
`height
`
`Initial
`II
`II Parent
`II Menu must be null
`II Application instance
`// Pointer to create
`
`II parameters
`
`if window not created
`1/ Return
`fail
`code
`llsWindow hWnd return
`
`if
`
`1/ Standard
`ShowWindow
`
`UpdateWindow
`return hWnd
`
`show and update calls
`hWnd nCmdShow
`hWnd
`
`II
`II Terminstance
`
`Program cleanup
`
`//
`mt Termlnstance HINSTANCE
`return nDefRC
`
`hlnstance mt nDefRC
`
`II Message
`
`handling procedures
`
`for MainWindow
`
`II
`II MainWndProc
`
`Callback function for application window
`
`310
`
`Page 00333
`
`

`
`Uapter
`
`Common Controls and Windows CE
`
`II
`
`LRESULT
`
`CALLBACK MainWndProc
`
`HWND
`hWnd UINI wMsg WPARAM wParam
`LPARAM iParam
`
`INT
`
`II Search message
`II message
`
`If
`
`/1
`
`list
`
`to see if
`
`we need
`
`to handle
`
`this
`
`in list
`
`call procedure
`
`for Ci
`
`dimMainMessages
`if wMsg MainMessages
`return frtainMessages wMsg wParam iParam
`
`return DefWindowProc
`
`hWnd wMsg wParam iParam
`
`II
`II DoCreateMain
`
`Process WM_CREATE message for window
`
`II
`LRESULT DoCreateMain
`
`UINT wMsg WPARAM wParam
`HWND hWnd
`LPARAM lParam
`
`CreateCommandBand hWnd TRUE
`return
`
`II
`
`II DoPaintMain
`
`Process WM_PAINT message for window
`
`II
`
`LRESULT DoPaintMain
`
`HWND
`UINT wMsg WPARAM wParani
`hWnd
`LPARAM lParam
`
`PAINISTRUCT ps
`HWND hwndCB
`RECT rect
`HOC hdc
`POINT ptArray
`
`the size of
`
`the client
`
`rect
`
`to take into account
`
`II Adjust
`the command bar or command bands height
`1/
`hWnd rect
`GetClientRect
`GetOlgitem hWnd
`IDC_CMDBAND
`CommandBands_Height hwndCB
`
`if
`
`hwndCB
`
`rect.top
`
`else
`
`hdc
`
`rect.top
`
`ConnnandBar_Height Getolgltem hWnd IDC_CMDBAR
`BeginPaint hWnd ps
`
`coniiiiiic1
`
`311
`
`Page 00334
`
`

`
`II Wndows CE Basics
`
`Part
`
`Figure 5-5 continued
`
`ii1krt1 ecp
`rI
`rja irk1Is
`
`ci
`
`Li4t
`
`JtP 1T fI Nan
`UM 1P4rt
`1t74
`
`OFEcm4h
`
`14pT
`
`lD
`
`MW
`
`41w
`
`d6g4t1 diq
`fnd rw
`nt1fe
`
`tA
`
`11
`
`cqm
`ur
`P4RN iirm
`
`k$
`
`ftdnwA
`
`4W
`
`AI
`
`tA
`
`1th
`
`312
`
`Page 00335
`
`

`
`Chapter
`
`Common Controls and Windows CE
`
`if pnmh-code
`InvalidateRect
`
`RBLHEIGHTCHANGE
`hWnd NULL TRUE
`
`return
`
`/1
`II DoDestroyMain
`
`Process WM_DESTROY message for window
`
`II
`LRESULT DoDestroyMain
`
`PostQuitMessage
`return
`
`UINT wMsg WPARAM wParam
`HWND
`hWnd
`LPARAM lParam
`
`II
`
`II Command handler
`
`routines
`
`II
`II DoMainCommandExit
`
`Process Program Exit command
`
`If
`LPARAM DoMainCommandExit HWND
`hWnd
`WORD
`WORD wNotifyCode
`
`idltem HWND hwndCtl
`
`SendMessage
`return
`
`hWnd WM_CLOSE
`
`II
`II DoMainCommandVCmdBarStd
`
`II
`LPARAM DoMainCommandViewCmdBar
`
`HWND hwndCB
`
`Process View
`
`Std Command bar command
`
`hWnd
`
`HWND
`WORD wNotifyCode
`
`WORD
`
`idltem HWND hwndCtl
`
`GetDlgltem hWnd
`hwndCB
`if hwndCB
`DestroyCommandBand hWnd
`
`IDC_CMDBAND
`
`else
`
`return
`
`minimal
`II Create
`an exit button
`ComniandBar_Create hlnst hWnd
`
`II
`
`hwndCB
`
`command bar
`
`that has only
`
`menu and
`
`IDC.CMDBAR
`
`II
`
`Insert
`
`the menu
`ComniandBar_InsertMenubar
`
`hwndCB hlnst
`
`ID_MENU
`
`continued
`
`313
`
`Page 00336
`
`

`
`II Wndows CE Eascs
`
`Part
`
`Figure 5-5 continued
`
`ffl
`
`zs
`
`1%O
`
`t1
`mii
`
`.rJ1P i.F
`
`rd
`
`fr$
`
`j4II it Gâi
`irp
`iN18
`
`ri
`
`$$
`
`ii iI
`
`iP
`
`4CMAk1
`
`41
`
`314
`
`VIiIi1 j4v
`
`Page 00337
`
`

`
`Chapter
`
`Common Controls and Windows CE
`
`return FALSE
`
`//
`II DestroyCommandBand
`Destroy command band control after saving
`the current configuration
`
`II
`
`1/
`mt DestroyCommandBand HWND
`NWND hwndCB
`nBand
`INT
`
`nMaxBand
`
`hWnd
`
`hwndCB
`
`for
`
`GetDlglteni hWnd
`NUMBANDS
`
`IDC_CMDBAND
`
`index from ID value
`II Get band
`hwndCB RB_IDTOINDEX
`SendMessage
`
`nBand
`
`IDBCMDBANDi
`
`the band number
`II Save
`nBandOrder
`
`nBand
`
`to save order of bands
`
`1/ Get
`
`the restore information
`
`cbr sizeof COMMANOBANOSRESTOREINFO
`
`CommandBandsGetRestorelnformation
`
`hwndCB nBand cbrLi
`
`DestroyWindow hwndCB
`return
`
`.1
`
`II
`
`1/ CreateComrnandBand
`
`Create
`
`formatted command band control
`
`int CreateCommandBand HWND
`hWnd
`hwndChild
`hwndCB
`hwndBand
`HWND
`nBand nBtnlndex nEditlndex
`lStyle
`
`tNT
`
`LONG
`
`BOOL
`
`fFirst
`
`hBmp
`HBITMAP
`HIMAGELIST himl
`REBARBANDINFO
`
`rbi
`
`/1 Create image list control
`
`himl
`
`/1
`
`Load
`
`II
`
`for bitmaps for minimized bands
`ImageList_Create 16 16 ILC_COLOR
`two images from one bitmap
`first
`LoadBitmap hlnst TEXT CmdBarBmps
`hBmp
`ImageList_Add himl hBmp NULL
`DeleteObject hBmp
`single bitmap
`third image as
`Load
`LoadBitmap hlnst TEXT CmdBarEditBmp5
`hBmp
`rmageList_Add himl hBmp NULL
`DeleteObject hBnip
`
`continued
`
`315
`
`Page 00338
`
`

`
`II Whidows CE Eascs
`
`Part
`
`Figure 5-5 continued
`
`tL
`
`34
`
`IIMPA IM
`
`cL4F
`Itr k.p1aMiqIPIP 2P9P
`
`I4
`
`1IL
`
`D4
`
`iI
`
`V1
`
`316
`
`td Q4
`
`fr
`riI
`
`I4
`
`Page 00339
`
`

`
`Chapter
`
`Common Controls and Windows CE
`
`II
`
`The next
`
`two parameters are initialized from saved data
`
`Edit control
`II
`hwndChild
`
`band
`
`rbi cbr
`rbi cbr
`rbi RBBIM_TEXT
`rbi hwndChild
`rbi
`rbi 55
`rbirbi TEXT Edit field
`rbi cbr
`
`CreateWindow TEXT edit TEXT edit ctl
`
`WS_VISIBLE
`10
`
`ES_MULTILINE
`WS_CHILD
`hWnd HMENUIDC_EDITCTL
`
`WS_BORDER
`hlnst NULL
`
`RBBIM_CHILDSIZE
`
`RBBIM_STYLE
`RBBIM_CHILD
`
`rblrnEditlndex.cyMinChild
`
`23
`
`1/ The next
`
`rbi
`
`two parameters are initialized from saved data
`.cx cbr .cxRestored
`
`II Add bands
`CommandBands_AddBands
`
`hwndCB hlnst
`
`rbi
`
`II Add menu to first
`hwndband
`
`band
`hwndCb
`CommandBands_GetCornmandBar
`hwndBand hlnst
`ID_MENU
`
`CommandBar_InsertMenubar
`
`II Add standard buttons to second band
`hwndCB n8tnlndex
`hwndBand
`CornmandBands_GetCommandBar
`
`Insert buttons
`II
`CommandBar_AddBitmap hwndBand HINST_COMMCIRL
`16
`hwndBand dimtbCBStdBtns
`
`CommandBar_AddButtons
`
`IDB_STD_SMALL_COLOR
`
`tbCBStdBtns
`
`II Modify the style flags of each
`for
`NLJMBANDS
`i-H-
`
`command bar
`
`to make transparent
`
`hwndBand
`
`iStyle
`
`iStyle
`SendMessage
`
`hwndCB
`Commandbands_GetCommandOar
`hwndBand TB_GETSTYLE
`SendMessage
`TBSTYLE_TRANSPARENT
`hwndBand TB_SETSTYLE
`
`iStyle
`
`II
`
`II
`
`time the command
`the first
`not
`If
`the users last configuration
`
`band
`
`has been created restore
`
`coiIiiiiwcl
`
`317
`
`Page 00340
`
`

`
`II Wndows
`
`Part
`
`Figure 55 cmitiniecl
`
`if fFirst
`for
`
`if cbr
`
`NUMBANDS
`
`nBand
`
`SendMessage
`
`hwndCB RB_IDTOINDEX
`
`cbr
`
`SendMessage
`
`hwndCB RB_MAXIMIZEBAND
`
`nBand TRUE
`
`II Add exit button to command band
`CommandBands_AddAdornments hwndCB hlnst
`return
`
`NULL
`
`Cmdlland creates the command band in the Greaie6ommaudBand routine
`called in OnCreateMain and later in the DoMainCommand
`This routine is initially
`VCmdBand menu handler The program creates the command bands control using
`the RBS_SMARTLABELS style along with an image list and text labels to identify each
`band when its minimized and when its restored or maximized An image list
`is cre
`ated and initialized with the bitmaps that are used when the bands are minimized
`The array of REBARBANDINFO structures is initialized to define each of
`the three bands If
`the control had previously been destroyed data from the
`COMMANDBANDSRESTOREINFO
`structure is used to initialize the style and cx fields
`routine also makes
`The CreateCommandBand
`the order of the button
`guess at
`and edit bands by looking at the band indexes saved when the control was last de
`stroyed While this method isnt completely reliable for determining the previous
`good estimate
`order of the bands it gives you
`When the command bands control
`is created the command bars in each band
`style This process along with
`are also modified to set the TBS_TRANSPARENT
`background bitmap defined for each band demonstrates how you can use
`back
`ground bitmap to make the command bands control have just
`look
`the right
`When CmdBand replaces the command bands control with
`command bar the
`function to save the current con
`application first calls the DestroyCommandBand
`figuration and then destroy the command bands control This function uses the
`to query the size and style of each of the
`CommandBands_GetRestorelnformation
`bands The function also saves the band index for each band to supply the data for
`the guess on the current order of the button and edit bands The first band the menu
`band is fixed with the RBBS_NOGRIPPER style so theres no issue as to its position
`This completes the discussion of the command bar and command bands con
`talk about these two controls at length because youll need one or the other
`trols
`for almost every Windows CE application
`
`318
`
`Page 00341
`
`

`
`Chapter
`
`Common Controls and Windows CE
`
`Ill
`
`Ill
`
`the highlights of some of the other
`For the remainder of the chapter
`cover
`controls These other controls arent very different
`from their counterparts under
`Windows 98 and Windows NT Ill spend more time on the controls
`think youll need
`start with the month calendar and the
`when writing Windows CE application
`time and date picker controls These controls are rather new to the common control
`set and have
`direct application to the PIM-like applications that are appropriate for
`many Windows CE systems Ill also spend some time covering the list view control
`concentrating on features of use to Windows CE developers
`The remainder of the
`common controls Ill
`cover
`
`just briefly
`
`The Month Calendar Control
`
`fit
`
`The month calendar control gives you
`that can be
`handy month-view calendar
`manipulated by users to look up any month week or day as far back as the adop
`tion of the Gregorian calendar in September 1752 The control can display as many
`into the size of the control The days of the month can be high
`months as will
`The weeks can indicate the current week into the
`lighted to indicate appointments
`year Users can spin through the months by tapping on the name of the month or
`change years by tapping on the year displayed
`Before using the month calendar control you must initialize the common con
`trol library either by calling InitCommonControls or by calling InitCommonControlsEx
`with the ICC_DATE_CLASSES flag You create the control by calling Create Window
`flag The style flags for the control are shown here
`with the MONTHCAL_CLASS
`
`MCS_MULTISELECT
`
`The control allows multiple selection of days
`
`MCS_NO TODAY The
`calendar
`
`control wont display todays date under
`
`the
`
`MCS_NOTODAYCIRCLE
`
`The control wont circle todays date
`
`The control displays the week number
`MCS_WEEKZ/UMBERS
`52 to the left of each week in the calendar
`
`through
`
`McS_DAYSTATE
`The control sends notification messages to the parent
`requesting the days of the month that should be displayed in bold You use
`this style to indicate which days have appointments or events scheduled
`
`Initializing the control
`number of messages or their
`In addition to the styles just described you can use
`corresponding wrapper macros to configure the month calendar control You can use
`an MCM_SETFIRSTDAYOFWEEK
`different starting day of the
`message to display
`week You can also use the MCM_SETRANGE message to display dates within
`given
`range in the control You can configure date selection to allow the user to choose only
`
`319
`
`Page 00342
`
`

`
`II Windows CE Basics
`
`Part
`
`limit
`
`to set
`
`user can select at any one
`to the range of dates that
`single dates or to set
`time The single/multiple date selection ability is defined by the MCS_MULTTSELECT
`style If you set this style you use the MCMSETMAXSELCOUNT message to set the
`maximum number of days that can be selected at any one time
`You can set the background and text colors of the control by using the MCM_
`SETCOLOR message This message can individually set colors for the differeiit
`regions
`within the controls including the calendar text and background the header text and
`background and the color of the days that precede and follow the days of the month
`flag indicating what part of the control
`being displayed This message takes
`COLORREF value to specify the color
`and
`The month calendar control
`is designed to display months on an integral basis
`That
`half months it displays only one
`is big enough for one and
`the control
`is if
`month centered in the control You can use the MCM_GETMINREQRECT
`message
`to compute the minimum size necessary to display one month Because the control
`must first be created before the MCM_GETMINREQRECT
`can be sent properly siz
`process You must create the control send the
`round-about
`ing the control
`MCM_GETMINREQRECT message and then resize the control using the data returned
`from the message
`
`is
`
`Month calendar notifications
`The month calendar control has only three notification messages to send to its par
`ent Of these the MCN_GETDAYSTATE
`notification is the most important This noti
`fication is sent when the control needs to know what days of month to display in
`bold This is done by querying the parent for
`series of bit field values encoded in
`MONTHDAYSTATE
`variable This value is nothing more than
`through 31 of the month
`through 31 representing the days
`When the control needs to display month it sends
`MCN_GETDAYSTATE
`to an NMDAYSTATE structure defined as the following
`notification with
`pointer
`
`32-bit value with bits
`
`typedef struct
`NMHDR
`nrnhdr
`SYSTEMTIME
`stStart
`mt cDayState
`LPMONTHDAYSTATE
`NMDAYSTATE
`
`prgDayState
`
`The nmbhdr field is simply the NMHDR structure thats passed with every WM_NOTIFY
`the starting date for which the control
`message The stStart field contains
`is request
`standard SYSTEMTIME structure used by
`ing information This date is encoded
`all versions of Windows
`Its detailed on the facing page
`
`in
`
`320
`
`Page 00343
`
`

`
`Chapter
`
`Common Controls and Windows CE
`
`typedef struct
`WORD wYear
`WORD wMonth
`
`WORD wDayOfWeek
`WORD wDay
`WORD wHour
`
`WORD wMinute
`WORD wSecond
`WORD wMilliseconds
`SYSTEMTIME
`
`For this notification only the wMonth wDay and wYear fields are significant
`the number of entries in an array of MONTHDAY
`The cDayState field contains
`STATE values Even if month calendar control
`is displaying only one month it could
`request information about the previous and following months if days of those months
`are needed to fill
`in the top or bottom lines of the calendar
`The month calendar control sends an MCN_SELCHANGE
`notification when the
`user changes the daysthat are selected in the control The structure passed with this
`notification NMSELCHANGE
`contains the newly highlighted starting and ending days
`The MCN_SELECT notification is sent when the user double-taps on
`day The same
`NMSELCHANGE structure is passed with this notification to indicate the days that have
`been selected
`
`The Date and Time Picker Control
`
`string into
`
`The date and time picker control
`look

This document is available on Docket Alarm but you must sign up to view it.


Or .

Accessing this document will incur an additional charge of $.

After purchase, you can access this document again without charge.

Accept $ Charge
throbber

Still Working On It

This document is taking longer than usual to download. This can happen if we need to contact the court directly to obtain the document and their servers are running slowly.

Give it another minute or two to complete, and then try the refresh button.

throbber

A few More Minutes ... Still Working

It can take up to 5 minutes for us to download a document if the court servers are running slowly.

Thank you for your continued patience.

This document could not be displayed.

We could not find this document within its docket. Please go back to the docket page and check the link. If that does not work, go back to the docket and refresh it to pull the newest information.

Your account does not support viewing this document.

You need a Paid Account to view this document. Click here to change your account type.

Your account does not support viewing this document.

Set your membership status to view this document.

With a Docket Alarm membership, you'll get a whole lot more, including:

  • Up-to-date information for this case.
  • Email alerts whenever there is an update.
  • Full text search for other cases.
  • Get email alerts whenever a new case matches your search.

Become a Member

One Moment Please

The filing “” is large (MB) and is being downloaded.

Please refresh this page in a few minutes to see if the filing has been downloaded. The filing will also be emailed to you when the download completes.

Your document is on its way!

If you do not receive the document in five minutes, contact support at support@docketalarm.com.

Sealed Document

We are unable to display this document, it may be under a court ordered seal.

If you have proper credentials to access the file, you may proceed directly to the court's system using your government issued username and password.


Access Government Site

We are redirecting you
to a mobile optimized page.





Document Unreadable or Corrupt

Refresh this Document
Go to the Docket

We are unable to display this document.

Refresh this Document
Go to the Docket