我创建窗口
hwnd = CreateWindowEx(WS_EX_LAYERED, szWindowClass, szTitle,0,
CW_USEDEFAULT, 0, CW_USEDEFAULT, 0, NULL, NULL, hInstance, NULL);
然后我显示png图像
CImage img;
img.Load(Path);
int iWidth = img.GetWidth();
int iHeight = img.GetHeight();
HDC hdcScreen = GetDC(NULL);
HDC hDC = CreateCompatibleDC(hdcScreen);
HBITMAP hBmp = CreateCompatibleBitmap(hdcScreen, iWidth, iHeight);
HBITMAP hBmpOld = (HBITMAP)SelectObject(hDC, hBmp);
img.Draw(hDC,0, 0, iWidth, iHeight, 0, 0, iWidth, iHeight);
BLENDFUNCTION blend = {0};
blend.BlendOp = AC_SRC_OVER;
blend.BlendFlags=0;
blend.SourceConstantAlpha = 255;
blend.AlphaFormat = AC_SRC_ALPHA;
POINT ptPos = {0, 0};
SIZE sizeWnd = {iWidth, iHeight};
POINT ptSrc = {0, 0};
UpdateLayeredWindow(hWnd, hdcScreen, &ptPos, &sizeWnd, hDC, &ptSrc, 0, &blend, ULW_ALPHA);
SelectObject(hDC, hBmpOld);
DeleteObject(hBmp);
DeleteDC(hDC);
ReleaseDC(NULL, hdcScreen);
我想在这个窗口上创建一些静态控制元素,例如进度条。
#define ID_MainProgressBar 2000
HWND MainProgressBar=CreateWindowEx(WS_EX_LAYERED,PROGRESS_CLASS,NULL,WS_CHILD|WS_VISIBLE|PBS_SMOOTH,200,200,180,100,hwnd1,(HMENU)ID_MainProgressBar,hInst,NULL);
而且我看不到这个元素。另一个问题,在回调主窗口或创建主窗口时需要在哪里调用 HWND MainProgressBar=CreateWindowEx?