资源简介
使用updatelayeredwindow函数制作出漂亮的窗口,本窗口使用自绘加图片实现。(我要设置成不要积分下载的,或者最低积分)

代码片段和文件信息
#include
#include
//本代码用于建立特殊形状窗口
#pragma comment (lib “GdiPlus.lib“)
using namespace Gdiplus;
LRESULT CALLBACK WndProc(HWND hwnd UINT msg WPARAM wParam LPARAM lParam);
int WINAPI WinMain(HINSTANCE hInstance HINSTANCE hPrevInstance LPSTR szCmdLine int
nCmdShow)
{
TCHAR szAppName[] = TEXT(“Windows程序设计“);
WNDCLASSEX wndClass;
MSG msg;
HWND hwnd;
ULONG_PTR token;
GdiplusStartupInput gin;
wndClass.cbSize = sizeof(WNDCLASSEX);
wndClass.cbClsExtra = 0;
wndClass.cbWndExtra = 0;
wndClass.hbrBackground = (HBRUSH)GetStockobject(WHITE_BRUSH);
wndClass.hCursor = LoadCursor(NULL IDC_ARROW);
wndClass.hIcon = LoadIcon(NULL IDI_APPLICATION);
wndClass.hIconSm = NULL;
wndClass.hInstance = hInstance;
wndClass.lpszClassName = TEXT(“AppTest“);
wndClass.lpszMenuName = NULL;
wndClass.lpfnWndProc = WndProc;
wndClass.style = CS_HREDRAW | CS_VREDRAW | CS_IME | CS_DBLCLKS;
GdiplusStartup(&token &gin NULL);
RegisterClassEx(&wndClass);
hwnd = CreateWindowEx(WS_EX_layerED TEXT(“AppTest“) szAppName WS_CLIPCHILDREN | WS_CLIPSIBLINGS | WS_POPUP/*无边框风格*/
0 0 100 100
NULL NULL hInstance NULL);
//设置本窗口为分层窗口支持透明
//分层窗口没有WM_PAINT消息
ShowWindow(hwnd SW_SHOW);
UpdateWindow(hwnd);
while (GetMessage(&msg NULL 0 0))
{
TranslateMessage(&msg);
DispatchMessage(&msg);
}
GdiplusShutdown(token);
return 0;
}
void CreateRoundRectangle(Rect rc int Round GraphicsPath * gp)
{
gp->AddArc(0 0 Round Round 180 90);
gp->AddLine(Round 0 rc.Width - Round 0);
gp->AddArc(rc.Width - Round 0 Round Round 270 90);
gp->AddLine(rc.Width Round rc.Width rc.Height - Round);
gp->AddArc(rc.Width - Round rc.Height - Round Round Round 0 90);
gp->AddLine(rc.Width - Round rc.Height Round rc.Height);
gp->AddArc(0 rc.Height - Round Round Round 90 90);
}
LRESULT CALLBACK WndProc(HWND hwnd UINT msg WPARAM wParam LPARAM lParam)
{
static BOOL ldown;
static POINT TheFirstPoint;
static int cxClient cyClient;
switch (msg)
{
case WM_SIZE:
cxClient = LOWORD(lParam);
cyClient = HIWORD(lParam);
break;
case WM_LBUTTONDOWN:
ldown = TRUE;
SetCapture(hwnd);//这句代码可以进行容错处理谁知道那次window响应速度慢了你不信?‘-_-‘去掉这句代码试一试
TheFirstPoint.x = LOWORD(lParam);
TheFirstPoint.y = HIWORD(lParam);
break;
case WM_LBUTTONUP:
ldown = FALSE;
ReleaseCapture();
break;
case WM_MOUSEMOVE:
if (ldown)
{
POINT pt;
GetCursorPos(&pt);
pt.x -= TheFirstPoint.x;
pt.y -= TheFirstPoint.y;
SetWindowPos(hwnd NULL pt.x pt.y NULL NULL SWP_NOREDRAW |
SWP_NOSIZE | SWP_NOZORDER);
}
break;
case WM_LBUTTONDBLCLK:
DestroyWindow(hwnd);
case WM_CREATE:
{
Image image(TEXT(“bianping-christmas-2014-12.png“));
//加载窗口图形
int iWidth = image.GetWidth();
int iHeight = image.GetHeight();
HDC hdcScreen = GetDC(NULL);
HDC hdcMem = CreateCompatibleDC(hdcScreen);
HBITMAP hBitma
属性 大小 日期 时间 名称
----------- --------- ---------- ----- ----
目录 0 2015-06-16 17:59 分层窗口\
目录 0 2015-06-15 16:43 分层窗口\Debug\
文件 5420 2014-12-08 14:34 分层窗口\Debug\bianping-christmas-2014-01.png
文件 44032 2015-06-15 16:45 分层窗口\Debug\窗口01.exe
文件 381388 2015-06-15 16:45 分层窗口\Debug\窗口01.ilk
文件 748544 2015-06-15 16:45 分层窗口\Debug\窗口01.pdb
目录 0 2015-06-15 16:47 分层窗口\Release\
文件 182272 2015-06-16 17:56 分层窗口\Release\窗口01.exe
文件 2796544 2015-06-16 17:56 分层窗口\Release\窗口01.pdb
目录 0 2015-06-16 17:59 分层窗口\窗口01\
文件 970 2015-06-15 07:32 分层窗口\窗口01.sln
文件 22528 2015-06-16 17:59 分层窗口\窗口01.v12.suo
文件 5420 2014-12-08 14:34 分层窗口\窗口01\a.png
文件 6632 2014-12-08 14:34 分层窗口\窗口01\bianping-christmas-2014-02.png
文件 5288 2014-12-08 14:34 分层窗口\窗口01\bianping-christmas-2014-03.png
文件 2713 2014-12-08 14:35 分层窗口\窗口01\bianping-christmas-2014-04.png
文件 6728 2014-12-08 14:35 分层窗口\窗口01\bianping-christmas-2014-05.png
文件 4593 2014-12-08 14:35 分层窗口\窗口01\bianping-christmas-2014-06.png
文件 5980 2014-12-08 14:35 分层窗口\窗口01\bianping-christmas-2014-07.png
文件 5750 2014-12-08 14:35 分层窗口\窗口01\bianping-christmas-2014-08.png
文件 7821 2014-12-08 14:35 分层窗口\窗口01\bianping-christmas-2014-09.png
文件 3029 2014-12-08 14:35 分层窗口\窗口01\bianping-christmas-2014-10.png
文件 4948 2014-12-08 14:35 分层窗口\窗口01\bianping-christmas-2014-11.png
文件 8584 2014-12-08 14:35 分层窗口\窗口01\bianping-christmas-2014-12.png
目录 0 2015-06-15 16:45 分层窗口\窗口01\Debug\
文件 5420 2014-12-08 14:34 分层窗口\窗口01\Debug\bianping-christmas-2014-01.png
文件 486400 2015-06-15 16:45 分层窗口\窗口01\Debug\vc120.idb
文件 315392 2015-06-15 16:45 分层窗口\窗口01\Debug\vc120.pdb
文件 57863 2015-06-15 16:45 分层窗口\窗口01\Debug\源.obj
文件 2171 2015-06-15 16:45 分层窗口\窗口01\Debug\窗口01.log
目录 0 2015-06-15 16:45 分层窗口\窗口01\Debug\窗口01.tlog\
............此处省略22个文件信息
相关资源
- 多窗口后台鼠标连点器
- HOOK小工具(进程、窗口、全局)
- pb 实现ean8,ean13,ean39条形码数据窗口
- js实现模态窗口的3种方式
- Delphi中融合Dll中的窗口的解决办法详
- 多窗口后台鼠标连点器.rar
- 易语言取word打开、另存为对话框窗口
- 隐藏任意窗口,轻松老板键
- delphi 自定义消息窗口和进度条窗口,
- 易语言123test源码易语言图形窗口的模
- 易语言液晶定时器源码
- labview获取子窗口句柄FindwindowsEX(AP
- flutter窗口初始和绘制流程详析
- xshell6 个人版解除窗口限制
- 易语言例程简单的注册与登录窗口源
- 易语言GDI绘制文字到窗口源码
- 航天器发射窗口的计算论文
- 易语言淡入淡出窗口模块源码
- 施耐德接触器和断路器窗口宏文件
- 百度地图类库 自定义信息窗口.zip
- QT桌面精灵
- 超屌的 查看windows窗口及其上的按钮等
- 键鼠同步器多窗口同步控制工具v2.1
- 窗口类名对象获取器3合一
-
surfaceview+mediapla
yer实现视频播放和动 - QT+VS点击按钮弹出新窗口的实现
- QT 半透明窗口 面板
- QT自定义窗口 自由拖动 自定义标题
- 万能窗口标题永久修改工具
- 滑动窗口协议模拟.rar
评论
共有 条评论