14 Windows编程——SetWindowLong
使用默认窗口处理函数,源码
#include<Windows.h>
#include<Windowsx.h> LRESULT CALLBACK WindProc(HWND hwnd, UINT message, WPARAM wParam, LPARAM lParam);
LRESULT CALLBACK MyProc(HWND hwnd, UINT message, WPARAM wParam, LPARAM lParam); int WinMain(HINSTANCE hInst, HINSTANCE tmp, LPSTR szCmd, int nShow)
{
WNDCLASS WndClass;
TCHAR* ClassName = TEXT("MyClass");
HWND hwnd;
MSG msg;
HBRUSH hBrush = CreateSolidBrush(RGB(, , )); WndClass.cbClsExtra = ;
WndClass.cbWndExtra = ;
WndClass.hbrBackground = hBrush;
WndClass.hCursor = LoadCursor(NULL, IDC_ARROW);
WndClass.hIcon = LoadIcon(NULL, IDI_APPLICATION);
WndClass.hInstance = hInst;
WndClass.lpfnWndProc = WindProc;
WndClass.lpszClassName = ClassName;
WndClass.lpszMenuName = NULL;
WndClass.style = CS_VREDRAW | CS_HREDRAW; if (!RegisterClass(&WndClass))
{
MessageBox(NULL, TEXT("Gegister Class Fail!!"), TEXT("error"), MB_OK);
return ;
} //CreateWindow返回之前,会发送WM_CREATE消息
hwnd = CreateWindow(ClassName, TEXT("Hello"), WS_OVERLAPPEDWINDOW, CW_USEDEFAULT, CW_USEDEFAULT, , , NULL, NULL, hInst, NULL);
if (hwnd == NULL)
{
MessageBox(NULL, TEXT("Create Window Fail!!"), TEXT("error"), MB_OK);
return ;
}
ShowWindow(hwnd, nShow);
UpdateWindow(hwnd); while (GetMessage(&msg, NULL, , ))
{
TranslateMessage(&msg);
DispatchMessage(&msg);
} return ;
} LRESULT CALLBACK WindProc(HWND hwnd, UINT message, WPARAM wParam, LPARAM lParam)
{
PAINTSTRUCT pt;
static int cx, cy;
HDC hdc;
HBRUSH hBrush = CreateSolidBrush(RGB(, , ));
switch (message)
{
case WM_CREATE:
//SetWindowLong(hwnd, GWL_WNDPROC, (LONG)MyProc);
return ;
case WM_SIZE:
cx = LOWORD(lParam);
cy = HIWORD(lParam);
return ;
case WM_PAINT:
hdc = BeginPaint(hwnd, &pt);
HBRUSH hBrush = CreateSolidBrush(RGB(,,));
SelectObject(hdc, hBrush);
Rectangle(hdc, , , cx/, cy/);
DeleteObject(hBrush);
EndPaint(hwnd, &pt);
return ;
case WM_DESTROY:
PostQuitMessage();
return ;
default:
break;
} return DefWindowProc(hwnd, message, wParam, lParam);
} LRESULT CALLBACK MyProc(HWND hwnd, UINT message, WPARAM wParam, LPARAM lParam)
{
PAINTSTRUCT ps;
HDC hdc;
static int cx, cy; switch (message)
{
case WM_SIZE:
cx = LOWORD(lParam);
cy = HIWORD(lParam);
return ;
case WM_PAINT:
hdc = BeginPaint(hwnd, &ps); EndPaint(hwnd, &ps);
return ;
default:
break;
}
return DefWindowProc(hwnd, message, wParam, lParam);
}
运行结果(只能使用Alt+F4关闭):

使用SetWindowLong替换窗户口处理函数,源码
#include<Windows.h>
#include<Windowsx.h> LRESULT CALLBACK WindProc(HWND hwnd, UINT message, WPARAM wParam, LPARAM lParam);
LRESULT CALLBACK MyProc(HWND hwnd, UINT message, WPARAM wParam, LPARAM lParam); int WinMain(HINSTANCE hInst, HINSTANCE tmp, LPSTR szCmd, int nShow)
{
WNDCLASS WndClass;
TCHAR* ClassName = TEXT("MyClass");
HWND hwnd;
MSG msg;
HBRUSH hBrush = CreateSolidBrush(RGB(, , )); WndClass.cbClsExtra = ;
WndClass.cbWndExtra = ;
WndClass.hbrBackground = hBrush;
WndClass.hCursor = LoadCursor(NULL, IDC_ARROW);
WndClass.hIcon = LoadIcon(NULL, IDI_APPLICATION);
WndClass.hInstance = hInst;
WndClass.lpfnWndProc = WindProc;
WndClass.lpszClassName = ClassName;
WndClass.lpszMenuName = NULL;
WndClass.style = CS_VREDRAW | CS_HREDRAW; if (!RegisterClass(&WndClass))
{
MessageBox(NULL, TEXT("Gegister Class Fail!!"), TEXT("error"), MB_OK);
return ;
} //CreateWindow返回之前,会发送WM_CREATE消息
hwnd = CreateWindow(ClassName, TEXT("Hello"), WS_OVERLAPPEDWINDOW, CW_USEDEFAULT, CW_USEDEFAULT, , , NULL, NULL, hInst, NULL);
if (hwnd == NULL)
{
MessageBox(NULL, TEXT("Create Window Fail!!"), TEXT("error"), MB_OK);
return ;
}
ShowWindow(hwnd, nShow);
UpdateWindow(hwnd); while (GetMessage(&msg, NULL, , ))
{
TranslateMessage(&msg);
DispatchMessage(&msg);
} return ;
} LRESULT CALLBACK WindProc(HWND hwnd, UINT message, WPARAM wParam, LPARAM lParam)
{
PAINTSTRUCT pt;
static int cx, cy;
HDC hdc;
HBRUSH hBrush = CreateSolidBrush(RGB(, , ));
switch (message)
{
case WM_CREATE:
SetWindowLong(hwnd, GWL_WNDPROC, (LONG)MyProc);
return ;
case WM_SIZE:
cx = LOWORD(lParam);
cy = HIWORD(lParam);
return ;
case WM_PAINT:
hdc = BeginPaint(hwnd, &pt);
HBRUSH hBrush = CreateSolidBrush(RGB(,,));
SelectObject(hdc, hBrush);
Rectangle(hdc, , , cx/, cy/);
DeleteObject(hBrush);
EndPaint(hwnd, &pt);
return ;
case WM_DESTROY:
PostQuitMessage();
return ;
default:
break;
} return DefWindowProc(hwnd, message, wParam, lParam);
} LRESULT CALLBACK MyProc(HWND hwnd, UINT message, WPARAM wParam, LPARAM lParam)
{
PAINTSTRUCT ps;
HDC hdc;
static int cx, cy; switch (message)
{
case WM_SIZE:
cx = LOWORD(lParam);
cy = HIWORD(lParam);
return ;
case WM_PAINT:
hdc = BeginPaint(hwnd, &ps);
HBRUSH hBrush = CreateSolidBrush(RGB(, , ));
SelectObject(hdc, hBrush);
Rectangle(hdc, cx / , cy / , cx, cy);
DeleteObject(hBrush);
EndPaint(hwnd, &ps);
return ;
default:
break;
}
return DefWindowProc(hwnd, message, wParam, lParam);
}
运行结果:

使用SetWindowLong接管原来窗口处理函数后,把WM_PAINT消息先在MyProc处理一次 ,然后交给原来的窗口处理函数再处理一次。但是发现并没有绘制出原来窗口处理函数绘制的图形
#include<Windows.h>
#include<Windowsx.h> LRESULT CALLBACK WindProc(HWND hwnd, UINT message, WPARAM wParam, LPARAM lParam);
LRESULT CALLBACK MyProc(HWND hwnd, UINT message, WPARAM wParam, LPARAM lParam); int WinMain(HINSTANCE hInst, HINSTANCE tmp, LPSTR szCmd, int nShow)
{
WNDCLASS WndClass;
TCHAR* ClassName = TEXT("MyClass");
HWND hwnd;
MSG msg;
HBRUSH hBrush = CreateSolidBrush(RGB(, , )); WndClass.cbClsExtra = ;
WndClass.cbWndExtra = ;
WndClass.hbrBackground = hBrush;
WndClass.hCursor = LoadCursor(NULL, IDC_ARROW);
WndClass.hIcon = LoadIcon(NULL, IDI_APPLICATION);
WndClass.hInstance = hInst;
WndClass.lpfnWndProc = WindProc;
WndClass.lpszClassName = ClassName;
WndClass.lpszMenuName = NULL;
WndClass.style = CS_VREDRAW | CS_HREDRAW; if (!RegisterClass(&WndClass))
{
MessageBox(NULL, TEXT("Gegister Class Fail!!"), TEXT("error"), MB_OK);
return ;
} //CreateWindow返回之前,会发送WM_CREATE消息
hwnd = CreateWindow(ClassName, TEXT("Hello"), WS_OVERLAPPEDWINDOW, CW_USEDEFAULT, CW_USEDEFAULT, , , NULL, NULL, hInst, NULL);
if (hwnd == NULL)
{
MessageBox(NULL, TEXT("Create Window Fail!!"), TEXT("error"), MB_OK);
return ;
}
ShowWindow(hwnd, nShow);
UpdateWindow(hwnd); while (GetMessage(&msg, NULL, , ))
{
TranslateMessage(&msg);
DispatchMessage(&msg);
} return ;
} LRESULT CALLBACK WindProc(HWND hwnd, UINT message, WPARAM wParam, LPARAM lParam)
{
PAINTSTRUCT pt;
static int cx, cy;
HDC hdc;
HBRUSH hBrush = CreateSolidBrush(RGB(, , ));
switch (message)
{
case WM_CREATE:
SetWindowLong(hwnd, GWL_WNDPROC, (LONG)MyProc);
return ;
case WM_SIZE:
cx = LOWORD(lParam);
cy = HIWORD(lParam);
return ;
case WM_PAINT:
hdc = BeginPaint(hwnd, &pt);
HBRUSH hBrush = CreateSolidBrush(RGB(,,));
SelectObject(hdc, hBrush);
Rectangle(hdc, , , cx/, cy/);
DeleteObject(hBrush);
EndPaint(hwnd, &pt);
return ;
case WM_DESTROY:
PostQuitMessage();
return ;
default:
break;
} return DefWindowProc(hwnd, message, wParam, lParam);
} LRESULT CALLBACK MyProc(HWND hwnd, UINT message, WPARAM wParam, LPARAM lParam)
{
PAINTSTRUCT ps;
HDC hdc;
static int cx, cy; switch (message)
{
case WM_SIZE:
cx = LOWORD(lParam);
cy = HIWORD(lParam);
return ;
case WM_PAINT:
hdc = BeginPaint(hwnd, &ps);
HBRUSH hBrush = CreateSolidBrush(RGB(, , ));
SelectObject(hdc, hBrush);
Rectangle(hdc, cx / , cy / , cx, cy);
DeleteObject(hBrush);
EndPaint(hwnd, &ps);
//return 0;
break;
default:
break;
}
return WindProc(hwnd, message, wParam, lParam);
}
经调试,发现WindProc函数中WM_PAINT消息,cx=0,cy=0。绘制了,只不过绘制的矩形坐标时( 0 0 0 0),修改如下
方式① 源码
#include<Windows.h>
#include<Windowsx.h> LRESULT CALLBACK WindProc(HWND hwnd, UINT message, WPARAM wParam, LPARAM lParam);
LRESULT CALLBACK MyProc(HWND hwnd, UINT message, WPARAM wParam, LPARAM lParam); int WinMain(HINSTANCE hInst, HINSTANCE tmp, LPSTR szCmd, int nShow)
{
WNDCLASS WndClass;
TCHAR* ClassName = TEXT("MyClass");
HWND hwnd;
MSG msg;
HBRUSH hBrush = CreateSolidBrush(RGB(, , )); WndClass.cbClsExtra = ;
WndClass.cbWndExtra = ;
WndClass.hbrBackground = hBrush;
WndClass.hCursor = LoadCursor(NULL, IDC_ARROW);
WndClass.hIcon = LoadIcon(NULL, IDI_APPLICATION);
WndClass.hInstance = hInst;
WndClass.lpfnWndProc = WindProc;
WndClass.lpszClassName = ClassName;
WndClass.lpszMenuName = NULL;
WndClass.style = CS_VREDRAW | CS_HREDRAW; if (!RegisterClass(&WndClass))
{
MessageBox(NULL, TEXT("Gegister Class Fail!!"), TEXT("error"), MB_OK);
return ;
} //CreateWindow返回之前,会发送WM_CREATE消息
hwnd = CreateWindow(ClassName, TEXT("Hello"), WS_OVERLAPPEDWINDOW, CW_USEDEFAULT, CW_USEDEFAULT, , , NULL, NULL, hInst, NULL);
if (hwnd == NULL)
{
MessageBox(NULL, TEXT("Create Window Fail!!"), TEXT("error"), MB_OK);
return ;
}
ShowWindow(hwnd, nShow);
UpdateWindow(hwnd); while (GetMessage(&msg, NULL, , ))
{
TranslateMessage(&msg);
DispatchMessage(&msg);
} return ;
} LRESULT CALLBACK WindProc(HWND hwnd, UINT message, WPARAM wParam, LPARAM lParam)
{
PAINTSTRUCT pt;
static int cx, cy;
HDC hdc;
HBRUSH hBrush = CreateSolidBrush(RGB(, , ));
switch (message)
{
case WM_CREATE:
SetWindowLong(hwnd, GWL_WNDPROC, (LONG)MyProc);
return ;
case WM_SIZE:
cx = LOWORD(lParam);
cy = HIWORD(lParam);
return ;
case WM_PAINT:
InvalidateRect(hwnd, NULL, FALSE);
hdc = BeginPaint(hwnd, &pt);
HBRUSH hBrush = CreateSolidBrush(RGB(, , ));
SelectObject(hdc, hBrush);
Rectangle(hdc, , , cx / , cy / );
DeleteObject(hBrush);
EndPaint(hwnd, &pt);
return ;
case WM_DESTROY:
PostQuitMessage();
return ;
default:
break;
} return DefWindowProc(hwnd, message, wParam, lParam);
} LRESULT CALLBACK MyProc(HWND hwnd, UINT message, WPARAM wParam, LPARAM lParam)
{
PAINTSTRUCT ps;
HDC hdc;
static int cx, cy; switch (message)
{
case WM_SIZE:
cx = LOWORD(lParam);
cy = HIWORD(lParam);
break;
case WM_PAINT:
hdc = BeginPaint(hwnd, &ps);
HBRUSH hBrush = CreateSolidBrush(RGB(, , ));
SelectObject(hdc, hBrush);
Rectangle(hdc, cx / , cy / , cx, cy);
DeleteObject(hBrush);
EndPaint(hwnd, &ps);
break;
default:
break;
}
return WindProc(hwnd, message, wParam, lParam);
}
方式② 源码
#include<Windows.h>
#include<Windowsx.h> LRESULT CALLBACK WindProc(HWND hwnd, UINT message, WPARAM wParam, LPARAM lParam);
LRESULT CALLBACK MyProc(HWND hwnd, UINT message, WPARAM wParam, LPARAM lParam); int WinMain(HINSTANCE hInst, HINSTANCE tmp, LPSTR szCmd, int nShow)
{
WNDCLASS WndClass;
TCHAR* ClassName = TEXT("MyClass");
HWND hwnd;
MSG msg;
HBRUSH hBrush = CreateSolidBrush(RGB(, , )); WndClass.cbClsExtra = ;
WndClass.cbWndExtra = ;
WndClass.hbrBackground = hBrush;
WndClass.hCursor = LoadCursor(NULL, IDC_ARROW);
WndClass.hIcon = LoadIcon(NULL, IDI_APPLICATION);
WndClass.hInstance = hInst;
WndClass.lpfnWndProc = WindProc;
WndClass.lpszClassName = ClassName;
WndClass.lpszMenuName = NULL;
WndClass.style = CS_VREDRAW | CS_HREDRAW; if (!RegisterClass(&WndClass))
{
MessageBox(NULL, TEXT("Gegister Class Fail!!"), TEXT("error"), MB_OK);
return ;
} //CreateWindow返回之前,会发送WM_CREATE消息
hwnd = CreateWindow(ClassName, TEXT("Hello"), WS_OVERLAPPEDWINDOW, CW_USEDEFAULT, CW_USEDEFAULT, , , NULL, NULL, hInst, NULL);
if (hwnd == NULL)
{
MessageBox(NULL, TEXT("Create Window Fail!!"), TEXT("error"), MB_OK);
return ;
}
ShowWindow(hwnd, nShow);
UpdateWindow(hwnd); while (GetMessage(&msg, NULL, , ))
{
TranslateMessage(&msg);
DispatchMessage(&msg);
} return ;
} LRESULT CALLBACK WindProc(HWND hwnd, UINT message, WPARAM wParam, LPARAM lParam)
{
PAINTSTRUCT pt;
static int cx, cy;
HDC hdc;
RECT rect;
HBRUSH hBrush = CreateSolidBrush(RGB(, , ));
switch (message)
{
case WM_CREATE:
SetWindowLong(hwnd, GWL_WNDPROC, (LONG)MyProc);
return ;
case WM_SIZE:
cx = LOWORD(lParam);
cy = HIWORD(lParam);
return ;
case WM_PAINT:
rect.left = ;
rect.bottom = cy / ;
rect.right = cx / ;
rect.top = ;
InvalidateRect(hwnd, &rect, TRUE);
hdc = BeginPaint(hwnd, &pt);
HBRUSH hBrush = CreateSolidBrush(RGB(,,));
SelectObject(hdc, hBrush);
Rectangle(hdc, , , cx/, cy/);
DeleteObject(hBrush);
EndPaint(hwnd, &pt);
return ;
case WM_DESTROY:
PostQuitMessage();
return ;
default:
break;
} return DefWindowProc(hwnd, message, wParam, lParam);
} LRESULT CALLBACK MyProc(HWND hwnd, UINT message, WPARAM wParam, LPARAM lParam)
{
PAINTSTRUCT ps;
HDC hdc;
static int cx, cy; switch (message)
{
case WM_SIZE:
cx = LOWORD(lParam);
cy = HIWORD(lParam);
break;
case WM_PAINT:
hdc = BeginPaint(hwnd, &ps);
HBRUSH hBrush = CreateSolidBrush(RGB(, , ));
SelectObject(hdc, hBrush);
Rectangle(hdc, cx / , cy / , cx, cy);
DeleteObject(hBrush);
EndPaint(hwnd, &ps);
break;
default:
break;
}
return WindProc(hwnd, message, wParam, lParam);
}
运行结果:

借助SetWindowLong创建白板窗口
源码
#include<Windows.h>
#include<Windowsx.h> LRESULT CALLBACK WindProc(HWND hwnd, UINT message, WPARAM wParam, LPARAM lParam);
LRESULT CALLBACK MyProc(HWND hwnd, UINT message, WPARAM wParam, LPARAM lParam); int WinMain(HINSTANCE hInst, HINSTANCE tmp, LPSTR szCmd, int nShow)
{
WNDCLASS WndClass;
TCHAR* ClassName = TEXT("MyClass");
HWND hwnd;
MSG msg;
HBRUSH hBrush = CreateSolidBrush(RGB(, , )); WndClass.cbClsExtra = ;
WndClass.cbWndExtra = ;
WndClass.hbrBackground = hBrush;
WndClass.hCursor = LoadCursor(NULL, IDC_ARROW);
WndClass.hIcon = LoadIcon(NULL, IDI_APPLICATION);
WndClass.hInstance = hInst;
WndClass.lpfnWndProc = WindProc;
WndClass.lpszClassName = ClassName;
WndClass.lpszMenuName = NULL;
WndClass.style = CS_VREDRAW | CS_HREDRAW; if (!RegisterClass(&WndClass))
{
MessageBox(NULL, TEXT("Gegister Class Fail!!"), TEXT("error"), MB_OK);
return ;
} //CreateWindow返回之前,会发送WM_CREATE消息
hwnd = CreateWindow(ClassName, TEXT("Hello"), WS_OVERLAPPEDWINDOW, CW_USEDEFAULT, CW_USEDEFAULT, , , NULL, NULL, hInst, NULL);
if (hwnd == NULL)
{
MessageBox(NULL, TEXT("Create Window Fail!!"), TEXT("error"), MB_OK);
return ;
}
ShowWindow(hwnd, nShow);
UpdateWindow(hwnd); while (GetMessage(&msg, NULL, , ))
{
TranslateMessage(&msg);
DispatchMessage(&msg);
} return ;
} LRESULT CALLBACK WindProc(HWND hwnd, UINT message, WPARAM wParam, LPARAM lParam)
{
PAINTSTRUCT pt;
static int cx, cy;
HDC hdc;
RECT rect;
HBRUSH hBrush = CreateSolidBrush(RGB(, , ));
switch (message)
{
case WM_CREATE:
SetWindowLong(hwnd, GWL_STYLE, (LONG)WS_POPUP);
return ;
case WM_SIZE:
cx = LOWORD(lParam);
cy = HIWORD(lParam);
return ;
case WM_PAINT:
rect.left = ;
rect.bottom = cy / ;
rect.right = cx / ;
rect.top = ;
InvalidateRect(hwnd, &rect, TRUE);
hdc = BeginPaint(hwnd, &pt);
HBRUSH hBrush = CreateSolidBrush(RGB(,,));
SelectObject(hdc, hBrush);
Rectangle(hdc, , , cx/, cy/);
DeleteObject(hBrush);
EndPaint(hwnd, &pt);
return ;
case WM_DESTROY:
PostQuitMessage();
return ;
default:
break;
} return DefWindowProc(hwnd, message, wParam, lParam);
} LRESULT CALLBACK MyProc(HWND hwnd, UINT message, WPARAM wParam, LPARAM lParam)
{
PAINTSTRUCT ps;
HDC hdc;
static int cx, cy; switch (message)
{
case WM_SIZE:
cx = LOWORD(lParam);
cy = HIWORD(lParam);
break;
case WM_PAINT:
hdc = BeginPaint(hwnd, &ps);
HBRUSH hBrush = CreateSolidBrush(RGB(, , ));
SelectObject(hdc, hBrush);
Rectangle(hdc, cx / , cy / , cx, cy);
DeleteObject(hBrush);
EndPaint(hwnd, &ps);
break;
default:
break;
}
return WindProc(hwnd, message, wParam, lParam);
}
运行结果

14 Windows编程——SetWindowLong的更多相关文章
- 【Windows编程】系列第十一篇:多文档界面框架
前面我们所举的例子中都是单文档界面框架,也就是说这个窗口里面的客户区就是一个文档界面,可以编写程序在里面输入或者绘制文本和图形输出,但是不能有出现多个文档的情况.比如下面的UltraEdit就是一个典 ...
- windows 编程—— 宽字符集 与 Unicode
目录: 从ASCII码 到 Unicode Windows 编程中的 "字符” 定义 (如何在windows下进行通用编码) 常用的通用函数,定义 (本文为学习<Programming ...
- windows编程 进程的创建销毁和分析
Windows程序设计:进程 进程是一个具有一定独立功能的程序关于某个数据集合的一次运行活动,在Windows编程环境下,主要由两大元素组成: • 一个是操作系统用来管理进程的内核对象.操作系统使用内 ...
- MoreWindows 微软认证专家博客目录(白话算法,C++ STL,windows编程)
为了方便大家查找和学习,现将本人博客中所有博客文章列出目录. (http://blog.csdn.net/morewindows) 一. 白话经典算法 目前有17篇,分为七大排序和经典面试题 ...
- Windows编程 Windows程序的生与死(中)
<pre style=""><pre class="cpp" name="code">1 #include < ...
- Windows编程 Windows程序的生与死(上)
引子 “Windows 程序分为‘程序代码’和‘UI(User Interface)资源’两大部份,两部份最后以RC编译器(资源编译器)整合为一个完整的EXE 文件.所谓UI 资源是指功能菜单.对话框 ...
- 资源在windows编程中的应用----菜单
资源在Windows编程中的应用 资源 加速键.位图.光标.对话框.菜单.字符串.工具条 1.菜单的创建 菜单由以下组成部分: (1)窗口主菜单条 (2)下拉式菜单框 (3)菜单项热键标识 (4)菜单 ...
- 【Windows编程】系列第六篇:创建Toolbar与Statusbar
上一篇我们学习了解了如何使用Windows GDI画图,该应用程序都是光光的静态窗口,我们使用Windows应用程序,但凡稍微复杂一点的程序都会有工具栏和状态栏,工具栏主要用于一些快捷功能按钮.比如典 ...
- 【Windows编程】系列第十篇:文本插入符
大家知道,在使用微软的编程环境创建工程时会让你选择是控制台模式还是Windows应用程序.如果选择控制台的console模式,就会在运行时出现一个黑洞洞的字符模式窗口,里面就有等待输入一闪一闪的插入符 ...
随机推荐
- 一份 Tomcat 和 JVM 的性能调优经验总结!拿走不谢
Tomcat性能调优 找到Tomcat根目录下的conf目录,修改server.xml文件的内容.对于这部分的调优,我所了解到的就是无非设置一下Tomcat服务器的最大并发数和Tomcat初始化时创建 ...
- 【docker 镜像源】解决quay.io和gcr.io国内无法访问的问题
该问题容易导致image pull back off 错误,应当换源: 微软: https://yeasy.gitbooks.io/docker_practice/install/mirror.htm ...
- 【ssh连接docker container问题】
在向docker container执行ssh或scp的时候,应该将docker container的22端口映射出来,然后ssh/scp命令指定映射出来的端口
- etcd学习之安装与命令
ETCD学习 下载etcd #下载 wget https://github.com/etcd-io/etcd/releases/download/v3.3.18/etcd-v3.3.18-linux- ...
- 集合运算 & 聚合函数
SQL 查询之集合运算 & 聚合函数 1.集合运算 1.1.并集运算 UNION 1.2.差集运算 EXCEPT 1.3.交集运算 INTERSECT 1.4.集合运算小结 2.聚合函数 ...
- Action<T>和Func<T>委托事例
Action<T>和Func<T>委托事例 using System; //除了为每个参数和返回类型定义一个新委托类型之外,还可以使用Action<T>和Func& ...
- poj3660(floyd最短路)
题目链接:https://vjudge.net/problem/POJ-3660 题意:给出一个有向图,n个结点,每个结点的权值为[1,n]中的一个独特数字,m条边,如果存在边a->b,说明a的 ...
- Python 绘图库Matplotlib入门教程
0 简单介绍 Matplotlib是一个Python语言的2D绘图库,它支持各种平台,并且功能强大,能够轻易绘制出各种专业的图像. 1 安装 pip install matplotlib 2 入门代码 ...
- 使用keepalived实现kubenetes apiserver高可用
# 安装 nginx yum install nginx -y # 配置nginx4层代理 /etc/nginx/nginx.conf stream { upstream kube-apiserver ...
- WUSTOJ 1323: Repeat Number(Java)规律统计
题目链接:1323: Repeat Number Description Definition: a+b = c, if all the digits of c are same ( c is mor ...