mouse bitmap
CodeGuru Home VC++ / MFC / C++ .NET / C# Visual Basic VB Forums Developer.com
Results 1 to 3 of 3

Thread: mouse bitmap

Hybrid View

  1. #1
    Join Date
    May 2009
    Posts
    2

    mouse bitmap

    hi,

    I have two screens and i need to copy my mouse to the other screen.
    I tried to use bitblt but this function copy the screen and doesn't copy the mouse.

    can any body help me just to get the bitmap of the mouse and then i can use bitblt ?

    Note: I tried to use GDI+ but when I try to compile I get many errors like:

    c:\program files\microsoft visual studio 8\vc\platformsdk\include\GdiplusImaging.h(67) : error C4430: missing type specifier - int assumed. Note: C++ does not support default-int
    c:\program files\microsoft visual studio 8\vc\platformsdk\include\GdiplusImaging.h(67) : error C2440: 'initializing' : cannot convert from 'const char [37]' to 'int'
    There is no context in which this conversion is possible
    c:\program files\microsoft visual studio 8\vc\platformsdk\include\GdiplusImaging.h(67) : error C2146: syntax error : missing ';' before identifier 'IImageBytes'
    c:\program files\microsoft visual studio 8\vc\platformsdk\include\GdiplusImaging.h(67) : error C2470: 'IImageBytes' : looks like a function definition, but there is no parameter list; skipping apparent body
    c:\program files\microsoft visual studio 8\vc\platformsdk\include\GdiplusImaging.h(67) : error C2059: syntax error : 'public'
    c:\program files\microsoft visual studio 8\vc\platformsdk\include\GdiplusImaging.h(246) : error C2146: syntax error : missing ';' before identifier 'id'
    .....

    and i don't know how to resolve this problem. can you please help me?

  2. #2
    Join Date
    Sep 2004
    Location
    Holland (land of the dope)
    Posts
    4,123

    Re: mouse bitmap

    Code:
    I have two screens and i need to copy my mouse to the other screen.
    Copy your mouse to the other screen... Really haven't got a clue what you mean by that.

    Also... Post some code that generate the errors.

  3. #3
    Join Date
    May 2009
    Posts
    2

    Re: mouse bitmap

    actually i found a code that do exactly what i want but it's a C# code (http://netcode.ru/dotnet/?lang=&katI...264&artID=7239) so i tried to do the same thing in C++ and here is my code:

    #include <windows.h>
    #include <gdiplus.h>

    Private void captureCursor(int* x, int* y)
    {
    BITMAPINFOHEADER bitmapInfo;
    CURSORINFO* cInfo= new CURSORINFO();
    (*cInfo).cbSize=sizeof(*cInfo);
    GetCursorInfo(cInfo);
    if((*cInfo).flags==CURSOR_SHOWING){

    HICON handel =CopyIcon((*cInfo).hCursor);
    ICONINFO icInfo;
    if(GetIconInfo(handel,&icInfo)){
    *x=(*cInfo).ptScreenPos.x - ((int)icInfo.xHotspot);
    *y = (*cInfo).ptScreenPos.y - ((int)icInfo.yHotspot);
    // Icon ic = Icon.FromHandle(handel);
    //bmp = ic.ToBitmap();


    }
    }

    }

    when i got the errors I wanted to do this in another way without using GDI+ but i couldn't find out how?
    I need just the image of the cursor (a bitmap) to copy it in the position I want.

Tags for this Thread

Posting Permissions

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


Windows Mobile Development Center


Click Here to Expand Forum to Full Width

This is a CodeGuru survey question.


Featured


HTML5 Development Center