求帮助:怎么在窗口的层次上操作鼠标光标

求帮助:如何在窗口的层次上操作鼠标光标
就是创建两个窗口,使两个窗口内的鼠标光标设置不同,必须在鼠标从一个窗口上移动到另一个窗口时,跟踪和变换光标
 #define WIN32_LEAN_AND_MEAN //just say no to MFC
 #include <windows.h>
 #include <windowsx.h>
 #include <stdio.h>
 #include<math.h>
 #include "resource.h"
 
#define WINDOW_CLASS_NAME "WINCLASS1"
 

LRESULT CALLBACK WindowProc(HWND hwnd,
  UINT msg,
  WPARAM wparam,
  LPARAM lparam)
 {
  PAINTSTRUCT ps;
  HDC hdc;
  static int count=0;
  switch(msg)
  {
  case WM_CREATE:
  {
  count++;
  return(0);
  }break;
  case WM_PAINT:
  {
  hdc=BeginPaint(hwnd,&ps);
  EndPaint(hwnd,&ps);
  return(0);
  }break;
  case WM_DESTROY:
  {
  count--;
  if(count==0)
  PostQuitMessage(0);
  return (0);
  }break;
  default :break;
  }
  return(DefWindowProc(hwnd,msg,wparam,lparam));
 }
 int WINAPI WinMain(HINSTANCE hinstance,
  HINSTANCE hprevinstance,
  LPSTR lpcmdline,
  int ncmdshow)
 {
  WNDCLASSEX winclass,winclass2;
  HWND hwnd ,hwnd2;
  MSG msg;
  //窗口类的一些信息
  winclass.cbSize=sizeof(WNDCLASSEX);
  winclass.style =CS_DBLCLKS|CS_HREDRAW|CS_OWNDC|CS_VREDRAW;
  winclass.lpfnWndProc=WindowProc;
  winclass.cbClsExtra=0;
  winclass.cbWndExtra=0;
  winclass.hInstance =hinstance;
  winclass.hIcon=LoadIcon(NULL,MAKEINTRESOURCE(IDI_ICON1));
  winclass.hCursor =LoadCursor(NULL,MAKEINTRESOURCE(IDC_CURSOR1));
  winclass.hbrBackground =(HBRUSH)GetStockObject(BLACK_BRUSH);
  winclass.hIconSm=LoadIcon(NULL,MAKEINTRESOURCE(IDI_ICON1));
  winclass.lpszMenuName=NULL;
  winclass.lpszClassName="WINCLASS1";
  winclass.hIconSm =LoadIcon(NULL,IDI_APPLICATION);
  if(!RegisterClassEx(&winclass))
  return(0);
  if(!(hwnd=CreateWindowEx(NULL, //创建窗口1
  WINDOW_CLASS_NAME,
  "MY_BASIC_WINDOW",
  WS_OVERLAPPEDWINDOW | WS_VISIBLE,
  0,0,
  400,400,
  NULL,
  NULL,
  hinstance,
  NULL)))
  return(0);
  if(!(hwnd2=CreateWindowEx(NULL, //创建窗口2
  WINDOW_CLASS_NAME,
  "MY_BASIC_WINDOW2",
  WS_OVERLAPPEDWINDOW | WS_VISIBLE,
  0,0,
  400,400,
  NULL,
  NULL,
  hinstance,
  NULL)))
  return(0);
  while(TRUE)
  {
  if(PeekMessage(&msg,NULL,0,0,PM_REMOVE))
  {
  if(msg.message ==WM_QUIT)
  break;
  TranslateMessage(&msg);
  DispatchMessage(&msg);
  }
  }
  return(msg.wParam);
 
}
 /////////////////////////////////////////
 ////////////////////////////////////////
 已经定义了另个光标IDC_CURSOR2
  HCURSOR hcrosshair=LoadCursor(hinstance,MAKEINTRESOURCE(IDC_CURSOR2));
  SetCursor(hcrosshair);


------解决方案--------------------
窗口类中处理WM_SETCURSOR消息,然后直接return TRUE;
C/C++ code

case WM_SETCURSOR:
            SetCursor(LoadCursor(NULL, IDC_CROSS));
            return TRUE;

------解决方案--------------------
在MOUSEMOVE中检查mouse在哪个窗口,然后SetCursor()