1
0

setupDetailsService.cpp 15 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586587588589590591592593594595596
  1. #include "./setupDetails.h"
  2. #include "../common.h"
  3. #include "../resource.h"
  4. #include "../wasabi.h"
  5. #include <ifc_omservice.h>
  6. #include <ifc_omservicedetails.h>
  7. #include <ifc_omcachemanager.h>
  8. #include <ifc_omserviceevent.h>
  9. #include <ifc_omcachegroup.h>
  10. #include <ifc_omcacherecord.h>
  11. #include <ifc_imageloader.h>
  12. #include <ifc_omgraphics.h>
  13. #include <ifc_omserviceeventmngr.h>
  14. #include <shlwapi.h>
  15. #include <strsafe.h>
  16. #define GetPanel(__hwnd) ((ServicePanel*)GetPropW((__hwnd), MAKEINTATOM(DETAILS_PROP)))
  17. #define GET_IDETAILS(__service, __details)\
  18. (NULL != (service) && SUCCEEDED((service)->QueryInterface(IFC_OmServiceDetails, (void**)&(__details))))
  19. static INT_PTR WINAPI ServicePanel_DialogProc(HWND hwnd, UINT uMsg, WPARAM wParam, LPARAM lParam);
  20. HWND OmSetupDetails_CreateServiceView(HWND hParent, ifc_omservice *service)
  21. {
  22. return WASABI_API_CREATEDIALOGPARAMW(IDD_SETUP_SERVICEDETAILS, hParent, ServicePanel_DialogProc, (LPARAM)service);
  23. }
  24. static HFONT ServicePanel_PickTitleFont(HWND hwnd, LPCWSTR pszTitle, INT cchTitle, INT maxWidth)
  25. {
  26. HFONT dialogFont = (HFONT)SendMessage(hwnd, WM_GETFONT, 0, 0L);
  27. LOGFONT lf;
  28. if (0 == GetObject(dialogFont, sizeof(LOGFONT), &lf))
  29. return NULL;
  30. HFONT titleFont = NULL;
  31. if (cchTitle > 0)
  32. {
  33. LOGFONT lf;
  34. if (0 != GetObject(dialogFont, sizeof(LOGFONT), &lf))
  35. {
  36. StringCchCopy(lf.lfFaceName, ARRAYSIZE(lf.lfFaceName), L"Arial Bold");
  37. lf.lfWidth = 0;
  38. lf.lfWeight = FW_DONTCARE;
  39. lf.lfQuality = 5/*ANTIALIASED_QUALITY*/;
  40. HDC hdc = GetDCEx(hwnd, NULL, DCX_CACHE | DCX_NORESETATTRS);
  41. if (NULL != hdc)
  42. {
  43. HFONT origFont = (HFONT)GetCurrentObject(hdc, OBJ_FONT);
  44. SIZE textSize;
  45. INT heightLimit = (lf.lfHeight < 0) ? 1 : -1;
  46. lf.lfHeight += (lf.lfHeight < 0) ? -2 : +2;
  47. do
  48. {
  49. textSize.cx = 0;
  50. if (NULL != titleFont) DeleteObject(titleFont);
  51. titleFont = CreateFontIndirect(&lf);
  52. if (NULL != titleFont)
  53. {
  54. SelectObject(hdc, titleFont);
  55. GetTextExtentPoint32(hdc, pszTitle, cchTitle, &textSize);
  56. }
  57. lf.lfHeight += (lf.lfHeight < 0) ? 1 : -1;
  58. } while(textSize.cx > maxWidth && lf.lfHeight != heightLimit);
  59. if (0 == textSize.cx)
  60. {
  61. DeleteObject(titleFont);
  62. titleFont = NULL;
  63. }
  64. SelectObject(hdc, origFont);
  65. ReleaseDC(hwnd, hdc);
  66. }
  67. }
  68. }
  69. if (NULL == titleFont &&
  70. 0 != GetObject(dialogFont, sizeof(LOGFONT), &lf))
  71. {
  72. titleFont = CreateFontIndirect(&lf);
  73. }
  74. return titleFont;
  75. }
  76. static void ServicePanel_SetServiceName(HWND hwnd, ifc_omservice *service)
  77. {
  78. HWND hTitle = GetDlgItem(hwnd, IDC_TITLE);
  79. if (NULL == hTitle) return;
  80. WCHAR szBuffer[128];
  81. if (NULL == service ||
  82. FAILED(service->GetName(szBuffer, ARRAYSIZE(szBuffer))))
  83. {
  84. szBuffer[0] = L'\0';
  85. }
  86. SERVICEDETAILS *details = GetDetails(hwnd);
  87. if (NULL != details)
  88. {
  89. INT cchBuffer = lstrlen(szBuffer);
  90. RECT rc;
  91. GetClientRect(hTitle, &rc);
  92. HFONT titleFont = ServicePanel_PickTitleFont(hwnd, szBuffer, cchBuffer, rc.right - rc.left);
  93. if (NULL != titleFont)
  94. {
  95. if (NULL != details->fontTitle) DeleteObject(details->fontTitle);
  96. details->fontTitle = titleFont;
  97. SendMessage(hTitle, WM_SETFONT, (WPARAM)details->fontTitle, 0L);
  98. }
  99. }
  100. SetWindowText(hTitle, szBuffer);
  101. InvalidateRect(hTitle, NULL, TRUE);
  102. }
  103. static void ServicePanel_SetServiceDescription(HWND hwnd, ifc_omservice *service)
  104. {
  105. HWND hDescription = GetDlgItem(hwnd, IDC_DESCRIPTION);
  106. if (NULL == hDescription) return;
  107. WCHAR szBuffer[4096] = {0};
  108. ifc_omservicedetails *details = 0;
  109. if (GET_IDETAILS(service, details))
  110. {
  111. details->GetDescription(szBuffer, ARRAYSIZE(szBuffer));
  112. details->Release();
  113. }
  114. OmSetupDetails_SetDescription(hDescription, szBuffer);
  115. }
  116. static LPCWSTR ServicePanel_FormatDate(LPCWSTR pszDate, LPWSTR pszBuffer, INT cchBufferMax)
  117. {
  118. SYSTEMTIME st;
  119. ZeroMemory(&st, sizeof(SYSTEMTIME));
  120. LPCWSTR cursor;
  121. cursor = pszDate;
  122. INT index = 0;
  123. for(;;)
  124. {
  125. INT iVal;
  126. if (FALSE == StrToIntEx(cursor, STIF_DEFAULT, &iVal) || iVal < 1)
  127. {
  128. index = 0;
  129. break;
  130. }
  131. if (0 == index)
  132. {
  133. if (iVal < 2000 || iVal > 2100)
  134. break;
  135. st.wYear = iVal;
  136. index++;
  137. }
  138. else if (1 == index)
  139. {
  140. if (iVal < 1 || iVal > 12)
  141. break;
  142. st.wMonth = iVal;
  143. index++;
  144. }
  145. else if (2 == index)
  146. {
  147. if (iVal < 1 || iVal > 31)
  148. break;
  149. st.wDay = iVal;
  150. index++;
  151. }
  152. else
  153. {
  154. index = 0;
  155. break;
  156. }
  157. while(L'\0' != *cursor && L'-' != *cursor) cursor++;
  158. if (L'-' == *cursor) cursor++;
  159. if (L'\0' == *cursor)
  160. break;
  161. }
  162. if (3 == index &&
  163. 0 != GetDateFormat(LOCALE_USER_DEFAULT, DATE_SHORTDATE, &st, NULL, pszBuffer, cchBufferMax))
  164. {
  165. return pszBuffer;
  166. }
  167. return pszDate;
  168. }
  169. static HRESULT ServicePanel_GetFullName(ifc_omservicedetails *details, LPWSTR pszBuffer, UINT cchBufferMax)
  170. {
  171. if (NULL == pszBuffer)
  172. return E_POINTER;
  173. *pszBuffer = L'\0';
  174. HRESULT hr = S_OK;
  175. if (NULL != details)
  176. {
  177. hr = details->GetAuthorFirst(pszBuffer, cchBufferMax);
  178. if (SUCCEEDED(hr))
  179. {
  180. UINT cchBuffer = lstrlen(pszBuffer);
  181. LPWSTR cursor = pszBuffer + cchBuffer;
  182. size_t remaining = cchBufferMax - cchBuffer;
  183. if (cursor != pszBuffer)
  184. {
  185. hr = StringCchCopyEx(cursor, remaining, L" ", &cursor, &remaining, 0);
  186. if (SUCCEEDED(hr))
  187. {
  188. hr = details->GetAuthorLast(cursor, (UINT)remaining);
  189. if (FAILED(hr) || L'\0' == *cursor)
  190. {
  191. pszBuffer[cchBuffer] = L'\0';
  192. }
  193. }
  194. }
  195. }
  196. }
  197. return hr;
  198. }
  199. static void ServicePanel_SetServiceMeta(HWND hwnd, ifc_omservice *service)
  200. {
  201. HWND hMeta = GetDlgItem(hwnd, IDC_SERVICEMETA);
  202. if (NULL == hMeta) return;
  203. WCHAR szBuffer[512] = {0};
  204. ifc_omservicedetails *svcdetails = 0;
  205. if (GET_IDETAILS(service, svcdetails))
  206. {
  207. HRESULT hr = S_OK;
  208. LPWSTR cursor = szBuffer;
  209. WCHAR szValue[256] = {0}, szPrefix[64] = {0};
  210. size_t remaining = ARRAYSIZE(szBuffer);
  211. if (SUCCEEDED(ServicePanel_GetFullName(svcdetails, szValue, ARRAYSIZE(szValue))) && L'\0' != szValue[0])
  212. {
  213. WASABI_API_LNGSTRINGW_BUF(IDS_SERVICE_BYAUTHOR, szPrefix, ARRAYSIZE(szPrefix));
  214. hr = StringCchPrintfEx(cursor, remaining, &cursor, &remaining, STRSAFE_NULL_ON_FAILURE,
  215. L"%s%s", szPrefix, szValue);
  216. }
  217. if (SUCCEEDED(svcdetails->GetUpdated(szValue, ARRAYSIZE(szValue))) && L'\0' != szValue[0])
  218. {
  219. if (cursor != szBuffer)
  220. hr = StringCchCopyEx(cursor, remaining, L"\r\n", &cursor, &remaining, STRSAFE_NULL_ON_FAILURE);
  221. if (SUCCEEDED(hr))
  222. {
  223. WCHAR szDate[128] = {0};
  224. WASABI_API_LNGSTRINGW_BUF(IDS_SERVICE_LASTUPDATED, szPrefix, ARRAYSIZE(szPrefix));
  225. StringCchPrintfEx(cursor, remaining, &cursor, &remaining, STRSAFE_NULL_ON_FAILURE,
  226. L"%s%s", szPrefix, ServicePanel_FormatDate(szValue, szDate, ARRAYSIZE(szDate)));
  227. }
  228. }
  229. svcdetails->Release();
  230. }
  231. SERVICEDETAILS *details = GetDetails(hwnd);
  232. if (NULL != details && NULL == details->fontMeta)
  233. {
  234. HFONT dialogFont = (HFONT)SendMessage(hwnd, WM_GETFONT, 0, 0L);
  235. LOGFONT lf;
  236. if (0 != GetObject(dialogFont, sizeof(LOGFONT), &lf))
  237. {
  238. StringCchCopy(lf.lfFaceName, ARRAYSIZE(lf.lfFaceName), L"Tahoma");
  239. lf.lfWidth = 0;
  240. lf.lfHeight += (lf.lfHeight < 0) ? 1 : -1;
  241. lf.lfQuality = ANTIALIASED_QUALITY;
  242. details->fontMeta = CreateFontIndirect(&lf);
  243. }
  244. if (NULL != details->fontMeta)
  245. {
  246. SendMessage(hMeta, WM_SETFONT, (WPARAM)details->fontMeta, 0L);
  247. }
  248. }
  249. SetWindowText(hMeta, szBuffer);
  250. if (0 != ShowWindow(hMeta, (L'\0' != szBuffer[0]) ? SW_SHOWNA : SW_HIDE))
  251. InvalidateRect(hMeta, NULL, TRUE);
  252. }
  253. static void ServicePanel_SetThumbnail(HWND hwnd, ifc_omservice *service)
  254. {
  255. HWND hThumbnail = GetDlgItem(hwnd, IDC_THUMBNAIL);
  256. if (NULL == hThumbnail) return;
  257. SendMessage(hThumbnail, WM_SETREDRAW, FALSE, 0L);
  258. HBITMAP hBitmap;
  259. BITMAPINFOHEADER header;
  260. void *pixelData;
  261. WCHAR szPath[2048];
  262. ifc_omservicedetails *details = 0;
  263. if (GET_IDETAILS(service, details))
  264. {
  265. if (SUCCEEDED(details->GetThumbnail(szPath, ARRAYSIZE(szPath))))
  266. {
  267. ifc_omcachemanager *cacheManager;
  268. if (SUCCEEDED(OMUTILITY->GetCacheManager(&cacheManager)))
  269. {
  270. ifc_omcachegroup *cacheGroup;
  271. if (SUCCEEDED(cacheManager->Find(L"thumbnail", TRUE, &cacheGroup, NULL)))
  272. {
  273. ifc_omcacherecord *cacheRecord;
  274. if (SUCCEEDED(cacheGroup->Find(szPath, TRUE, &cacheRecord, FALSE)))
  275. {
  276. cacheRecord->Release();
  277. }
  278. cacheGroup->Release();
  279. }
  280. cacheManager->Release();
  281. }
  282. }
  283. details->Release();
  284. }
  285. ifc_omimageloader *imageLoader;
  286. if (SUCCEEDED(OMUTILITY->QueryImageLoader(NULL, szPath, FALSE, &imageLoader)))
  287. {
  288. if (FAILED(imageLoader->LoadBitmapEx(&hBitmap, &header, &pixelData)))
  289. hBitmap = NULL;
  290. imageLoader->Release();
  291. }
  292. if (NULL == hBitmap &&
  293. SUCCEEDED(OMUTILITY->QueryImageLoader(WASABI_API_ORIG_HINST, MAKEINTRESOURCE(IDR_SERVICE64X64_IMAGE), FALSE, &imageLoader)))
  294. {
  295. if (FAILED(imageLoader->LoadBitmapEx(&hBitmap, &header, &pixelData)))
  296. hBitmap = NULL;
  297. imageLoader->Release();
  298. }
  299. HBITMAP hTest = (HBITMAP)SendMessage(hThumbnail, STM_SETIMAGE, IMAGE_BITMAP, (LPARAM)hBitmap);
  300. if (NULL != hTest)
  301. DeleteObject(hTest);
  302. if (NULL != hBitmap)
  303. {
  304. hTest = (HBITMAP)SendMessage(hThumbnail, STM_GETIMAGE, IMAGE_BITMAP, 0L);
  305. if (hTest != hBitmap)
  306. { // this is XP and up image copy was created and alpha channel will be handled properly
  307. DeleteObject(hBitmap);
  308. }
  309. else
  310. { // fix alpha channel
  311. if (32 == header.biBitCount)
  312. {
  313. HDC hdcFixed = CreateCompatibleDC(NULL);
  314. if (NULL != hdcFixed)
  315. {
  316. BITMAPINFOHEADER headerFixed;
  317. CopyMemory(&headerFixed, &header, sizeof(BITMAPINFOHEADER));
  318. BYTE *pixelsFixed;
  319. INT cx = header.biWidth;
  320. INT cy = abs(header.biHeight);
  321. HBITMAP bitmapFixed = CreateDIBSection(NULL, (LPBITMAPINFO)&headerFixed, DIB_RGB_COLORS, (void**)&pixelsFixed, NULL, 0);
  322. if (NULL != bitmapFixed)
  323. {
  324. HBITMAP bitmapOrig = (HBITMAP)SelectObject(hdcFixed, bitmapFixed);
  325. HBRUSH hb = (HBRUSH)SendMessage(hwnd, WM_CTLCOLORDLG, (WPARAM)hdcFixed, (LPARAM)hwnd);
  326. if (NULL == hb)
  327. hb = GetSysColorBrush(COLOR_3DFACE);
  328. RECT rect;
  329. SetRect(&rect, 0, 0, cx, cy);
  330. FillRect(hdcFixed, &rect, hb);
  331. ifc_omgraphics *graphics;
  332. if (SUCCEEDED(OMUTILITY->GetGraphics(&graphics)))
  333. {
  334. HDC hdcSrc = CreateCompatibleDC(NULL);
  335. if (NULL != hdcSrc)
  336. {
  337. HBITMAP bitmapSrcOrig = (HBITMAP)SelectObject(hdcSrc, hBitmap);
  338. BLENDFUNCTION bf;
  339. bf.BlendOp = AC_SRC_OVER;
  340. bf.BlendFlags = 0;
  341. bf.SourceConstantAlpha = 0xFF;
  342. bf.AlphaFormat = AC_SRC_ALPHA;
  343. RECT blendRect;
  344. SetRect(&blendRect, 0, 0, cx, cy);
  345. graphics->Premultiply((BYTE*)pixelData, cx, cy);
  346. graphics->AlphaBlend(hdcFixed, &blendRect, hdcSrc, &blendRect, bf);
  347. SelectObject(hdcSrc, bitmapSrcOrig);
  348. DeleteDC(hdcSrc);
  349. }
  350. graphics->Release();
  351. }
  352. SelectObject(hdcFixed, bitmapOrig);
  353. SendMessage(hThumbnail, STM_SETIMAGE, IMAGE_BITMAP, (LPARAM)bitmapFixed);
  354. DeleteObject(hBitmap);
  355. }
  356. DeleteDC(hdcFixed);
  357. }
  358. }
  359. }
  360. }
  361. RECT clientRect;
  362. if (GetClientRect(hThumbnail, &clientRect))
  363. {
  364. INT cx = clientRect.right - clientRect.left;
  365. INT cy = clientRect.bottom - clientRect.top;
  366. if (64 != cx || 64 != cy)
  367. {
  368. SetWindowPos(hThumbnail, NULL, 0, 0, 64, 64, SWP_NOMOVE | SWP_NOACTIVATE | SWP_NOZORDER);
  369. }
  370. }
  371. SendMessage(hThumbnail, WM_SETREDRAW, TRUE, 0L);
  372. if (0 != ShowWindow(hThumbnail, (NULL != hBitmap) ? SW_SHOWNA : SW_HIDE))
  373. InvalidateRect(hThumbnail, NULL, TRUE);
  374. }
  375. static void CALLBACK ServicePanel_OnServiceNotify(UINT serviceUid, UINT callbackType, UINT callbackParam, ULONG_PTR user)
  376. {
  377. HWND hwnd = (HWND)user;
  378. if (NULL == hwnd) return;
  379. SERVICEDETAILS *details = GetDetails(hwnd);
  380. if (NULL == details ||
  381. NULL == details->service ||
  382. serviceUid != details->service->GetId())
  383. {
  384. return;
  385. }
  386. switch(callbackType)
  387. {
  388. case OmService::eventServiceModified:
  389. if (0 != (OmService::modifiedName & callbackParam))
  390. ServicePanel_SetServiceName(hwnd, details->service);
  391. if (0 != (OmService::modifiedDescription & callbackParam))
  392. ServicePanel_SetServiceDescription(hwnd, details->service);
  393. if (0 != ((OmService::modifiedAuthor | OmService::modifiedDate) & callbackParam))
  394. ServicePanel_SetServiceMeta(hwnd, details->service);
  395. if (0 != (OmService::modifiedThumbnail & callbackParam))
  396. ServicePanel_SetThumbnail(hwnd, details->service);
  397. break;
  398. }
  399. }
  400. static INT_PTR ServicePanel_OnInitDialog(HWND hwnd, HWND hFocus, LPARAM lParam)
  401. {
  402. ifc_omservice *service = (ifc_omservice*)lParam;
  403. SERVICEDETAILS *details = (SERVICEDETAILS*)malloc(sizeof(SERVICEDETAILS));
  404. if (NULL == details) return FALSE;
  405. ZeroMemory(details, sizeof(SERVICEDETAILS));
  406. if (!SetProp(hwnd, MAKEINTATOM(DETAILS_PROP), details))
  407. return FALSE;
  408. details->service = service;
  409. details->service->AddRef();
  410. ServicePanel_SetServiceName(hwnd, service);
  411. ServicePanel_SetServiceDescription(hwnd, service);
  412. ServicePanel_SetThumbnail(hwnd, service);
  413. ServicePanel_SetServiceMeta(hwnd, service);
  414. if (NULL != service)
  415. {
  416. ifc_omserviceeventmngr *eventManager;
  417. if (SUCCEEDED(service->GetEventManager(&eventManager)))
  418. {
  419. if (SUCCEEDED(eventManager->RegisterHandler(eventHander)))
  420. {
  421. details->eventHandler = eventHandler;
  422. }
  423. else
  424. {
  425. eventHandler->Release();
  426. }
  427. }
  428. }
  429. return FALSE;
  430. }
  431. static void ServicePanel_OnDestroy(HWND hwnd)
  432. {
  433. OMSERVICEMNGR->UnregisterCallback(ServicePanel_OnServiceNotify, (ULONG_PTR)hwnd);
  434. SERVICEDETAILS *details = GetDetails(hwnd);
  435. RemoveProp(hwnd, MAKEINTATOM(DETAILS_PROP));
  436. if (NULL != details)
  437. {
  438. if (NULL != details->service)
  439. details->service->Release();
  440. if (NULL != details->fontTitle)
  441. DeleteObject(details->fontTitle);
  442. if (NULL != details->fontMeta)
  443. DeleteObject(details->fontMeta);
  444. }
  445. HWND hThumbnail = GetDlgItem(hwnd, IDC_THUMBNAIL);
  446. if (NULL != hThumbnail)
  447. {
  448. HBITMAP hBitmap = (HBITMAP)SendMessage(hThumbnail, STM_SETIMAGE, IMAGE_BITMAP, 0L);
  449. if (NULL != hBitmap)
  450. DeleteObject(hBitmap);
  451. }
  452. }
  453. static INT_PTR ServicePanel_OnDialogColor(HWND hwnd, HDC hdc, HWND hControl)
  454. {
  455. HWND hParent = GetAncestor(hwnd, GA_PARENT);
  456. if (NULL != hParent && hParent != hwnd)
  457. return (INT_PTR)SendMessage(hParent, WM_CTLCOLORDLG, (WPARAM)hdc, (LPARAM)hControl);
  458. return 0;
  459. }
  460. static INT_PTR ServicePanel_OnStaticColor(HWND hwnd, HDC hdc, HWND hControl)
  461. {
  462. INT_PTR result = 0;
  463. HWND hParent = GetAncestor(hwnd, GA_PARENT);
  464. if (NULL != hParent && hParent != hwnd)
  465. result = (INT_PTR)SendMessage(hParent, WM_CTLCOLORSTATIC, (WPARAM)hdc, (LPARAM)hControl);
  466. INT controlId = GetDlgCtrlID(hControl);
  467. switch(controlId)
  468. {
  469. case IDC_SERVICEMETA:
  470. {
  471. COLORREF rgbBk = GetBkColor(hdc);
  472. COLORREF rgbFg = GetTextColor(hdc);
  473. ifc_omgraphics *graphics;
  474. if (SUCCEEDED(OMUTILITY->GetGraphics(&graphics)))
  475. {
  476. graphics->BlendColor(rgbFg, rgbBk, 180, &rgbFg);
  477. graphics->Release();
  478. }
  479. SetTextColor(hdc, rgbFg);
  480. }
  481. break;
  482. }
  483. return result;
  484. }
  485. static INT_PTR WINAPI ServicePanel_DialogProc(HWND hwnd, UINT uMsg, WPARAM wParam, LPARAM lParam)
  486. {
  487. switch(uMsg)
  488. {
  489. case WM_INITDIALOG: return ServicePanel_OnInitDialog(hwnd, (HWND)wParam, lParam);
  490. case WM_DESTROY: ServicePanel_OnDestroy(hwnd); break;
  491. case WM_CTLCOLORDLG: return ServicePanel_OnDialogColor(hwnd, (HDC)wParam, (HWND)lParam);
  492. case WM_CTLCOLORSTATIC: return ServicePanel_OnStaticColor(hwnd, (HDC)wParam, (HWND)lParam);
  493. }
  494. return 0;
  495. }