diff options
author | Alexander Lantsev <aunsane@gmail.com> | 2014-06-17 18:23:25 +0000 |
---|---|---|
committer | Alexander Lantsev <aunsane@gmail.com> | 2014-06-17 18:23:25 +0000 |
commit | 4e17e675414fd1af646827d4ceeb2a96c1335995 (patch) | |
tree | b5d7748e959237d714ab6942b1b92707266613a5 /protocols/Steam/src/steam_dialogs.cpp | |
parent | 64c2db2196761922e242aece07166ee4b9926a86 (diff) |
Steam:
- first approach of captcha support
- added some docs
git-svn-id: http://svn.miranda-ng.org/main/trunk@9533 1316c22d-e87f-b044-9b9b-93d7a3e3ba9c
Diffstat (limited to 'protocols/Steam/src/steam_dialogs.cpp')
-rw-r--r-- | protocols/Steam/src/steam_dialogs.cpp | 78 |
1 files changed, 38 insertions, 40 deletions
diff --git a/protocols/Steam/src/steam_dialogs.cpp b/protocols/Steam/src/steam_dialogs.cpp index 2e672fff92..4df9192d81 100644 --- a/protocols/Steam/src/steam_dialogs.cpp +++ b/protocols/Steam/src/steam_dialogs.cpp @@ -70,46 +70,44 @@ INT_PTR CALLBACK CSteamProto::CaptchaProc(HWND hwnd, UINT message, WPARAM wParam EndDialog(hwnd, 0);
break;
- //case WM_PAINT:
- // {
- // /*FI_INTERFACE *fei = 0;
-
- // INT_PTR result = CALLSERVICE_NOTFOUND;
- // if (ServiceExists(MS_IMG_GETINTERFACE))
- // result = CallService(MS_IMG_GETINTERFACE, FI_IF_VERSION, (LPARAM)&fei);
-
- // if (fei == NULL || result != S_OK) {
- // MessageBox(0, TranslateT("Fatal error, image services not found. Avatar services will be disabled."), TranslateT("Avatar Service"), MB_OK);
- // return 0;
- // }*/
-
- // PAINTSTRUCT ps;
- // HDC hDC = BeginPaint(hwnd, &ps);
-
- // //FreeImage_Initialise();
- //
- // /*FIMEMORY *stream = FreeImage_OpenMemory(captcha->data, captcha->size);
- // FIBITMAP *dib = FreeImage_LoadFromMemory(FIF_PNG, stream, PNG_DEFAULT);
- // FreeImage_CloseMemory(stream);
-
- // SetStretchBltMode(hDC, COLORONCOLOR);
- // StretchDIBits(
- // hDC,
- // 0, 0,
- // 206, 40,
- // 0, 0,
- // FreeImage_GetWidth(dib), FreeImage_GetHeight(dib),
- // FreeImage_GetBits(dib),
- // FreeImage_GetInfo(dib),
- // DIB_RGB_COLORS, SRCCOPY);
-
- // FreeImage_Unload(dib);*/
-
- // //FreeImage_DeInitialise();
-
- // EndPaint(hwnd, &ps);
- // }
- // return 0;
+ case WM_PAINT:
+ {
+ FI_INTERFACE *fei = 0;
+
+ INT_PTR result = CALLSERVICE_NOTFOUND;
+ if (ServiceExists(MS_IMG_GETINTERFACE))
+ result = CallService(MS_IMG_GETINTERFACE, FI_IF_VERSION, (LPARAM)&fei);
+
+ if (fei == NULL || result != S_OK) {
+ MessageBox(0, TranslateT("Fatal error, image services not found. Avatar services will be disabled."), TranslateT("Avatar Service"), MB_OK);
+ return 0;
+ }
+
+ FIMEMORY *memory = fei->FI_OpenMemory(captcha->data, captcha->size);
+ FIBITMAP *bitmap = fei->FI_LoadFromMemory(FIF_PNG, memory, PNG_DEFAULT);
+ fei->FI_CloseMemory(memory);
+
+ PAINTSTRUCT ps;
+ HDC hDC = BeginPaint(hwnd, &ps);
+
+ SetStretchBltMode(hDC, COLORONCOLOR);
+ StretchDIBits(
+ hDC,
+ 0, 0,
+ 206, 40,
+ 0, 0,
+ fei->FI_GetWidth(bitmap),
+ fei->FI_GetHeight(bitmap),
+ fei->FI_GetBits(bitmap),
+ fei->FI_GetInfo(bitmap),
+ DIB_RGB_COLORS, SRCCOPY);
+
+ fei->FI_Unload(bitmap);
+ //fei->FI_DeInitialise();
+
+ EndPaint(hwnd, &ps);
+ }
+ return 0;
case WM_COMMAND:
{
|