99#include < ShellScalingAPI.h>
1010#include < iostream>
1111#include < thread>
12+ #include < vector>
1213
1314#pragma comment(linker, "/manifestdependency:\"type='win32' name='Microsoft.Windows.Common-Controls' version='6.0.0.0' \
1415 processorArchitecture=' *' publicKeyToken=' 6595b64144ccf1df' language=' *' \" " )
@@ -44,6 +45,8 @@ void WindowMessageLoop() noexcept
4445
4546LRESULT CALLBACK WndProc (HWND hwnd, UINT msg, WPARAM wParam, LPARAM lParam)
4647{
48+ static int ItemIndex{};
49+ static TCHAR ListItem[256 ]{};
4750 static HWND h16 = NULL , h18 = NULL , h20 = NULL , h9 = NULL , h40 = NULL ;
4851 static bool checked{};
4952
@@ -69,32 +72,158 @@ LRESULT CALLBACK WndProc(HWND hwnd, UINT msg, WPARAM wParam, LPARAM lParam)
6972
7073 HWND h11 = CreateWindow (TEXT (" STATIC" ), TEXT (" TASKBAR POSITION" ), WS_CHILD | WS_VISIBLE, 270 , 30 , 300 , 25 , hwnd, NULL , NULL , NULL );
7174 CreateWindow (TEXT (" STATIC" ), TEXT (" OFFSET" ), WS_CHILD | WS_VISIBLE, 270 , 85 , 300 , 25 , hwnd, NULL , NULL , NULL );
72- h9 = CreateWindowEx (WS_EX_CLIENTEDGE, TEXT (" EDIT" ), TEXT (" 0" ), WS_CHILD | WS_VISIBLE, 400 , 80 , 80 , 25 , hwnd, AutoCast<int >(12 ), NULL , NULL );
73-
74- HWND h14 = CreateWindow (TEXT (" STATIC" ), TEXT (" TASKBAR COLOR" ), WS_CHILD | WS_VISIBLE, 270 , 160 , 300 , 25 , hwnd, NULL , NULL , NULL );
75- CreateWindow (TEXT (" STATIC" ), TEXT (" RED" ), WS_CHILD | WS_VISIBLE, 270 , 200 , 300 , 25 , hwnd, NULL , NULL , NULL );
76- h16 = CreateWindowEx (WS_EX_CLIENTEDGE, TEXT (" EDIT" ), TEXT (" 0" ), WS_CHILD | WS_VISIBLE, 400 , 200 , 80 , 25 , hwnd, AutoCast<int >(19 ), NULL , NULL );
77- CreateWindow (TEXT (" STATIC" ), TEXT (" GREEN" ), WS_CHILD | WS_VISIBLE, 270 , 240 , 300 , 25 , hwnd, NULL , NULL , NULL );
78- h18 = CreateWindowEx (WS_EX_CLIENTEDGE, TEXT (" EDIT" ), TEXT (" 0" ), WS_CHILD | WS_VISIBLE, 400 , 240 , 80 , 25 , hwnd, AutoCast<int >(20 ), NULL , NULL );
79- CreateWindow (TEXT (" STATIC" ), TEXT (" BLUE" ), WS_CHILD | WS_VISIBLE, 270 , 285 , 300 , 25 , hwnd, NULL , NULL , NULL );
80- h20 = CreateWindowEx (WS_EX_CLIENTEDGE, TEXT (" EDIT" ), TEXT (" 0" ), WS_CHILD | WS_VISIBLE, 400 , 285 , 80 , 25 , hwnd, AutoCast<int >(21 ), NULL , NULL );
75+ h9 = CreateWindowEx (WS_EX_CLIENTEDGE, TEXT (" EDIT" ), TEXT (" 0" ), WS_CHILD | WS_VISIBLE, 400 , 80 , 80 , 25 , hwnd, NULL , NULL , NULL );
76+
77+ HWND h14 = CreateWindow (TEXT (" STATIC" ), TEXT (" TASKBAR COLOR" ), WS_CHILD | WS_VISIBLE, 270 , 140 , 300 , 25 , hwnd, NULL , NULL , NULL );
78+ CreateWindow (TEXT (" STATIC" ), TEXT (" RED" ), WS_CHILD | WS_VISIBLE, 270 , 180 , 60 , 25 , hwnd, NULL , NULL , NULL );
79+ h16 = CreateWindowEx (WS_EX_CLIENTEDGE, TEXT (" EDIT" ), TEXT (" 0" ), WS_CHILD | WS_VISIBLE, 270 , 200 , 60 , 25 , hwnd, NULL , NULL , NULL );
80+ CreateWindow (TEXT (" STATIC" ), TEXT (" GREEN" ), WS_CHILD | WS_VISIBLE, 350 , 180 , 60 , 25 , hwnd, NULL , NULL , NULL );
81+ h18 = CreateWindowEx (WS_EX_CLIENTEDGE, TEXT (" EDIT" ), TEXT (" 0" ), WS_CHILD | WS_VISIBLE, 350 , 200 , 60 , 25 , hwnd, NULL , NULL , NULL );
82+ CreateWindow (TEXT (" STATIC" ), TEXT (" BLUE" ), WS_CHILD | WS_VISIBLE, 430 , 180 , 60 , 25 , hwnd, NULL , NULL , NULL );
83+ h20 = CreateWindowEx (WS_EX_CLIENTEDGE, TEXT (" EDIT" ), TEXT (" 0" ), WS_CHILD | WS_VISIBLE, 430 , 200 , 60 , 25 , hwnd, NULL , NULL , NULL );
84+
85+ const HWND h223 = CreateWindow (TEXT (" STATIC" ), TEXT (" ANIMATION" ), WS_CHILD | WS_VISIBLE, 270 , 260 , 300 , 25 , hwnd, NULL , NULL , NULL );
86+ const HWND h224 = CreateWindow (TEXT (" COMBOBOX" ), TEXT (" ComboBox" ), CBS_DROPDOWN | WS_CHILD | WS_VISIBLE, 270 , 290 , 250 , 0 , hwnd, (HMENU)100 , NULL , NULL );
87+
88+ std::vector<const wchar_t *> ComboBoxItems = {
89+ L" None" , L" InOut Little" , L" InOut Medium" , L" InOut Alot" , L" OutIn Little" ,
90+ L" OutIn Medium" , L" OutIn Alot" , L" OutOut Little" , L" OutOut Medium" , L" OutOut Alot" ,
91+ L" InIn Little" , L" InIn Medium" , L" InIn Alot"
92+ };
93+
94+ for (auto Item : ComboBoxItems)
95+ SendMessage (GetDlgItem (hwnd, 100 ), CB_ADDSTRING, 0 , AutoCast<const wchar_t *>(Item));
96+
97+ SendMessage (h224, CB_SETCURSEL, 0 , 0 );
8198
8299 CreateWindow (TEXT (" button" ), TEXT (" RESET" ), WS_CHILD | WS_VISIBLE, 280 , 400 , 100 , 35 , hwnd, (HMENU)10003 , NULL , NULL );
83100 CreateWindow (TEXT (" button" ), TEXT (" APPLY" ), WS_CHILD | WS_VISIBLE, 400 , 400 , 100 , 35 , hwnd, (HMENU)10002 , NULL , NULL );
84101
85102 GUI_CREATEFONT (30 , 12 , " Arial" , h11); GUI_CREATEFONT (30 , 12 , " Arial" , h14); GUI_CREATEFONT (30 , 12 , " Arial" , h1);
86103 GUI_CREATEFONT (30 , 12 , " Arial" , h2); GUI_CREATEFONT (30 , 12 , " Arial" , h3); GUI_CREATEFONT (30 , 12 , " Arial" , h4);
87104 GUI_CREATEFONT (30 , 12 , " Arial" , h5); GUI_CREATEFONT (30 , 12 , " Arial" , h6); GUI_CREATEFONT (30 , 12 , " Arial" , h100);
88- GUI_CREATEFONT (30 , 12 , " Arial" , h101); GUI_CREATEFONT (30 , 12 , " Arial" , h103);
105+ GUI_CREATEFONT (30 , 12 , " Arial" , h101); GUI_CREATEFONT (30 , 12 , " Arial" , h103); GUI_CREATEFONT (30 , 12 , " Arial" , h223);
106+ GUI_CREATEFONT (20 , 9 , " Arial" , h224);
89107
90108 break ;
91109 }
92110 case WM_COMMAND:
93111 {
112+ if (HIWORD (wParam) == CBN_SELCHANGE)
113+ {
114+ ItemIndex = SendMessage (AutoCast<LPARAM>(lParam), CB_GETCURSEL, 0 , 0 );
115+
116+ SendMessage (AutoCast<LPARAM>(lParam), CB_GETLBTEXT, ItemIndex,
117+ AutoCast<wchar_t *>(static_cast <wchar_t *>(ListItem)).ToAuto <LPARAM>());
118+ }
119+
94120 switch (LOWORD (wParam))
95121 {
96122 case 10002 :
97123 {
124+ int lastCenter{};
125+
126+ while (true )
127+ {
128+ int center = CenterTaskBar (atoi (GetWinText (h9).c_str ()), false , true );
129+
130+ if ((ItemIndex == 1 ))
131+ {
132+ if (center != lastCenter) // checks if a app is opend or closed
133+ {
134+ CreateAnimation (20 , 40 , atoi (GetWinText (h9).c_str ()));
135+ }
136+ }
137+ if ((ItemIndex == 2 ))
138+ {
139+ if (center != lastCenter)
140+ {
141+ CreateAnimation (40 , 80 , atoi (GetWinText (h9).c_str ()));
142+ }
143+ }
144+ if ((ItemIndex == 3 ))
145+ {
146+ if (center != lastCenter)
147+ {
148+ CreateAnimation (80 , 100 , atoi (GetWinText (h9).c_str ()));
149+ }
150+ }
151+ if ((ItemIndex == 4 ))
152+ {
153+ if (center != lastCenter)
154+ {
155+ CreateAnimation (40 , 20 , atoi (GetWinText (h9).c_str ()));
156+ }
157+ }
158+ if ((ItemIndex == 5 ))
159+ {
160+ if (center != lastCenter)
161+ {
162+ CreateAnimation (80 , 40 , atoi (GetWinText (h9).c_str ()));
163+ }
164+ }
165+ if ((ItemIndex == 6 ))
166+ {
167+ if (center != lastCenter)
168+ {
169+ CreateAnimation (100 , 80 , atoi (GetWinText (h9).c_str ()));
170+ }
171+ }
172+ if ((ItemIndex == 7 ))
173+ {
174+ if (center != lastCenter)
175+ {
176+ CreateAnimation (0 , 20 , atoi (GetWinText (h9).c_str ()));
177+ }
178+ }
179+ if ((ItemIndex == 8 ))
180+ {
181+ if (center != lastCenter)
182+ {
183+ CreateAnimation (0 , 40 , atoi (GetWinText (h9).c_str ()));
184+ }
185+ }
186+ if ((ItemIndex == 9 ))
187+ {
188+ if (center != lastCenter)
189+ {
190+ CreateAnimation (0 , 80 , atoi (GetWinText (h9).c_str ()));
191+ }
192+ }
193+ if ((ItemIndex == 10 ))
194+ {
195+ if (center != lastCenter)
196+ {
197+ CreateAnimation (20 , 0 , atoi (GetWinText (h9).c_str ()));
198+ }
199+ }
200+ if ((ItemIndex == 11 ))
201+ {
202+ if (center != lastCenter)
203+ {
204+ CreateAnimation (40 , 0 , atoi (GetWinText (h9).c_str ()));
205+ }
206+ }
207+ if ((ItemIndex == 12 ))
208+ {
209+ if (center != lastCenter)
210+ {
211+ CreateAnimation (80 , 0 , atoi (GetWinText (h9).c_str ()));
212+ }
213+ }
214+ if ((ItemIndex != 1 ) && (ItemIndex != 2 ) && (ItemIndex != 3 ) && (ItemIndex != 4 ) && (ItemIndex != 5 ) &&
215+ (ItemIndex != 6 ) && (ItemIndex != 7 ) && (ItemIndex != 8 ) && (ItemIndex != 9 ) &&
216+ (ItemIndex != 10 ) && (ItemIndex != 11 ) && (ItemIndex != 12 ))
217+ {
218+ break ;
219+ }
220+
221+ lastCenter = center;
222+
223+ Sleep (10 );
224+ WindowMessageLoop ();
225+ }
226+
98227 if (IsDlgButtonChecked (hwnd, 10002 ) == BN_CLICKED)
99228 {
100229 while (true )
@@ -173,7 +302,7 @@ LRESULT CALLBACK WndProc(HWND hwnd, UINT msg, WPARAM wParam, LPARAM lParam)
173302 case WM_NOTIFY:
174303 {
175304 LPNMHDR some_item = AutoCast<LPARAM>(lParam);
176-
305+
177306 if (some_item->idFrom == 10002 || some_item->idFrom == 10003 && some_item->code == -12 )
178307 {
179308 LPNMCUSTOMDRAW item = AutoCast<LPNMHDR>(some_item);
@@ -245,4 +374,4 @@ int WINAPI WinMain(_In_ HINSTANCE hInstance, _In_opt_ HINSTANCE, _In_ LPSTR, _In
245374 }
246375
247376 return AutoCast<WPARAM>(msg.wParam ).ToAuto <int >();
248- }
377+ }
0 commit comments