🚀 go-pugleaf

RetroBBS NetNews Server

Inspired by RockSolid Light RIP Retro Guy

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

Re: How to capture mouse during screen capture

#5823
From: GXxaxx
Date: Wed, 06 Jul 2005 06:08
47 lines
2617 bytes
Well, poking around I found some code that "works?".

Admittedly the code is not exactly as posted in the groups. That was
Delphi and I'm a BCB kinda guy.

    CURSORINFO pci;
    pci.cbSize =  sizeof(pci);
    bool resultgetcursor = GetCursorInfo( &pci );
    if (resultgetcursor) {
        DWORD cbSize = pci.cbSize;
        DWORD flags = pci.flags;
        POINT ptScreenPos = pci.ptScreenPos;
        HCURSOR hCursor = pci.hCursor;
        int xPos = pci.ptScreenPos.x;
        int yPos = pci.ptScreenPos.y;
        xPos -= 10;          // weirdness alert
        yPos -= 10;          // weirdness alert
        xPos = max(0,xPos);
        yPos = max(0,yPos);
        DrawIconEx(
                localBitmap->Canvas->Handle,
                xPos,
                yPos,
                hCursor,
                0,
                0,
                0,
                NULL,
                DI_NORMAL
               );
    }

I can't figure out why the offset in the location of the mouse cursor.
It could be that my "localBitmap->Canvas" is somehow off by 10.
But I don't see any offset in the image. No blank spots in the
corner. So I think there is some kind of offset in the DrawIconEx that
I am not accounting for.

This is totally put together by hunt and peck. So if you happen to
understand what is going on with the 10 pixel offset, I'd appreciate
it.

My main concern is that on different systems the offset will be
different.

Thanks,
Claude
Technical Details
Message-ID: <1120630126.188140.24020@g49g2000cwa.googlegroups.com>
Path: arc1-ca.pugleaf.net!g2news1.google.com!postnews.google.com!g49g2000cwa.googlegroups.com!not-for-mail
References: <1120623626.521876.31490@f14g2000cwb.googlegroups.com>

Show Full Headers
Complete Article Headers
X-Google-Thread: 10cc67,aec7d1ea15dc432f
X-Google-Attributes: gid10cc67,public
X-Google-Language: ENGLISH,ASCII-7-bit
Path: arc1-ca.pugleaf.net!g2news1.google.com!postnews.google.com!g49g2000cwa.googlegroups.com!not-for-mail
From: "GXxaxx" <ggroupss@gmail.com>
Newsgroups: borland.public.cppbuilder.nativeapi
Subject: Re: How to capture mouse during screen capture
Date: 5 Jul 2005 23:08:46 -0700
Organization: http://groups.google.com
Lines: 48
Message-ID: <1120630126.188140.24020@g49g2000cwa.googlegroups.com>
References: <1120623626.521876.31490@f14g2000cwb.googlegroups.com>
NNTP-Posting-Host: 209.79.217.168
Mime-Version: 1.0
Content-Type: text/plain; charset="iso-8859-1"
X-Trace: posting.google.com 1120630130 25545 127.0.0.1 (6 Jul 2005 06:08:50 GMT)
X-Complaints-To: groups-abuse@google.com
NNTP-Posting-Date: Wed, 6 Jul 2005 06:08:50 +0000 (UTC)
In-Reply-To: <1120623626.521876.31490@f14g2000cwb.googlegroups.com>
User-Agent: G2/0.2
Complaints-To: groups-abuse@google.com
Injection-Info: g49g2000cwa.googlegroups.com; posting-host=209.79.217.168;
   posting-account=oRYZjQ0AAACo5_sHtMcufEiCIxu0J1sE