summaryrefslogtreecommitdiffstats
path: root/mmc_updater/depends/win32cpp/controls.h
blob: a15c8b5fd25f4c3dbdeef085fa44245ce80666a6 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
427
428
429
430
431
432
433
434
435
436
437
438
439
440
441
442
443
444
445
446
447
448
449
450
451
452
453
454
455
456
457
458
459
460
461
462
463
464
465
466
467
468
469
470
471
472
473
474
475
476
477
478
479
480
481
482
483
484
485
486
487
488
489
490
491
492
493
494
495
496
497
498
499
500
501
502
503
504
505
506
507
508
509
510
511
512
513
514
515
516
517
518
519
520
521
522
523
524
525
526
527
528
529
530
531
532
533
534
535
536
537
538
539
540
541
542
543
544
545
546
547
548
549
550
551
552
553
554
555
556
557
558
559
560
561
562
563
564
565
566
567
568
569
570
571
572
573
574
575
576
577
578
579
580
581
582
583
584
585
586
587
588
589
590
591
592
593
594
595
596
597
598
599
600
601
602
603
604
605
606
607
608
609
610
611
612
613
614
615
616
617
618
619
620
621
622
623
624
625
626
627
628
629
630
631
632
633
634
635
636
637
638
639
640
641
642
643
644
645
646
647
648
649
650
651
652
653
654
655
656
657
658
659
660
661
662
663
664
665
666
667
668
669
670
671
672
673
674
675
676
677
678
679
680
681
682
683
684
685
686
687
688
689
690
691
692
693
694
695
696
697
698
699
700
701
702
703
704
705
706
707
708
709
710
711
712
713
714
715
716
717
718
719
720
721
722
723
724
725
726
727
728
729
730
731
732
733
734
735
736
737
738
739
740
741
742
743
744
745
746
747
748
749
750
751
752
753
754
755
756
757
758
759
760
761
762
763
764
765
766
767
768
769
770
771
772
773
774
775
776
777
778
779
780
781
782
783
784
785
786
787
788
789
790
791
792
793
794
795
796
797
798
799
800
801
802
803
804
805
806
807
808
809
810
811
812
813
814
815
816
817
818
819
820
821
822
823
824
825
826
827
828
829
830
831
832
833
834
835
836
837
838
839
840
841
842
843
844
845
846
847
848
849
850
851
852
853
854
855
856
857
858
859
860
861
862
863
864
865
866
867
868
869
870
871
872
873
874
875
876
877
878
879
880
881
882
883
884
885
886
887
888
889
890
891
892
893
894
895
896
897
898
899
900
901
902
903
904
905
906
907
908
909
910
911
912
913
914
915
916
917
918
919
920
921
922
923
924
925
926
927
928
929
930
931
932
933
934
935
936
937
938
939
940
941
942
943
944
945
946
947
948
949
950
951
952
953
954
955
956
957
958
959
960
961
962
963
964
965
966
967
968
969
970
971
972
973
974
975
976
977
978
979
980
981
982
983
984
985
986
987
988
989
990
991
992
993
994
995
996
997
998
999
1000
1001
1002
1003
1004
1005
1006
1007
1008
1009
1010
1011
1012
1013
1014
1015
1016
1017
1018
1019
1020
1021
1022
1023
1024
1025
1026
1027
1028
1029
1030
1031
1032
1033
1034
1035
1036
1037
1038
1039
1040
1041
1042
1043
1044
1045
1046
1047
1048
1049
1050
1051
1052
1053
1054
1055
1056
1057
1058
1059
1060
1061
1062
1063
1064
1065
1066
1067
1068
1069
1070
1071
1072
1073
1074
// Win32++   Version 7.2
// Released: 5th AUgust 2011
//
//      David Nash
//      email: dnash@bigpond.net.au
//      url: https://sourceforge.net/projects/win32-framework
//
//
// Copyright (c) 2005-2011  David Nash
//
// Permission is hereby granted, free of charge, to
// any person obtaining a copy of this software and
// associated documentation files (the "Software"),
// to deal in the Software without restriction, including
// without limitation the rights to use, copy, modify,
// merge, publish, distribute, sublicense, and/or sell
// copies of the Software, and to permit persons to whom
// the Software is furnished to do so, subject to the
// following conditions:
//
// The above copyright notice and this permission notice
// shall be included in all copies or substantial portions
// of the Software.
//
// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF
// ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED
// TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A
// PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT
// SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR
// ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN
// ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
// OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE
// OR OTHER DEALINGS IN THE SOFTWARE.
//
////////////////////////////////////////////////////////


////////////////////////////////////////////////////////
// controls.h
//  Declaration of the following classes:
//  CAnimation, CComboBox, CComboBoxEx, CProgressBar,
//  CScrollBar, CSlider, CSpinButton


#ifndef _WIN32XX_CONTROLS_H_
#define _WIN32XX_CONTROLS_H_

#include "wincore.h"

namespace Win32xx
{
	class CAnimation : public CWnd
	{
	public:
		CAnimation() {}
		virtual ~CAnimation() {}

		BOOL Close() const;
		BOOL Open(LPTSTR lpszName) const;
		BOOL Play(UINT wFrom, UINT wTo, UINT cRepeat) const;
		BOOL Seek(UINT wFrame) const;
		BOOL Stop() const;

	protected:
		// Overridables
		virtual void PreRegisterClass(WNDCLASS &wc) { wc.lpszClassName = ANIMATE_CLASS; }
	};


	class CComboBox : public CWnd
	{
	public:
		CComboBox() {}
		virtual ~CComboBox() {}

		int   AddString(LPCTSTR lpszString) const;
		void  Clear() const;
		void  Copy() const;
		void  Cut() const;
		int   DeleteString(int nIndex) const;
		int   Dir(UINT attr, LPCTSTR lpszWildCard ) const;
		int   FindString(int nIndexStart, LPCTSTR lpszString) const;
		int   FindStringExact(int nIndexStart, LPCTSTR lpszString) const;
		int   GetCount() const;
		int   GetCurSel() const;
		CRect GetDroppedControlRect() const;
		BOOL  GetDroppedState() const;
		int   GetDroppedWidth() const;
		DWORD GetEditSel() const;
		BOOL  GetExtendedUI() const;
		int   GetHorizontalExtent() const;
		DWORD GetItemData(int nIndex) const;
		int   GetItemHeight(int nIndex) const;
		int   GetLBText(int nIndex, LPTSTR lpszText) const;
		int   GetLBTextLen(int nIndex) const;
		LCID  GetLocale() const;
		int   GetTopIndex() const;
		int   InitStorage(int nItems, int nBytes) const;
		int   InsertString(int nIndex, LPCTSTR lpszString) const;
		void  LimitText(int nMaxChars) const;
		void  Paste() const;		
		void  ResetContent() const;
		int   SelectString(int nStartAfter, LPCTSTR lpszString) const;
		int   SetCurSel(int nIndex) const;
		int   SetDroppedWidth(int nWidth) const;
		BOOL  SetEditSel(int nStartChar, int nEndChar) const;
		int   SetExtendedUI(BOOL bExtended = TRUE) const;
		void  SetHorizontalExtent(UINT nExtent ) const;
		int   SetItemData(int nIndex, DWORD dwItemData) const;
		int   SetItemHeight(int nIndex, UINT cyItemHeight) const;
		LCID  SetLocale( LCID NewLocale ) const;
		int   SetTopIndex(int nIndex) const;
		void  ShowDropDown(BOOL bShow = TRUE) const;

	protected:
		// Overridables
		virtual void PreRegisterClass(WNDCLASS &wc) { wc.lpszClassName = _T("ComboBox"); }
	};


	class CComboBoxEx : public CWnd
	{
	public:
		CComboBoxEx() {}
		virtual ~CComboBoxEx() {}

		int  	DeleteItem(int nIndex ) const;
		CWnd* 	GetComboBoxCtrl() const;
		CWnd* 	GetEditCtrl() const;
		DWORD 	GetExtendedStyle() const;
		HIMAGELIST GetImageList() const;
		BOOL 	GetItem(COMBOBOXEXITEM* pCBItem) const;
		BOOL 	HasEditChanged () const;
		int     InsertItem(COMBOBOXEXITEM* lpcCBItem) const;
		DWORD 	SetExtendedStyle(DWORD dwExMask, DWORD dwExStyles ) const;
		HIMAGELIST SetImageList(HIMAGELIST himl) const;
		BOOL 	SetItem(PCOMBOBOXEXITEM lpcCBItem) const;

	protected:
		// Overridables
		virtual void PreRegisterClass(WNDCLASS &wc) { wc.lpszClassName = WC_COMBOBOXEX; }
	};


	class CProgressBar : public CWnd
	{
	public:
		CProgressBar() {}
		virtual ~CProgressBar() {}

		int  GetPos() const;
		int  GetRange(BOOL fWhichLimit, PPBRANGE ppBRange) const;
		int  OffsetPos(int nIncrement) const;
		int  SetPos(int nNewPos) const;
		int  SetRange(short nMinRange, short nMaxRange) const;
		int  SetStep(int nStepInc) const;
		int  StepIt() const;

	protected:
		// Overridables
		virtual void PreRegisterClass(WNDCLASS &wc) { wc.lpszClassName = PROGRESS_CLASS; }
	};


	class CScrollBar : public CWnd
	{
	public:
		CScrollBar() {}
		virtual ~CScrollBar() {}

		BOOL EnableScrollBar( UINT nArrowFlags = ESB_ENABLE_BOTH )  const;
		BOOL GetScrollInfo(LPSCROLLINFO lpsi)  const;
		int  GetScrollPos()  const;
		BOOL GetScrollRange(LPINT lpMinPos, LPINT lpMaxPos )  const;
		BOOL SetScrollInfo(LPSCROLLINFO lpsi, BOOL bRedraw = TRUE )  const;
		int  SetScrollPos(int nPos, BOOL bRedraw)  const;
		BOOL SetScrollRange( int nMinPos, int nMaxPos, BOOL bRedraw = TRUE )  const;
		BOOL ShowScrollBar(BOOL bShow)  const;

	protected:
		// Overridables
		virtual void PreRegisterClass(WNDCLASS &wc) { wc.lpszClassName = _T("SCROLLBAR"); ; }
	};


	class CSlider : public CWnd
	{
	public:
		CSlider() {}
		virtual ~CSlider() {}

		void ClearSel() const;
		void ClearTics(BOOL bRedraw = FALSE ) const;
		CWnd* GetBuddy(BOOL fLocation = TRUE ) const;
		CRect GetChannelRect() const;
		int  GetLineSize() const;
		int  GetNumTics() const;
		int  GetPageSize() const;
		int  GetPos() const;
		int  GetRangeMax() const;
		int  GetRangeMin() const;
		int  GetSelEnd() const;
		int  GetSelStart() const;
		int  GetThumbLength() const;
		CRect GetThumbRect() const;
		int  GetTic(int nTic ) const;
		int  GetTicPos(int nTic) const;
		CWnd* GetToolTips() const;
		CWnd* SetBuddy(CWnd* pBuddy, BOOL fLocation = TRUE ) const;
		int  SetLineSize(int nSize) const;
		int  SetPageSize(int nSize) const;
		void SetPos(int nPos, BOOL bRedraw = FALSE) const;
		void SetRangeMax(int nMax, BOOL bRedraw = FALSE) const;
		void SetRangeMin(int nMax, BOOL bRedraw = FALSE) const;
		void SetSelection(int nMin, int nMax, BOOL bRedraw = FALSE) const;
		BOOL SetTic(int nTic) const;
		void SetTicFreq(int nFreq)  const;
		int  SetTipSide(int nLocation) const;
		void SetToolTips(CWnd* pToolTip) const;

	protected:
		// Overridables
		virtual void PreRegisterClass(WNDCLASS &wc) { wc.lpszClassName = TRACKBAR_CLASS; }
	};


	// Also known as an Up/Down control
	class CSpinButton : public CWnd
	{
	public:
		CSpinButton() {}
		virtual ~CSpinButton() {}

		int  GetAccel(int cAccels, LPUDACCEL paAccels) const;
		int  GetBase() const;
		CWnd* GetBuddy() const;
		int  GetPos() const;
		DWORD GetRange() const;
		BOOL SetAccel(int cAccels, LPUDACCEL paAccels) const;
		int  SetBase(int nBase) const;
		CWnd* SetBuddy(CWnd* hwndBuddy) const;
		int  SetPos(int nPos) const;
		void SetRange(int nLower, int nUpper) const;

	protected:
		// Overridables
		virtual void PreCreate(CREATESTRUCT &cs);
		virtual void PreRegisterClass(WNDCLASS &wc);
	};

} // namespace Win32xx

//~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~

namespace Win32xx
{

	////////////////////////////////////////
	// Definitions for the CAnimation class
	//
	inline BOOL CAnimation::Close() const
	// Closes an AVI clip.
	{
		assert(IsWindow());
		return Animate_Close(m_hWnd);
	}

	inline BOOL CAnimation::Open(LPTSTR lpszName) const
	// Opens an AVI clip and displays its first frame in an animation control.
	{
		assert(IsWindow());
		return Animate_Open(m_hWnd, lpszName);
	}

	inline BOOL CAnimation::Play(UINT wFrom, UINT wTo, UINT cRepeat) const
	// Plays an AVI clip in an animation control. The control plays the clip
	//	in the background while the thread continues executing.
	{
		assert(IsWindow());
		return Animate_Play(m_hWnd, wFrom, wTo, cRepeat);
	}

	inline BOOL CAnimation::Seek(UINT wFrame) const
	// Directs an animation control to display a particular frame of an AVI clip. 
	// The control displays the clip in the background while the thread continues executing.
	{
		assert(IsWindow());
		return Animate_Seek(m_hWnd, wFrame);
	}

	inline BOOL CAnimation::Stop() const
	// Stops playing an AVI clip in an animation control.
	{
		assert(IsWindow());
		return Animate_Stop(m_hWnd);
	}


	////////////////////////////////////////
	// Definitions for the CComboBox class
	//
	inline int  CComboBox::AddString(LPCTSTR lpszString) const
	// Adds a string to the list box of a combo box. If the combo box does not 
	// have the CBS_SORT style, the string is added to the end of the list. 
	// Otherwise, the string is inserted into the list, and the list is sorted.
	{
		assert(IsWindow());
		return (int)SendMessage(CB_ADDSTRING, 0, (LPARAM)lpszString);
	}

	inline void CComboBox::Clear() const
	// Deletes the current selection, if any, from the combo box's edit control.
	{
		assert(IsWindow());
		SendMessage(WM_CLEAR, 0, 0);
	}

	inline void CComboBox::Copy() const
	// Copies the current selection to the clipboard in CF_TEXT format.
	{
		assert(IsWindow());
		SendMessage(WM_COPY, 0, 0);
	}

	inline void CComboBox::Cut() const
	// Deletes the current selection, if any, in the edit control and copies 
	// the deleted text to the clipboard in CF_TEXT format.
	{
		assert(IsWindow());
		SendMessage(WM_CUT, 0, 0);
	}

	inline int  CComboBox::DeleteString(int nIndex) const
	// Deletes a string in the list box of a combo box. 
	{
		assert(IsWindow());
		return (int)SendMessage(CB_DELETESTRING, (WPARAM)nIndex, 0);
	}

	inline int  CComboBox::Dir(UINT attr, LPCTSTR lpszWildCard ) const
	// Adds the names of directories and files that match a specified string 
	// and set of file attributes.
	{
		assert(IsWindow());
		return (int)SendMessage(CB_DIR, (WPARAM)attr, (LPARAM)lpszWildCard);
	}

	inline int  CComboBox::FindString(int nIndexStart, LPCTSTR lpszString) const
	// Search the list box of a combo box for an item beginning with the 
	// characters in a specified string.
	{
		assert(IsWindow());
		return (int)SendMessage(CB_FINDSTRING, (WPARAM)nIndexStart, (LPARAM)lpszString);
	}

	inline int  CComboBox::FindStringExact(int nIndexStart, LPCTSTR lpszString) const
	// Find the first list box string in a combo box that matches the string specified in lpszString. 
	{
		assert(IsWindow());
		return (int)SendMessage(CB_FINDSTRINGEXACT, (WPARAM)nIndexStart, (LPARAM)lpszString);
	}

	inline int  CComboBox::GetCount() const
	// Retrieves the number of items in the list box of the combo box.
	{
		assert(IsWindow());
		return (int)SendMessage(CB_GETCOUNT, 0,0);
	}

	inline int  CComboBox::GetCurSel() const
	// Retrieves the index of the currently selected item, if any, in the list box of the combo box. 
	{
		assert(IsWindow());
		return (int)SendMessage(CB_GETCURSEL, 0,0);
	}

	inline CRect CComboBox::GetDroppedControlRect() const
	// Retrieves the screen coordinates of the combo box in its dropped-down state. 
	{
		assert(IsWindow());
		CRect rc;
		SendMessage(CB_GETDROPPEDCONTROLRECT, 0, (LPARAM)&rc);
		return rc;
	}

	inline BOOL CComboBox::GetDroppedState() const
	// Determines whether the list box of the combo box is dropped down.
	{
		assert(IsWindow());
		return (BOOL)SendMessage(CB_GETDROPPEDSTATE, 0, 0);
	}

	inline int  CComboBox::GetDroppedWidth() const
	// Retrieves the minimum allowable width, in pixels, of the list box of the combo box 
	// with the CBS_DROPDOWN or CBS_DROPDOWNLIST style.
	{
		assert(IsWindow());
		return (int)SendMessage(CB_GETDROPPEDWIDTH, 0, 0);
	}

	inline DWORD CComboBox::GetEditSel() const
	// Gets the starting and ending character positions of the current selection 
	// in the edit control of the combo box. 
	{
		assert(IsWindow());
		return (int)SendMessage(CB_GETEDITSEL, 0, 0);
	}

	inline BOOL CComboBox::GetExtendedUI() const
	// Determines whether the combo box has the default user interface or the extended user interface.
	{
		assert(IsWindow());
		return (BOOL)SendMessage(CB_GETEXTENDEDUI, 0, 0);
	}

	inline int  CComboBox::GetHorizontalExtent() const
	// Retrieve from the combo box the width, in pixels, by which the list box can 
	// be scrolled horizontally (the scrollable width).
	{
		assert(IsWindow());
		return (int)SendMessage(CB_GETHORIZONTALEXTENT, 0, 0);
	}

	inline DWORD CComboBox::GetItemData(int nIndex) const
	// Retrieves the application-supplied value associated with the specified item in the combo box.
	{
		assert(IsWindow());
		return (DWORD)SendMessage(CB_GETITEMDATA, (WPARAM)nIndex, 0);
	}

	inline int  CComboBox::GetItemHeight(int nIndex) const
	// Determines the height of list items or the selection field in the combo box.
	{
		assert(IsWindow());
		return (int)SendMessage(CB_GETITEMHEIGHT, (WPARAM)nIndex, 0);
	}

	inline int  CComboBox::GetLBText(int nIndex, LPTSTR lpszText) const
	//  Retrieves a string from the list of the combo box.
	{
		assert(IsWindow());
		return (int)SendMessage(CB_GETLBTEXT, (WPARAM)nIndex, (LPARAM)lpszText);
	}

	inline int  CComboBox::GetLBTextLen(int nIndex) const
	// Retrieves the length, in characters, of a string in the list of the combo box.
	{
		assert(IsWindow());
		return (int)SendMessage(CB_GETLBTEXTLEN, (WPARAM)nIndex, 0);
	}

	inline LCID CComboBox::GetLocale() const
	// Retrieves the current locale of the combo box.
	{
		assert(IsWindow());
		return (LCID)SendMessage(CB_GETLOCALE, 0, 0);
	}

	inline int  CComboBox::GetTopIndex() const
	// Retrieves the zero-based index of the first visible item in the list box portion of the combo box.
	{
		assert(IsWindow());
		return (int)SendMessage(CB_GETTOPINDEX, 0, 0);
	}

	inline int  CComboBox::InitStorage(int nItems, int nBytes) const
	// Allocates memory for storing list box items. Use this before adding a 
	// large number of items to the list box portion of a combo box.
	{
		assert(IsWindow());
		return (int)SendMessage(CB_INITSTORAGE, (WPARAM)nItems, (LPARAM)nBytes);
	}

	inline int  CComboBox::InsertString(int nIndex, LPCTSTR lpszString) const
	// Inserts a string into the list box of the combo box. Unlike the AddString, 
	// a list with the CBS_SORT style is not sorted.
	{
		assert(IsWindow());
		return (int)SendMessage(CB_INSERTSTRING, (WPARAM)nIndex, (LPARAM)lpszString);
	}

	inline void CComboBox::Paste() const
	// Copies the current content of the clipboard to the combo box's edit control at the current caret position.
	{
		assert(IsWindow());
		SendMessage(WM_PASTE, 0, 0);
	}

	inline void CComboBox::LimitText(int nMaxChars) const
	// Limits the length of the text the user may type into the edit control of the combo box.
	{
		assert(IsWindow());
		SendMessage(CB_LIMITTEXT, (WPARAM)nMaxChars, 0);
	}

	inline void CComboBox::ResetContent() const
	// Removes all items from the list box and edit control of the combo box.
	{
		assert(IsWindow());
		SendMessage(CB_RESETCONTENT, 0, 0);
	}

	inline int  CComboBox::SelectString(int nStartAfter, LPCTSTR lpszString) const
	// Searches the list of a combo box for an item that begins with the characters in a
	// specified string. If a matching item is found, it is selected and copied to the edit control.
	{
		assert(IsWindow());
		return (int)SendMessage(CB_SELECTSTRING, (WPARAM)nStartAfter, (LPARAM)lpszString);
	}

	inline int  CComboBox::SetCurSel(int nIndex) const
	// Selects a string in the list of the combo box. If necessary, the list scrolls the string into view.
	{
		assert(IsWindow());
		return (int)SendMessage(CB_SETCURSEL, (WPARAM)nIndex, 0);
	}

	inline int  CComboBox::SetDroppedWidth(int nWidth) const
	// Sets the maximum allowable width, in pixels, of the list box of the combo box with
	// the CBS_DROPDOWN or CBS_DROPDOWNLIST style.
	{
		assert(IsWindow());
		return (int)SendMessage(CB_SETDROPPEDWIDTH, (WPARAM)nWidth, 0);
	}

	inline BOOL CComboBox::SetEditSel(int nStartChar, int nEndChar) const
	// Selects characters in the edit control of the combo box.
	{
		assert(IsWindow());
		return (BOOL)SendMessage(CB_SETEDITSEL, 0, (LPARAM)MAKELONG(nStartChar,nEndChar));
	}

	inline int  CComboBox::SetExtendedUI(BOOL bExtended) const
	// Selects either the default user interface or the extended user interface for the combo box that 
	// has the CBS_DROPDOWN or CBS_DROPDOWNLIST style.
	{
		assert(IsWindow());
		return (int)SendMessage(CB_SETEXTENDEDUI, (WPARAM)bExtended, 0);
	}

	inline void CComboBox::SetHorizontalExtent(UINT nExtent ) const
	// Sets the width, in pixels, by which the list box can be scrolled horizontally (the scrollable width).
	{
		assert(IsWindow());
		SendMessage(CB_SETHORIZONTALEXTENT, (WPARAM)nExtent, 0);
	}

	inline int  CComboBox::SetItemData(int nIndex, DWORD dwItemData) const
	// Sets the value associated with the specified item in the combo box.
	{
		assert(IsWindow());
		return (int)SendMessage(CB_SETITEMDATA, (WPARAM)nIndex, (LPARAM)dwItemData);
	}

	inline int  CComboBox::SetItemHeight(int nIndex, UINT cyItemHeight) const
	// Sets the height of list items or the selection field in the combo box.
	{
		assert(IsWindow());
		return (int)SendMessage(CB_SETITEMHEIGHT, (WPARAM)nIndex, (LPARAM)cyItemHeight);
	}

	inline LCID CComboBox::SetLocale( LCID NewLocale ) const
	// Sets the current locale of the combo box.
	{
		assert(IsWindow());
		return (LCID)SendMessage(CB_SETLOCALE, (WPARAM)NewLocale, 0);
	}

	inline int  CComboBox::SetTopIndex(int nIndex) const
	// Ensure that a particular item is visible in the list box of the combo box.
	{
		assert(IsWindow());
		return (int)SendMessage(CB_SETTOPINDEX, (WPARAM)nIndex, 0);
	}

	inline void CComboBox::ShowDropDown(BOOL bShow) const
	// Shows or hides the list box of the combo box that has the CBS_DROPDOWN or CBS_DROPDOWNLIST style.
	{
		assert(IsWindow());
		SendMessage(CB_SHOWDROPDOWN, (WPARAM)bShow, 0);
	}


	////////////////////////////////////////
	// Definitions for the CComboBoxEx class
	//
	inline int  CComboBoxEx::DeleteItem(int nIndex ) const
	// Removes an item from the ComboBoxEx control.
	{
		assert(IsWindow());
		return (int)SendMessage(CBEM_DELETEITEM, (WPARAM)nIndex, 0);
	}

	inline CWnd* CComboBoxEx::GetComboBoxCtrl() const
	// Retrieves the handle to the child combo box control.
	{
		assert(IsWindow());
		return FromHandle((HWND)SendMessage(CBEM_GETCOMBOCONTROL, 0, 0));
	}

	inline CWnd* CComboBoxEx::GetEditCtrl() const
	// Retrieves the handle to the edit control portion of the ComboBoxEx control.
	{
		assert(IsWindow());
		return FromHandle((HWND)SendMessage(CBEM_GETEDITCONTROL, 0, 0));
	}

	inline DWORD CComboBoxEx::GetExtendedStyle() const
	// Retrieves the extended styles that are in use for the ComboBoxEx control.
	{
		assert(IsWindow());
		return (DWORD)SendMessage(CBEM_GETEXTENDEDSTYLE, 0, 0);
	}

	inline HIMAGELIST CComboBoxEx::GetImageList() const
	// Retrieves the handle to an image list assigned to the ComboBoxEx control.
	{
		assert(IsWindow());
		return (HIMAGELIST)SendMessage(CBEM_GETIMAGELIST, 0, 0);
	}

	inline BOOL CComboBoxEx::GetItem(COMBOBOXEXITEM* pCBItem) const
	// Retrieves item information for the given ComboBoxEx item.
	{
		assert(IsWindow());
		return (BOOL)SendMessage(CBEM_GETITEM, 0, (LPARAM)pCBItem);
	}

	inline BOOL CComboBoxEx::HasEditChanged () const
	// Determines whether or not the user has changed the text of the ComboBoxEx edit control.
	{
		assert(IsWindow());
		return (BOOL)SendMessage(CBEM_HASEDITCHANGED, 0, 0);
	}

	inline int CComboBoxEx::InsertItem(COMBOBOXEXITEM* lpcCBItem) const
	// Inserts a new item in the ComboBoxEx control. 
	{
		assert(IsWindow());
		return (int)SendMessage(CBEM_INSERTITEM, 0, (LPARAM)lpcCBItem);
	}

	inline DWORD CComboBoxEx::SetExtendedStyle(DWORD dwExMask, DWORD dwExStyles ) const
	// Sets extended styles within the ComboBoxEx control.
	{
		assert(IsWindow());
		return (DWORD)SendMessage(CBEM_SETEXTENDEDSTYLE, (WPARAM)dwExMask, (LPARAM)dwExStyles);
	}

	inline HIMAGELIST CComboBoxEx::SetImageList(HIMAGELIST himl) const
	// Sets an image list for the ComboBoxEx control.
	{
		assert(IsWindow());
		return (HIMAGELIST)SendMessage(CBEM_SETIMAGELIST, 0, (LPARAM)himl);
	}

	inline BOOL CComboBoxEx::SetItem(PCOMBOBOXEXITEM lpcCBItem) const
	// Sets the attributes for an item in the ComboBoxEx control.
	{
		assert(IsWindow());
		return (BOOL)SendMessage(CBEM_SETITEM, 0, (LPARAM)lpcCBItem);
	}


	////////////////////////////////////////
	// Definitions for the CProgressBar class
	//
	inline int CProgressBar::GetPos() const
	// Retrieves the current position of the progress bar.
	{
		assert(IsWindow());
		return (int)SendMessage(PBM_GETPOS, 0, 0);
	}

	inline int CProgressBar::GetRange(BOOL fWhichLimit, PPBRANGE ppBRange) const
	// Retrieves information about the current high and low limits of the progress bar control.
	{
		assert(IsWindow());
		return (int)SendMessage(PBM_GETRANGE, (WPARAM)fWhichLimit, (LPARAM) (PPBRANGE) ppBRange);
	}

	inline int CProgressBar::OffsetPos(int nIncrement) const
	// Advances the current position of the progress bar by a specified increment and redraws
	// the bar to reflect the new position.
	{
		assert(IsWindow());
		return (int)SendMessage(PBM_DELTAPOS, (WPARAM)nIncrement, 0);
	}

	inline int CProgressBar::SetPos(int nNewPos) const
	// Sets the current position for the progress bar and redraws the bar to reflect the new position.
	{
		assert(IsWindow());
		return (int)SendMessage(PBM_SETPOS, (WPARAM)nNewPos, 0);
	}

	inline int CProgressBar::SetRange(short nMinRange, short nMaxRange) const
	// Sets the minimum and maximum values for the progress bar and redraws the bar to reflect the new range.
	{
		assert(IsWindow());
		return (int)SendMessage(PBM_SETRANGE, 0, (LPARAM) MAKELPARAM (nMinRange, nMaxRange));
	}

	inline int CProgressBar::SetStep(int nStepInc) const
	// Specifies the step increment for the progress bar.
	{
		assert(IsWindow());
		return (int)SendMessage(PBM_SETSTEP, (WPARAM)nStepInc, 0);
	}
	
	inline int CProgressBar::StepIt() const
	// Advances the current position for a progress bar by the step increment and 
	// redraws the bar to reflect the new position.
	{
		assert(IsWindow());
		return (int)SendMessage(PBM_STEPIT, 0, 0);
	}


	////////////////////////////////////////
	// Definitions for the CScrollBar class
	//
	inline BOOL CScrollBar::EnableScrollBar( UINT nArrowFlags )  const
	// Enables or disables the scroll bar arrows.
	{
		assert(IsWindow());
		return ::EnableScrollBar(m_hWnd, SB_CTL, nArrowFlags);
	}

	inline BOOL CScrollBar::GetScrollInfo(LPSCROLLINFO lpsi)  const
	// Retrieves the parameters of a scroll bar, including the minimum and maximum 
	// scrolling positions, the page size, and the position of the scroll box (thumb).
	{
		assert(IsWindow());
		return ::GetScrollInfo(m_hWnd, SB_CTL, lpsi);
	}

	inline int CScrollBar::GetScrollPos()  const
	// Retrieves the current position of the scroll box (thumb) in the scroll bar.
	{
		assert(IsWindow());
		return ::GetScrollPos(m_hWnd, SB_CTL);
	}

	inline BOOL CScrollBar::GetScrollRange(LPINT lpMinPos, LPINT lpMaxPos )  const
	// Retrieves the current minimum and maximum scroll box (thumb) positions for the scroll bar. 
	{
		assert(IsWindow());
		return ::GetScrollRange(m_hWnd, SB_CTL, lpMinPos, lpMaxPos);
	}

	inline BOOL CScrollBar::SetScrollInfo(LPSCROLLINFO lpsi, BOOL bRedraw )  const
	// Sets the parameters of the scroll bar, including the minimum and maximum scrolling positions, 
	// the page size, and the position of the scroll box (thumb).
	{
		assert(IsWindow());
		return ::SetScrollInfo(m_hWnd, SB_CTL, lpsi, bRedraw);
	}

	inline int CScrollBar::SetScrollPos(int nPos, BOOL bRedraw)  const
	// Sets the position of the scroll box (thumb) in the scroll bar and, if requested, 
	// redraws the scroll bar to reflect the new position of the scroll box.
	{
		assert(IsWindow());
		return ::SetScrollPos(m_hWnd, SB_CTL, nPos, bRedraw);
	}

	inline BOOL CScrollBar::SetScrollRange( int nMinPos, int nMaxPos, BOOL bRedraw )  const
	// Sets the minimum and maximum scroll box positions for the scroll bar.
	{
		assert(IsWindow());
		return ::SetScrollRange(m_hWnd, SB_CTL, nMinPos, nMaxPos, bRedraw);
	}

	inline BOOL CScrollBar::ShowScrollBar(BOOL bShow)  const
	// Shows or hides the scroll bar.
	{
		assert(IsWindow());
		return ::ShowScrollBar(m_hWnd, SB_CTL, bShow);
	}

	////////////////////////////////////////
	// Definitions for the CSlider class
	//
	inline void CSlider::ClearSel() const
	// Clears the current selection range in the trackbar.
	{
		assert(IsWindow());
		SendMessage(TBM_CLEARSEL, 0, 0);
	}

	inline void CSlider::ClearTics(BOOL bRedraw) const
	// Removes the current tick marks from the trackbar.
	{
		assert(IsWindow());
		SendMessage(TBM_CLEARTICS, (WPARAM)bRedraw, 0);
	}

	inline CWnd* CSlider::GetBuddy(BOOL fLocation) const
	// Retrieves the handle to the trackbar control buddy window at a given location.
	{
		assert(IsWindow());
		return FromHandle((HWND)SendMessage(TBM_GETBUDDY, (WPARAM)fLocation, 0));
	}

	inline CRect CSlider::GetChannelRect() const
	// Retrieves the size and position of the bounding rectangle for the trackbar's channel.
	{
		assert(IsWindow());
		CRect rc;
		SendMessage(TBM_GETCHANNELRECT, 0, (LPARAM)&rc);
		return rc;
	}

	inline int  CSlider::GetLineSize() const
	// Retrieves the number of logical positions the trackbar's slider moves in response
	// to keyboard input from the arrow keys.
	{
		assert(IsWindow());
		return (int)SendMessage(TBM_GETLINESIZE, 0, 0);
	}

	inline int  CSlider::GetNumTics() const
	// Retrieves the number of tick marks in the trackbar.
	{
		assert(IsWindow());
		return (int)SendMessage(TBM_GETNUMTICS, 0, 0);
	}

	inline int  CSlider::GetPageSize() const
	// Retrieves the number of logical positions the trackbar's slider moves in response to 
	// keyboard input, or mouse input, such as clicks in the trackbar's channel.
	{
		assert(IsWindow());
		return (int)SendMessage(TBM_GETPAGESIZE, 0, 0);
	}

	inline int  CSlider::GetPos() const
	// Retrieves the current logical position of the slider in the trackbar.
	{
		assert(IsWindow());
		return (int)SendMessage(TBM_GETPOS, 0, 0);
	}

	inline int  CSlider::GetRangeMax() const
	// Retrieves the maximum position for the slider in the trackbar.
	{
		assert(IsWindow());
		return (int)SendMessage(TBM_GETRANGEMAX, 0, 0);
	}

	inline int  CSlider::GetRangeMin() const
	// Retrieves the minimum position for the slider in the trackbar. 
	{
		assert(IsWindow());
		return (int)SendMessage(TBM_GETRANGEMIN, 0, 0);
	}

	inline int  CSlider::GetSelEnd() const
	// Retrieves the ending position of the current selection range in the trackbar. 
	{
		assert(IsWindow());
		return (int)SendMessage(TBM_GETSELEND, 0, 0);
	}

	inline int  CSlider::GetSelStart() const
	// Retrieves the starting position of the current selection range in the trackbar.
	{
		assert(IsWindow());
		return (int)SendMessage(TBM_GETSELSTART, 0, 0);
	}

	inline int  CSlider::GetThumbLength() const
	// Retrieves the length of the slider in the trackbar.
	{
		assert(IsWindow());
		return (int)SendMessage(TBM_GETTHUMBLENGTH, 0, 0);
	}

	inline CRect CSlider::GetThumbRect() const
	// Retrieves the size and position of the bounding rectangle for the slider in the trackbar. 
	{
		CRect rc;
		SendMessage(TBM_GETTHUMBRECT, 0, (LPARAM)&rc);
		return rc;
	}

	inline int CSlider::GetTic(int nTic ) const
	// Retrieves the logical position of a tick mark in the trackbar.
	{
		assert(IsWindow());
		return (int)SendMessage(TBM_GETTIC, (WPARAM)nTic, 0);
	}

	inline int  CSlider::GetTicPos(int nTic) const
	// Retrieves the current physical position of a tick mark in the trackbar.
	{
		assert(IsWindow());
		return (int)SendMessage(TBM_GETTICPOS, (WPARAM)nTic, 0);
	}

	inline CWnd* CSlider::GetToolTips() const
	// Retrieves the handle to the ToolTip control assigned to the trackbar, if any.
	{
		assert(IsWindow());
		return FromHandle((HWND)SendMessage(TBM_GETTOOLTIPS, 0, 0));
	}

	inline CWnd* CSlider::SetBuddy(CWnd* pBuddy, BOOL fLocation /*= TRUE*/ ) const
	// Assigns a window as the buddy window for the trackbar control.
	{
		assert(IsWindow());
		return FromHandle((HWND)SendMessage(TBM_SETBUDDY, (WPARAM)fLocation, (LPARAM)pBuddy->GetHwnd()));
	}

	inline int  CSlider::SetLineSize(int nSize) const
	// Sets the number of logical positions the trackbar's slider moves in response to 
	// keyboard input from the arrow keys.
	{
		assert(IsWindow());
		return(int)SendMessage(TBM_SETLINESIZE, 0, (LPARAM)nSize);
	}

	inline int  CSlider::SetPageSize(int nSize) const
	// Sets the number of logical positions the trackbar's slider moves in response to 
	// keyboard input, or mouse input such as clicks in the trackbar's channel.
	{
		assert(IsWindow());
		return(int)SendMessage(TBM_SETPAGESIZE, 0, (LPARAM)nSize);
	}

	inline void CSlider::SetPos(int nPos, BOOL bRedraw) const
	// Sets the current logical position of the slider in the trackbar.
	{
		assert(IsWindow());
		SendMessage(TBM_SETPOS, (WPARAM)bRedraw, (LPARAM)nPos);
	}

	inline void CSlider::SetRangeMax(int nMax, BOOL bRedraw) const
	// Sets the maximum logical position for the slider in the trackbar.
	{
		assert(IsWindow());
		SendMessage(TBM_SETRANGEMAX, (WPARAM)bRedraw, (LPARAM)nMax);
	}

	inline void CSlider::SetRangeMin(int nMax, BOOL bRedraw) const
	// Sets the minimum logical position for the slider in the trackbar.
	{
		assert(IsWindow());
		SendMessage(TBM_SETRANGEMIN, (WPARAM)bRedraw, (LPARAM)nMax);
	}

	inline void CSlider::SetSelection(int nMin, int nMax, BOOL bRedraw) const
	// Sets the starting and ending positions for the available selection range in the trackbar.
	{
		assert(IsWindow());
		SendMessage(TBM_SETSEL, (WPARAM)bRedraw, (LPARAM)MAKELONG(nMax, nMin));
	}

	inline BOOL CSlider::SetTic(int nTic) const
	// Sets a tick mark in the trackbar at the specified logical position. 
	{
		assert(IsWindow());
		return (BOOL)SendMessage(TBM_SETTIC, 0, nTic);
	}

	inline void CSlider::SetTicFreq(int nFreq)  const
	// Sets the interval frequency for tick marks in the trackbar.
	{
		assert(IsWindow());
		SendMessage(TBM_SETTICFREQ, (WPARAM)nFreq, 0);
	}

	inline int  CSlider::SetTipSide(int nLocation) const
	// Positions a ToolTip control used by the trackbar control.
	{
		assert(IsWindow());
		return (int)SendMessage(TBM_SETTIPSIDE, (WPARAM)nLocation, 0);
	}

	inline void CSlider::SetToolTips(CWnd* pToolTip) const
	// Assigns a ToolTip control to the trackbar control.
	{
		assert(IsWindow());
		SendMessage(TBM_SETTOOLTIPS, (WPARAM)pToolTip->GetHwnd(), 0);
	}

	////////////////////////////////////////
	// Definitions for the CSpinButton class
	//
	inline int CSpinButton::GetAccel(int cAccels, LPUDACCEL paAccels) const
	// Retrieves acceleration information for the up-down control.
	{
		assert(IsWindow());
		return (int)SendMessage(UDM_GETACCEL, (WPARAM)cAccels, (LPARAM)paAccels);
	}

	inline int CSpinButton::GetBase() const
	// Retrieves the current radix base (that is, either base 10 or 16) for the up-down control.
	{
		assert(IsWindow());
		return (int)SendMessage(UDM_GETBASE, 0, 0);
	}

	inline CWnd* CSpinButton::GetBuddy() const
	// Retrieves the handle to the current buddy window.
	{
		assert(IsWindow());
		return FromHandle((HWND)SendMessage(UDM_GETBUDDY, 0, 0));
	}

	inline int CSpinButton::GetPos() const
	// Retrieves the current position of the up-down control with 16-bit precision.
	{
		assert(IsWindow());
		return (int)SendMessage(UDM_GETPOS, 0, 0);
	}

	inline DWORD CSpinButton::GetRange() const
	// Retrieves the minimum and maximum positions (range) for the up-down control.
	{
		assert(IsWindow());
		return (DWORD)SendMessage(UDM_GETRANGE, 0, 0);
	}
	
	inline void CSpinButton::PreCreate(CREATESTRUCT &cs)
    { 
		cs.style = WS_CHILD | WS_VISIBLE | WS_BORDER | WS_VISIBLE |UDS_SETBUDDYINT; 
	}
	
	inline void CSpinButton::PreRegisterClass(WNDCLASS &wc)
	{
		wc.lpszClassName = UPDOWN_CLASS;
	}

	inline BOOL CSpinButton::SetAccel(int cAccels, LPUDACCEL paAccels) const
	// Sets the acceleration for the up-down control.
	{
		assert(IsWindow());
		return (BOOL)SendMessage(UDM_SETACCEL, (WPARAM)cAccels, (LPARAM)paAccels);
	}

	inline int CSpinButton::SetBase(int nBase) const
	// Sets the radix base for the up-down control.
	{
		assert(IsWindow());
		return (int)SendMessage(UDM_SETBASE, (WPARAM)nBase, 0);
	}

	inline CWnd* CSpinButton::SetBuddy(CWnd* pBuddy) const
	// Sets the buddy window for the up-down control.
	{
		assert(IsWindow());
		return FromHandle((HWND)SendMessage(UDM_SETBUDDY, (WPARAM)pBuddy->GetHwnd(), 0));
	}

	inline int CSpinButton::SetPos(int nPos) const
	// Sets the current position for the up-down control with 16-bit precision.
	{
		assert(IsWindow());
		return (int)SendMessage(UDM_SETPOS, 0, (LPARAM)MAKELONG ((short) nPos, 0));
	}

	inline void CSpinButton::SetRange(int nLower, int nUpper) const
	// Sets the minimum and maximum positions (range) for the up-down control.
	{
		assert(IsWindow());
		SendMessage(UDM_SETRANGE, 0, (LPARAM)MAKELONG(nUpper, nLower));
	}

} // namespace Win32xx

#endif //  define _WIN32XX_CONTROLS_H_