用VFP如何监控鼠标形状的变化?
当鼠标由箭头变为沙漏时进行提醒(包括鼠标在其他程序的窗口中)
[解决办法]
保存鼠标形状
这里只是再表单显示一下
没有保存到文件中
*!*typedef struct tagPOINT {
*!* LONG x;
*!* LONG y;
*!*} POINT, *PPOINT;
*!*typedef struct {
*!* DWORD cbSize;
*!* DWORD flags;
*!* HCURSOR hCursor;
*!* POINT ptScreenPos;
*!*} CURSORINFO, *PCURSORINFO, *LPCURSORINFO;
ts = Chr(20) + Replicate(Chr(0), 16)
*!* typedef struct tagPAINTSTRUCT {
*!* HDC hdc;
*!* BOOL fErase;
*!* RECT rcPaint;
*!* BOOL fRestore;
*!* BOOL fIncUpdate;
*!* BYTE rgbReserved[32];
*!* } PAINTSTRUCT, *PPAINTSTRUCT;
ps = Replicate(Chr(0),68)
*!* typedef struct tagRECT {
*!* LONG left;
*!* LONG top;
*!* LONG right;
*!* LONG bottom;
*!* } RECT, *PRECT, NEAR *NPRECT, FAR *LPRECT;
tagRect = Replicate(Chr(0),16)
Declare GetClientRect In user32 Long hWnd, ;
String @lpRect
Declare Long CopyIcon In user32 Long
Declare Long DrawIcon In user32 Long, Long, Long,Long
Declare Long DestroyCursor In user32 Long
Declare Long GetCursorInfo In user32 string @
Declare Long BeginPaint In user32 Long hwnd, ;
String @lpPaint
Declare Long EndPaint In user32 Long hwnd, ;
String @lpPaint
GetCursorInfo(@ts)
Local iCursor as Long
iCursor = CopyIcon(Ctobin(Substr(ts,9,4),'4rs'))
hdc = 0
?hdc
hdc = BeginPaint(thisform.HWnd,@ps)
GetClientRect(thisform.HWnd, @tagRect)
DrawIcon(hdc,10,10,iCursor)
EndPaint(hdc,@ps)