alaphate Posted June 3, 2012 Posted June 3, 2012 (edited) 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, 2012 by alaphate
Ufo-Pu55y Posted June 3, 2012 Posted June 3, 2012 (edited) Your bf.SourceConstantAlpha is 0 (fully transparent), that's why. Edited June 3, 2012 by Ufo-Pu55y
Recommended Posts
Create an account or sign in to comment
You need to be a member in order to leave a comment
Create an account
Sign up for a new account in our community. It's easy!
Register a new accountSign in
Already have an account? Sign in here.
Sign In Now