直接copy就可以用,主要用于造轮子,
封了一个类

#pragma once
#include <atomic>
#include <windows.h>class SplashWindow
{public:SplashWindow();~SplashWindow();static void globalInit();static void globalUnInit();bool createWnd(void);void adjustWindowSize(int cx,int cy);void setCenterShow();void show(bool show_window = true);void exec();void stop();void update();HWND getHwnd();protected:virtual void onPaintEvent();protected:static LRESULT CALLBACK WindowProcedure(HWND hwnd, UINT message, WPARAM wParam, LPARAM lParam);void createMemDC(HWND hwnd, int cx, int cy );void deleteMemDC();HWND hwnd_ = NULL;HDC mem_dc_ = NULL;HBITMAP mem_bitmap_= NULL;};//CPP
#include "SplashWindow.h"#include <algorithm>
#include <windows.h>
#include <tchar.h>
#include <gdiplus.h>
#pragma  comment(lib,"Gdiplus.lib")ULONG_PTR gdiplusStartupToken;#define SW_CLASS_NAME _T("BaseBaseWin")bool SplashWindow::createWnd(void)
{WNDCLASSEX wincl;        /* Data structure for the windowclass *//* The Window structure */wincl.hInstance = GetModuleHandle(NULL);wincl.lpszClassName = SW_CLASS_NAME;//+-69+ wincl.lpfnWndProc = WindowProcedure;      /* This function is called by windows */wincl.cbSize = sizeof(WNDCLASSEX);/* Use default icon and mouse-pointer */wincl.hIcon = NULL;wincl.hIconSm = NULL;wincl.hCursor = LoadCursor(NULL, IDC_ARROW);wincl.lpszMenuName = NULL;                 /* No menu */wincl.cbClsExtra = 0;                      /* No extra bytes after the window class */wincl.cbWndExtra = 0;                      /* structure or the window instance *//* Use Windows's default colour as the background of the window */wincl.hbrBackground = (HBRUSH)COLOR_BACKGROUND;/* Register the window class, and if it fails quit the program */if (RegisterClassEx(&wincl)){HWND hwnd = CreateWindowEx(WS_EX_LAYERED,                   /* Extended possibilites for variation */SW_CLASS_NAME,         /* classname */_T("QAQSplash"),       /* Title Text */WS_POPUP, /* default window */0,       /* Windows decides the position */0,       /* where the window ends up on the screen */500,                 /* The programs width */500,                 /* and height in pixels */NULL,        /* The window is a child-window to desktop */NULL,                /* No menu */GetModuleHandle(NULL),       /* Program Instance handler */this                 /* No Window Creation data */);if (hwnd)return true;}return false;
}void  SplashWindow::setCenterShow() {long scrWidth, scrHeight;RECT rect;scrWidth = GetSystemMetrics(SM_CXSCREEN);scrHeight = GetSystemMetrics(SM_CYSCREEN);GetWindowRect(hwnd_, &rect);SetWindowPos(hwnd_, HWND_TOPMOST, (scrWidth - rect.right) / 2, (scrHeight - rect.bottom) / 2, rect.right - rect.left, rect.bottom - rect.top, SWP_SHOWWINDOW);
}void SplashWindow::adjustWindowSize(int cx, int cy)
{RECT re; ::GetWindowRect(hwnd_, &re);::MoveWindow(hwnd_, re.left, re.top, cx, cy, true);
}void SplashWindow::onPaintEvent()
{HDC dc = GetDC(hwnd_);RECT wndRect;::GetWindowRect(hwnd_, &wndRect);SIZE wndSize = { wndRect.right - wndRect.left,wndRect.bottom - wndRect.top };Gdiplus::Graphics graphics(mem_dc_);//Gdiplus::SolidBrush bru(Gdiplus::Color(255, 255, 0, 0));//Gdiplus::Rect re(0, 0, wndSize.cx, wndSize.cy);//graphics.FillRectangle(&bru, re);graphics.DrawImage(&Gdiplus::Image(L"C:\\BG.PNG"), 0, 0, wndSize.cx, wndSize.cy);POINT ptsrc{ 0,0 };POINT ptDest = { wndRect.left,wndRect.top };BLENDFUNCTION blend = { AC_SRC_OVER, 0, (BYTE)(255.0), AC_SRC_ALPHA };UpdateLayeredWindow(hwnd_, dc, &ptDest, &wndSize, mem_dc_, &ptsrc, 0, &blend, ULW_ALPHA);::ReleaseDC(hwnd_, dc);
}LRESULT CALLBACK SplashWindow::WindowProcedure(HWND hwnd, UINT message, WPARAM wParam, LPARAM lParam)
{SplashWindow *  target_obj= (SplashWindow *)GetWindowLongPtr(hwnd, GWLP_USERDATA);switch (message)                  /* handle the messages */{case WM_NCCREATE:{SplashWindow* remote = (SplashWindow*)((CREATESTRUCT*)lParam)->lpCreateParams;SetWindowLongPtr(hwnd, GWLP_USERDATA, (LONG_PTR)remote);remote->hwnd_ = hwnd;}break;case WM_NCDESTROY:{target_obj->hwnd_ = NULL;SetWindowLongPtr(hwnd, GWLP_USERDATA, (LONG_PTR)NULL);PostQuitMessage(0);       /* send a WM_QUIT to the message queue */}break;case WM_CREATE:{}break;case WM_DESTROY:{}break;case WM_SIZE:{if(target_obj){int nW = LOWORD(lParam);int nH = HIWORD(lParam);target_obj->createMemDC(hwnd, nW , nH);target_obj->update();}}break;case WM_PAINT:{}break;default:                      /* for messages that we don't deal with */return DefWindowProc(hwnd, message, wParam, lParam);}return DefWindowProc(hwnd, message, wParam, lParam);
}SplashWindow::SplashWindow()
{}SplashWindow::~SplashWindow()
{}void SplashWindow::globalInit()
{Gdiplus::GdiplusStartupInput gdiInput;Gdiplus::GdiplusStartup(&gdiplusStartupToken, &gdiInput, NULL);
}void SplashWindow::globalUnInit()
{Gdiplus::GdiplusShutdown(gdiplusStartupToken);
}void SplashWindow::show(bool show_window)
{ShowWindow(hwnd_ ,show_window? SW_SHOW :SW_HIDE);}void SplashWindow::exec()
{MSG messages;while (GetMessage(&messages, NULL, 0, 0)){TranslateMessage(&messages);DispatchMessage(&messages);}}void SplashWindow::stop()
{PostMessage(hwnd_, WM_CLOSE, 0, 0);
}void SplashWindow::update()
{onPaintEvent();
}HWND SplashWindow::getHwnd()
{return hwnd_;
}void SplashWindow::createMemDC(HWND hwnd, int cx, int cy)
{deleteMemDC();HDC dc = GetDC(hwnd);mem_dc_ = ::CreateCompatibleDC(dc);BITMAPINFO bitmapinfo;bitmapinfo.bmiHeader.biSize = sizeof(BITMAPINFOHEADER);bitmapinfo.bmiHeader.biBitCount = 32;bitmapinfo.bmiHeader.biHeight = cy;bitmapinfo.bmiHeader.biWidth = cx;bitmapinfo.bmiHeader.biPlanes = 1;bitmapinfo.bmiHeader.biCompression = BI_RGB;bitmapinfo.bmiHeader.biXPelsPerMeter = 0;bitmapinfo.bmiHeader.biYPelsPerMeter = 0;bitmapinfo.bmiHeader.biClrUsed = 0;bitmapinfo.bmiHeader.biClrImportant = 0;bitmapinfo.bmiHeader.biSizeImage =bitmapinfo.bmiHeader.biWidth * bitmapinfo.bmiHeader.biHeight *bitmapinfo.bmiHeader.biBitCount / 8;mem_bitmap_ = ::CreateDIBSection(mem_dc_, &bitmapinfo, 0, NULL, 0, 0);SelectObject(mem_dc_, mem_bitmap_);ReleaseDC(hwnd, dc);
}void SplashWindow::deleteMemDC()
{::DeleteDC(mem_dc_);::DeleteObject(mem_bitmap_);mem_dc_ = NULL;mem_bitmap_ = NULL;
}use it
SplashWindow window;
window.adjustWindowSize(125, 125);
window.setCenterShow();
window.show();
window.exec();

//WS_EX_LAYERED + CreateDIBSection + UpdateLayeredWindow,首选这种方式!!


#include <windows.h>
#include <gdiplus.h>
#pragma  comment(lib,"Gdiplus.lib")ULONG_PTR gdiplusStartupToken;
LRESULT CALLBACK WindowProcedure(HWND, UINT, WPARAM, LPARAM);char szClassName[] = "YUIDialog";int WINAPI WinMain(HINSTANCE hThisInstance,HINSTANCE hPrevInstance,LPSTR lpszArgument,int nCmdShow)
{Gdiplus::GdiplusStartupInput gdiInput;Gdiplus::GdiplusStartup(&gdiplusStartupToken, &gdiInput, NULL);WNDCLASSEX wincl;        /* Data structure for the windowclass *//* The Window structure */wincl.hInstance = hThisInstance;wincl.lpszClassName = szClassName;//+-69+ wincl.lpfnWndProc = WindowProcedure;      /* This function is called by windows */wincl.style = CS_DBLCLKS;                 /* Catch double-clicks */wincl.cbSize = sizeof(WNDCLASSEX);/* Use default icon and mouse-pointer */wincl.hIcon = LoadIcon(NULL, IDI_APPLICATION);wincl.hIconSm = LoadIcon(NULL, IDI_APPLICATION);wincl.hCursor = LoadCursor(NULL, IDC_ARROW);wincl.lpszMenuName = NULL;                 /* No menu */wincl.cbClsExtra = 0;                      /* No extra bytes after the window class */wincl.cbWndExtra = 0;                      /* structure or the window instance *//* Use Windows's default colour as the background of the window */wincl.hbrBackground = (HBRUSH)COLOR_BACKGROUND;/* Register the window class, and if it fails quit the program */if (!RegisterClassEx(&wincl))return 0;/* The class is registered, let's create the program*/HWND hwnd = CreateWindowEx(WS_EX_LAYERED,                   /* Extended possibilites for variation */szClassName,         /* Classname */"Title",       /* Title Text */WS_POPUP, /* default window */500,       /* Windows decides the position */300,       /* where the window ends up on the screen */500,                 /* The programs width */500,                 /* and height in pixels */NULL,        /* The window is a child-window to desktop */NULL,                /* No menu */hThisInstance,       /* Program Instance handler */NULL                 /* No Window Creation data */);ShowWindow(hwnd, nCmdShow);MSG messages;while (GetMessage(&messages, NULL, 0, 0)){TranslateMessage(&messages);DispatchMessage(&messages);}Gdiplus::GdiplusShutdown(gdiplusStartupToken);return messages.wParam;
}HDC g_memDC = NULL;
HBITMAP g_memBitmap = NULL;
void copyToCurDC(HWND hwnd)
{HDC dc = GetDC(hwnd);RECT wndRect;::GetWindowRect(hwnd, &wndRect);SIZE wndSize = { wndRect.right - wndRect.left,wndRect.bottom - wndRect.top };Gdiplus::Graphics graphics(g_memDC);Gdiplus::SolidBrush bru(Gdiplus::Color(255, 255, 0, 0));Gdiplus::Rect re(0, 0, wndSize.cx, wndSize.cy);graphics.FillRectangle(&bru, re);graphics.DrawImage(&Gdiplus::Image(L"C:\\BG.PNG"), 0, 0, wndSize.cx, wndSize.cy);//g_memDC;POINT ptDest = { wndRect.left,wndRect.top };BLENDFUNCTION blend = { AC_SRC_OVER, 0, (BYTE)(255.0), AC_SRC_ALPHA };UpdateLayeredWindow(hwnd, dc, &ptDest, &wndSize, g_memDC, &POINT{ 0,0 }, 0, &blend, ULW_ALPHA);::ReleaseDC(hwnd,dc);
}LRESULT CALLBACK WindowProcedure(HWND hwnd, UINT message, WPARAM wParam, LPARAM lParam)
{switch (message)                  /* handle the messages */{case WM_CREATE:{//::SetLayeredWindowAttributes(hwnd, RGB(0, 0, 0), 255, LWA_ALPHA);}break;case WM_SIZE:{::DeleteDC(g_memDC);::DeleteObject(g_memBitmap);int nW = LOWORD(lParam);int nH = HIWORD(lParam);HDC dc = GetDC(hwnd);g_memDC = ::CreateCompatibleDC(dc);BITMAPINFO bitmapinfo;bitmapinfo.bmiHeader.biSize = sizeof(BITMAPINFOHEADER);bitmapinfo.bmiHeader.biBitCount = 32;bitmapinfo.bmiHeader.biHeight = nH;bitmapinfo.bmiHeader.biWidth = nW;bitmapinfo.bmiHeader.biPlanes = 1;bitmapinfo.bmiHeader.biCompression = BI_RGB;bitmapinfo.bmiHeader.biXPelsPerMeter = 0;bitmapinfo.bmiHeader.biYPelsPerMeter = 0;bitmapinfo.bmiHeader.biClrUsed = 0;bitmapinfo.bmiHeader.biClrImportant = 0;bitmapinfo.bmiHeader.biSizeImage =bitmapinfo.bmiHeader.biWidth * bitmapinfo.bmiHeader.biHeight *bitmapinfo.bmiHeader.biBitCount / 8;g_memBitmap = ::CreateDIBSection(g_memDC, &bitmapinfo, 0, NULL, 0, 0);SelectObject(g_memDC, g_memBitmap);ReleaseDC(hwnd, dc);copyToCurDC(hwnd);}break;case WM_DESTROY:PostQuitMessage(0);       /* send a WM_QUIT to the message queue */break;case WM_LBUTTONDOWN:::SendMessage(hwnd, WM_NCLBUTTONDOWN, HTCAPTION, 0);break;default:                      /* for messages that we don't deal with */return DefWindowProc(hwnd, message, wParam, lParam);}return 0;
}

//使用 WS_EX_LAYERED+UpdateLayeredWindow方式实现

#include <windows.h>
#include <gdiplus.h>
#include <windowsx.h>
#pragma  comment(lib,"Gdiplus.lib")ULONG_PTR gdiplusStartupToken;LRESULT CALLBACK WindowProcedure(HWND, UINT, WPARAM, LPARAM);char szClassName[] = "YUIDialog";int WINAPI WinMain(HINSTANCE hThisInstance,HINSTANCE hPrevInstance,LPSTR lpszArgument,int nCmdShow)
{Gdiplus::GdiplusStartupInput gdiInput;Gdiplus::GdiplusStartup(&gdiplusStartupToken, &gdiInput, NULL);WNDCLASSEX wincl;        /* Data structure for the windowclass *//* The Window structure */wincl.hInstance = hThisInstance;wincl.lpszClassName = szClassName;//+-69+ wincl.lpfnWndProc = WindowProcedure;      /* This function is called by windows */wincl.style = CS_DBLCLKS;                 /* Catch double-clicks */wincl.cbSize = sizeof(WNDCLASSEX);/* Use default icon and mouse-pointer */wincl.hIcon = LoadIcon(NULL, IDI_APPLICATION);wincl.hIconSm = LoadIcon(NULL, IDI_APPLICATION);wincl.hCursor = LoadCursor(NULL, IDC_ARROW);wincl.lpszMenuName = NULL;                 /* No menu */wincl.cbClsExtra = 0;                      /* No extra bytes after the window class */wincl.cbWndExtra = 0;                      /* structure or the window instance *//* Use Windows's default colour as the background of the window */wincl.hbrBackground = (HBRUSH)COLOR_BACKGROUND;/* Register the window class, and if it fails quit the program */if (!RegisterClassEx(&wincl))return 0;/* The class is registered, let's create the program*/HWND hwnd = CreateWindowEx(WS_EX_LAYERED,                   /* Extended possibilites for variation */szClassName,         /* Classname */"Title",       /* Title Text */WS_POPUP, /* default window */500,       /* Windows decides the position */300,       /* where the window ends up on the screen */500,                 /* The programs width */500,                 /* and height in pixels */NULL,        /* The window is a child-window to desktop */NULL,                /* No menu */hThisInstance,       /* Program Instance handler */NULL                 /* No Window Creation data */);ShowWindow(hwnd, nCmdShow);MSG messages;while (GetMessage(&messages, NULL, 0, 0)){/* Translate virtual-key messages into character messages */TranslateMessage(&messages);/* Send message to WindowProcedure */DispatchMessage(&messages);}Gdiplus::GdiplusShutdown(gdiplusStartupToken);/* The program return-value is 0 - The value that PostQuitMessage() gave */return messages.wParam;
}/*  This function is called by the Windows function DispatchMessage()  */
HDC g_memDC = NULL;
HBITMAP g_memBitmap = NULL;
LRESULT CALLBACK WindowProcedure(HWND hwnd, UINT message, WPARAM wParam, LPARAM lParam)
{switch (message)                  /* handle the messages */{case WM_SIZE:{::DeleteDC(g_memDC);::DeleteObject(g_memBitmap);int nW = LOWORD(lParam);int nH = HIWORD(lParam);HDC dc = GetDC(hwnd);g_memDC = ::CreateCompatibleDC(dc);g_memBitmap = ::CreateCompatibleBitmap(dc, nW, nH);::SelectObject(g_memDC, g_memBitmap);ReleaseDC(hwnd, dc);PostMessage(hwnd, WM_PAINT, NULL, NULL);}break;case WM_ERASEBKGND:return 1;case WM_PAINT:{PAINTSTRUCT ps;HDC dc = BeginPaint(hwnd, &ps);RECT wndRect = ps.rcPaint;if (wndRect.bottom == wndRect.top && wndRect.right == wndRect.left){::GetWindowRect(hwnd, &wndRect);}SIZE wndSize = { wndRect.right - wndRect.left,wndRect.bottom - wndRect.top };Gdiplus::Graphics graphics(g_memDC);Gdiplus::SolidBrush bru(Gdiplus::Color(255,0,255,0));Gdiplus::Rect re(0,0,wndSize.cx,wndSize.cy);//graphics.FillRectangle(&bru,re);graphics.DrawImage(&Gdiplus::Image(L"C:\\BG.PNG"), 0, 0, wndSize.cx, wndSize.cy);HBRUSH hBrush = CreateSolidBrush(RGB(0, 0, 0));         //2SelectObject(g_memDC, hBrush);      //3Rectangle(g_memDC, 140, 140, 300, 300);                         //4POINT ptDest = { wndRect.left,wndRect.top };BLENDFUNCTION blendFunction;blendFunction.AlphaFormat = AC_SRC_ALPHA;blendFunction.BlendFlags = 0;blendFunction.BlendOp = AC_SRC_OVER;blendFunction.SourceConstantAlpha = 255;UpdateLayeredWindow(hwnd, dc, &ptDest, &wndSize, g_memDC, &POINT{ 0,0 }, 0, &blendFunction, ULW_ALPHA| ULW_COLORKEY);EndPaint(hwnd, &ps);}break;case WM_DESTROY:PostQuitMessage(0);       /* send a WM_QUIT to the message queue */break;case WM_LBUTTONDOWN:::SendMessage(hwnd, WM_NCLBUTTONDOWN, HTCAPTION, 0);break;default:                      /* for messages that we don't deal with */return DefWindowProc(hwnd, message, wParam, lParam);}return 0;
}

//opengl 透明

#define _WIN32_WINNT 0x0500#include <windows.h>
#include <windowsx.h>
#include <GL/gl.h>
#include <GL/glu.h>#include <dwmapi.h>#pragma comment (lib, "opengl32.lib")
#pragma comment (lib, "glu32.lib")#pragma comment (lib, "dwmapi.lib")#include <assert.h>
#include <tchar.h>#ifdef  assert
#define verify(expr) if(!expr) assert(0)
#else verify(expr) expr
#endifconst TCHAR szAppName[]=_T("TransparentGL");
const TCHAR wcWndName[]=_T("TransparentGL");HDC hDC;
HGLRC m_hrc;
int w = 240;
int h = 240;BOOL initSC() {glEnable(GL_ALPHA_TEST);        glEnable(GL_DEPTH_TEST);        glEnable(GL_COLOR_MATERIAL);glEnable(GL_LIGHTING);          glEnable(GL_LIGHT0);            glEnable(GL_BLEND);             glBlendFunc(GL_SRC_ALPHA, GL_ONE_MINUS_SRC_ALPHA);glClearColor(0, 0, 0, 0);return 0;
}void resizeSC(int width,int height) {glViewport(0,0,width,height);glMatrixMode(GL_PROJECTION);glLoadIdentity();glMatrixMode(GL_MODELVIEW );glLoadIdentity();
}BOOL renderSC() {glClear(GL_COLOR_BUFFER_BIT | GL_DEPTH_BUFFER_BIT );glPushMatrix();glColor3f(0, 1, 1);glBegin(GL_TRIANGLES);                              // Drawing Using TrianglesglColor3f(1.0f,0.0f,0.0f);                      // Set The Color To RedglVertex3f( 0.0f, 1.0f, 0.0f);                  // TopglColor3f(0.0f,1.0f,0.0f);                      // Set The Color To GreenglVertex3f(-1.0f,-1.0f, 0.0f);                  // Bottom LeftglColor3f(0.0f,0.0f,1.0f);                      // Set The Color To BlueglVertex3f( 1.0f,-1.0f, 0.0f);                  // Bottom RightglEnd();glPopMatrix();glFlush();return 0;
}BOOL CreateHGLRC(HWND hWnd) {PIXELFORMATDESCRIPTOR pfd = {sizeof(PIXELFORMATDESCRIPTOR),1,                                // Version NumberPFD_DRAW_TO_WINDOW      |         // Format Must Support WindowPFD_SUPPORT_OPENGL      |         // Format Must Support OpenGLPFD_SUPPORT_COMPOSITION |         // Format Must Support CompositionPFD_DOUBLEBUFFER,                 // Must Support Double BufferingPFD_TYPE_RGBA,                    // Request An RGBA Format32,                               // Select Our Color Depth0, 0, 0, 0, 0, 0,                 // Color Bits Ignored8,                                // An Alpha Buffer0,                                // Shift Bit Ignored0,                                // No Accumulation Buffer0, 0, 0, 0,                       // Accumulation Bits Ignored24,                               // 16Bit Z-Buffer (Depth Buffer)8,                                // Some Stencil Buffer0,                                // No Auxiliary BufferPFD_MAIN_PLANE,                   // Main Drawing Layer0,                                // Reserved0, 0, 0                           // Layer Masks Ignored};     HDC hdc = GetDC(hWnd);int PixelFormat = ChoosePixelFormat(hdc, &pfd);if (PixelFormat == 0) {assert(0);return FALSE ;}BOOL bResult = SetPixelFormat(hdc, PixelFormat, &pfd);if (bResult==FALSE) {assert(0);return FALSE ;}m_hrc = wglCreateContext(hdc);if (!m_hrc){assert(0);return FALSE;}ReleaseDC(hWnd, hdc);return TRUE;
}LRESULT CALLBACK WindowFunc(HWND hWnd,UINT msg, WPARAM wParam, LPARAM lParam) {PAINTSTRUCT ps;switch(msg) {case WM_CREATE:break;case WM_DESTROY:if(m_hrc) {wglMakeCurrent(NULL, NULL);wglDeleteContext(m_hrc) ;}PostQuitMessage(0) ;break;default: return DefWindowProc(hWnd,msg,wParam,lParam);}return 0;
}int WINAPI _tWinMain(HINSTANCE hThisInst, HINSTANCE hPrevInst, LPSTR str,int nWinMode) {WNDCLASSEX wc;memset(&wc, 0, sizeof(wc));wc.cbSize = sizeof(WNDCLASSEX);wc.hIconSm = LoadIcon(NULL, IDI_APPLICATION);wc.style = CS_HREDRAW | CS_VREDRAW;wc.lpfnWndProc = (WNDPROC)WindowFunc;wc.cbClsExtra  = 0;wc.cbWndExtra  = 0;wc.hInstance = hThisInst;wc.hIcon = LoadIcon(NULL, IDI_APPLICATION);wc.hCursor = LoadCursor(NULL, IDC_ARROW);wc.hbrBackground = (HBRUSH)CreateSolidBrush(0x00000000);wc.lpszClassName = szAppName;if(!RegisterClassEx(&wc)) {MessageBox(NULL, _T("RegisterClassEx - failed"), _T("Error"), MB_OK | MB_ICONERROR);return FALSE;}HWND hWnd = CreateWindowEx(WS_EX_APPWINDOW, szAppName, wcWndName,WS_VISIBLE | WS_POPUP, 200, 150, w, h,NULL, NULL, hThisInst, NULL);if(!hWnd) {MessageBox(NULL, _T("CreateWindowEx - failed"), _T("Error"), MB_OK | MB_ICONERROR);return FALSE;}DWM_BLURBEHIND bb = {0};HRGN hRgn = CreateRectRgn(0, 0, -1, -1);bb.dwFlags = DWM_BB_ENABLE | DWM_BB_BLURREGION;bb.hRgnBlur = hRgn;bb.fEnable = TRUE;DwmEnableBlurBehindWindow(hWnd, &bb);CreateHGLRC(hWnd);HDC hdc = GetDC(hWnd);wglMakeCurrent(hdc, m_hrc);initSC();resizeSC(w, h);ReleaseDC(hWnd, hdc);MSG msg;  while(1) {if (PeekMessage(&msg, NULL, 0, 0, PM_REMOVE)) {if (msg.message == WM_QUIT)break;TranslateMessage(&msg);DispatchMessage(&msg);}else {HDC hdc = GetDC(hWnd);wglMakeCurrent(hdc, m_hrc);renderSC();SwapBuffers(hdc);ReleaseDC(hWnd, hdc);}} return (FALSE);
}

最终效果:

更多文章:http://blog.csdn.net/what951006
powered by :小乌龟在大乌龟背上~

win32 透明窗口无边框模版相关推荐

  1. 无边框透明窗口设置鼠标穿透与不穿透功能

    一.设置鼠标穿透功能: 1.先设置鼠标穿透.无边框.透明,其中鼠标穿透属性要放在第一个位置设置: this->setAttribute(Qt::WA_TransparentForMouseEve ...

  2. c#中WinForm中拖拽窗体实现移动功能(无边框模态窗体)

    在WindowsForm 应用程序中,如果将窗体的FormBorderStyle属性设置为none,这时,用鼠标拖拽窗体时就无法实现移动的功能了,下面就是解决方案. 在FormBordeStyle属性 ...

  3. 【C++·Qt】Qt透明无边框窗口以及拖动

    窗口透明  1.窗口整体透明(包含其子空控件) //窗口以及子控件都透明 //setAttribute(Qt::WA_WState_WindowOpacitySet); //网上说直接设置不起作用,需 ...

  4. 无边框窗体和用户控件以及权限

    无边框窗体: 就是吧窗体的边框去掉,然后自己做按钮设置功能. 无边框窗体的移动: 将下面代码直接复制粘贴,将窗体的鼠标按下事件的方法改成下面方法的名字就可以直接使用 1 //窗体移动API 2 [Dl ...

  5. python 打开网页、封装自己的浏览器、制作浏览器、打开麦克风和摄像头、忽略ssl证书错误、置顶、无边框

    python 打开网页.封装自己的浏览器 selenium 下载浏览器和浏览器驱动 功能全面,就是不能无边框 pip install selenium from selenium import web ...

  6. QRadioButton分组且无边框的简单实现

    最近在用QT+VS2008做一个项目,涉及到一个综合测评表,说白了有点像问卷调查--很多题目每题若干个选项. 初始时打算用下拉框,每个框中填入所有选项,但后来一琢磨这种方式不够直观与人性化,增添了一步 ...

  7. [C#]无边框窗体缩放的虚线框怎么实现

    protected override void WndProc(ref Message m)   {   switch (m.Msg)   {   case 0xA3://拦截鼠标非客户区左键双击消息 ...

  8. 再谈无边框窗体的操作

    本文介绍操作无边框窗体的其他几个方面的技巧. 设置浮动菜单 通常情况下,在无边框窗体中不能设置菜单.如果在无边框窗体中设置了菜单,运行时窗体上就会出现标题栏.那么,是否在无边框窗体中就不能使用菜单了呢 ...

  9. 无边框窗体移动的方法

    文章目录 1 无边框窗体移动的方法 1.1 无边框窗体移动的方法 1 无边框窗体移动的方法 1.1 无边框窗体移动的方法 当我们把窗体设置为无边框后,会发现用鼠标拖动窗体时是没有反应的,我们需要在窗体 ...

最新文章

  1. R语言泊松回归(poisson)模型案例:基于robust包的Breslow癫痫数据集
  2. IBM超越谷歌抵达量子计算里程碑:研制出50量子位计算机
  3. 数据库操作错误:删除对于用户'root':数据库主体在该数据库中拥有架构,无法删除...
  4. Tuning SQL via case when statement
  5. VTK:可视化之CreateColorSeries
  6. php判断ip地址小程序
  7. import() 动态加载component组件失败
  8. 对未标记为可安全执行的脚本_三、??XSS跨站脚本攻击
  9. Python精通-Python局部变量与全局变量的区别
  10. 大型情感剧集Selenium:2_options设置 #华为云·寻找黑马程序员#
  11. C语言tolower函数介绍、示例和实现
  12. 关闭算法推荐正如刻舟求剑?!
  13. SpringBoot实战教程(1)| 整合Swagger3.0.0
  14. wdatepicker时间段控制
  15. 在centos下安装使用busybox工具箱
  16. hdu 6202 cube cube cube
  17. python入门——快乐的数字
  18. Python中对一个数组各个数进行累加(反差分计算) cumsum()函数
  19. 社会生活中的著名法则
  20. jQuery邮票人 --> 案例

热门文章

  1. 时间格式在ios不兼容的问题
  2. 如何输出一个某种编码的字符串?
  3. python高级教程-2
  4. Django系列(1)-自动化生成API文档
  5. struct所占的内存
  6. Mininet系列实验(三):Mininet命令延伸实验扩展
  7. laragon mysql版本_Laragon下载-Laragon最新免费版-最火软件站
  8. ubuntu文本输入源,找不到中文拼音输入源
  9. MOBLIN SDK项目和目标:使用映像创建者
  10. 自然语言推断(NLI)、文本相似度相关开源项目推荐(Pytorch 实现)