HWND绑定用户数据

1
2
3
4
5
6
7
hWnd = CreateWindow(...);
SetWindowLongPtr(hWnd, GWLP_USERDATA, (LONG_PTR)12345);
 
LRESULT CALLBACK WndProc(HWND hWnd, UINT message, WPARAM wParam, LPARAM lParam)
{
	LONG_PTR pData = GetWindowLongPtr(hWnd, GWLP_USERDATA);
	...