🚀 go-pugleaf

RetroBBS NetNews Server

Inspired by RockSolid Light RIP Retro Guy

Article View: borland.public.cppbuilder.nativeapi
Article #8809

Re: Stop mouse movement.

#8809
From: Bob Gonder
Date: Fri, 17 Sep 2004 19:44
23 lines
1658 bytes
Bogdan wrote:

>The cursor shouldn't move, but I stiil need the OnMouseMove event handler to
>be called.I've tried reseting the mouse position after every OnMouseMove
>using
>SetCursorPos, but it seems that this function actually calles OnMouseMove
>again,
>and the application crashes with a stack overflow because the event handler
>is
>called continuously.Anybody knows how can I solve this.

Break the recursion. Something like this:

static  bool   recursed = false;
OnMouseMove()
{
    if( ! recursed )	/* stop recursion */
    {    recursed = true;
         if( NewMouseCoord != DesiredCoord )  /* stop infinite loop */
        	SetCursorPosition( DesiredCoord );
         recursed = false;
    };
}
Technical Details
Message-ID: <u7fmk0152t90tbcrmjmgcc5o5d5f6qf2qk@4ax.com>
Path: arc1-ca.pugleaf.net!g2news1.google.com!news1.google.com!news.glorb.com!newsfeed00.sul.t-online.de!newsfeed01.sul.t-online.de!t-online.de!newsgroups.borland.com!not-for-mail
References: <414b3c53@newsgroups.borland.com>

Show Full Headers
Complete Article Headers
X-Google-Thread: 10cc67,4359950ebf6f4b9f
X-Google-Attributes: gid10cc67,public
X-Google-Language: ENGLISH,ASCII-7-bit
From: Bob Gonder <notbg@notmindspring.invalid>
Newsgroups: borland.public.cppbuilder.nativeapi
Subject: Re: Stop mouse movement.
Date: Fri, 17 Sep 2004 12:44:54 -0700
Organization: MindSpring Enterprises, Inc.
Reply-To: notbg@notmindspring.invalid
Message-ID: <u7fmk0152t90tbcrmjmgcc5o5d5f6qf2qk@4ax.com>
References: <414b3c53@newsgroups.borland.com>
X-Newsreader: Forte Agent 1.93/32.576 English (American)
MIME-Version: 1.0
Content-Type: text/plain; charset=us-ascii
Content-Transfer-Encoding: 7bit
NNTP-Posting-Host: 69.69.245.247
X-Trace: newsgroups.borland.com 1095450292 69.69.245.247 (17 Sep 2004 12:44:52 -0700)
Lines: 25
Path: arc1-ca.pugleaf.net!g2news1.google.com!news1.google.com!news.glorb.com!newsfeed00.sul.t-online.de!newsfeed01.sul.t-online.de!t-online.de!newsgroups.borland.com!not-for-mail