Posted June 3, 201213 yr I created a simple oval png and used it as the frame window of my application.I noticed that some patch used pnglib and UpdateLayeredWindow to realize regionedand transparent window.Any buddy could fix my code? Thanks a lot.Here's the main code://UpdateLayeredWindow using Visual Studio 2003 above//or VC6 with upgraded SDK, tools->options->directories//set include path of newer SDKcase WM_CREATE:PNG_Init(&g_pnginfo);PNG_LoadResource(&g_pnginfo, g_hInst, MAKEINTRESOURCE(IDR_PNG_FRAME));PNG_Decode(&g_pnginfo);g_bmpHandle = PNG_CreateBitmap(&g_pnginfo, hwnd, PNG_OUTF_AUTO, false);PremultipliedAlpha(g_bmpHandle);return 0;case WM_PAINT:hdc = BeginPaint(hwnd, &ps);hdcMem = CreateCompatibleDC(hdc);SelectObject(hdcMem, g_bmpHandle);BitBlt(hdc, 0, 0, g_pngWidth, g_pngHeight, hdcMem, 0, 0, SRCCOPY);SetWindowLong(hwnd, GWL_EXSTYLE, GetWindowLong(hwnd, GWL_EXSTYLE) | WS_EX_LAYERED);UpdateLayeredWindow(hwnd, hdc, 0, 0, hdcMem, 0, 0, &bf, ULW_ALPHA);DeleteDC(hdcMem);EndPaint(hwnd, &ps);return 0;case WM_RBUTTONDOWN:case WM_DESTROY:PNG_Cleanup(&g_pnginfo);PostQuitMessage(0);return 0;Attachment is the full source cpp and exe file.pngAsWindow.zip Edited June 27, 201213 yr by alaphate
June 3, 201213 yr Your bf.SourceConstantAlpha is 0 (fully transparent), that's why. Edited June 3, 201213 yr by Ufo-Pu55y
Create an account or sign in to comment