关于捕获鼠标当前位置的题目

来源:百度知道 编辑:UC知道 时间:2024/06/18 13:25:29
我现在要创建一个简单的Windows应用程序,用VC++6.0写的,包含一个主窗口,让程序捕获用户的鼠标动作,并且不停地在主窗口坐标(100,200)处打印鼠标当前位置的坐标值。可是我写了之后,那个y坐标显示的总是不对,用MOUSEMOVE写的
好像是因为y的坐标值没有被覆盖掉 但不知道怎么弄

/*------------------------------------------------------------
hellowin.cpp – A framework code of Win32 applications
------------------------------------------------------------*/
#include <windows.h>
#include <STDIO.H>

LRESULT CALLBACK WndProc (HWND, UINT, WPARAM, LPARAM) ;

int WINAPI WinMain (HINSTANCE hInstance,
HINSTANCE hPrevInstance,
PSTR szCmdLine,
int iCmdShow)
{
static char szAppName[] = "HelloWin" ;
HWND hwnd ;
MSG msg ;
WNDCLASS wndclass ;
wndclass.style = CS_HREDRAW | CS_VREDRAW ;
wndclass.lpfnWndProc = WndProc ;
wndclass.cbClsExtra = 0 ;
wndclass.cbWndExtra = 0 ;
wndclass.hInstance = hInstance;
wndclass.hIcon = NULL;
wndclass.hCursor = NULL ;
wndclass.hbrBackground = (HBRUSH)GetStockObje