Results 1 to 3 of 3

Thread: ClipCursor??

  1. #1

    Thread Starter
    Frenzied Member Vlatko's Avatar
    Join Date
    Aug 2000
    Location
    Skopje, Macedonia
    Posts
    1,409
    How Can i use the ClipCursor Function to make the cursor movement area the same as my app's RECT;

    When I try this code:


    typedef struct _RECT {
    LONG left;
    LONG top;
    LONG right;
    LONG bottom;
    } RECT;
    RECT r;
    GetWindowRect((LPRECT)&r);
    ClipCursor(r);


    VC++ says this:
    error C2664: 'ClipCursor' : cannot convert parameter 1 from 'struct CHahaDlg::OnInitDialog::_RECT' to 'const struct tagRECT *'
    I am become death, the destroyer of worlds.
    mail:[email protected]

    • Visual Basic 6.0 & .NET
    • Visual C++ 6.0 & .NET
    • ASP
    • LISP
    • PROLOG
    • C
    • Pascal

  2. #2
    Guest
    RECT is already defined so you don't need to create another structure. The following example should work.
    Code:
    void CSubTestDlg::OnButton1() 
    {
    	RECT* rc;
    	GetWindowRect(rc);
    	ClipCursor(rc);
    }

  3. #3
    Monday Morning Lunatic parksie's Avatar
    Join Date
    Mar 2000
    Location
    Mashin' on the motorway
    Posts
    8,169
    Megatron - your code will cause it to choke (the pointer hasn't been initialised). Use this instead:
    Code:
    void CSubTestDlg::OnButton1() {
    	RECT rc;
    	GetWindowRect(&rc);
    	ClipCursor(&rc);
    }
    I refuse to tie my hands behind my back and hear somebody say "Bend Over, Boy, Because You Have It Coming To You".
    -- Linus Torvalds

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  



Click Here to Expand Forum to Full Width