Click here to Skip to main content
15,892,005 members
Please Sign up or sign in to vote.
0.00/5 (No votes)
Hi,

I use custom cursors for dragdrop-operations. In remote desktop sessions only if remote machine runs Win8 the session completely freezes, if the cursor exceeds a certain size.
It works fine, if you work on physical Win8 machine or e.g. Xen Console. Also works fine on RDP with other target operating systems (Win7, Server 2008R2...)

I tried to break down the problem to the most simple case.
In the example below Cursors of 32x32 and 64x64 work fine, 200x200 just dont display anything, 500x500 will freeze everything (system hangs).

I debugged and logged everything, hang occurs _after_ code is completed and cursor is returned.

Can anyone give me some advice in which direction to go, as I'm quite clueless meanwhile. Is there another state-of-the-art way meanwhile to manipulate mouse cursors in winforms applications (i use .net 3.5)?

Thanks!

C#
private void button_Click(object sender, EventArgs e)
{
    //will be 32 from firstbutton, 64 from second, 200 from third, 500 from fourth
    int iCursorSizeFromButton = int.Parse((string)(sender as Button).Tag);

    Bitmap bnew = new Bitmap(iCursorSizeFromButton, iCursorSizeFromButton);
    using (Graphics g = Graphics.FromImage(bnew))
    {
        using (Brush b = new SolidBrush(Color.FromArgb(127, Color.LightBlue)))
        {
            g.FillRectangle(b, new Rectangle(0, 0, bnew.Width, bnew.Height)); //make bitmap for simple custom cursor
            g.DrawEllipse(Pens.Black, new Rectangle(bnew.Width / 2 - 2, bnew.Height / 2 - 2, 4, 4)); //show hotspot, to know how to click
        }
        IntPtr Hicon = bnew.GetHicon();
        Cursor c = new Cursor(Hicon);
        this.Cursor = c;

        //we dont call "extern static bool DestroyIcon(IntPtr handle)" for old cursors in this sample, because it's irrelevant for test
    }
}
Posted

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)



CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900