makeing background form

well i make a program that get mouse X and Y each time the mouse moves on the form
and write it to file ;
i want to make that program " in the background" that still get X and Y but user wont see it he can still work and program still record ;
how can i make thats


Answer this question

makeing background form

  • Emre Çetinkaya

    well i look at the link
    its very helpful but i dont get it how its gets clicks
    Public Function InstallHook() As Boolean
    If _mouseHook = IntPtr.Zero Then
    _mouseProc = New CallBack(AddressOf MouseHookProc)
    _mouseHook = SetWindowsHookExW(WH_MOUSE_LL, _mouseProc, GetModuleHandleW(IntPtr.Zero), 0)
    End If
    Return _mouseHook <> IntPtr.Zero
    End Function

    thats just over what i know in VB.net (argh) i have to learn how to use Declare Functions and thats DLL's
    well how ever i want to gets click from that function thats gets mouse clicks 2


    EDIT :
    well i have found that module
    http://www.developer.com/net/net/print.php/11087_2193301_3
    its supose to Hook the Keybored and the Mouse but how can i use it some1 can take a look

    Tnx Any way

  • Gurmeet

    i mean i want the app still record mouse moves but with me.hide thats make my app stop record .
    i mean i want it record but user can still work .

  • PsyCadelik

    for doing mouse clicks, you may well need to do "hooks", this is not what you initially asked however ;-)

    try the link supplied and see what happens, I'll also see what I can come up with



  • zwp

    the mouse move will only kick in when the form has focus and is moving around the form. The small example I provided above constantly shows the mouse pointer co-ords even if the application does not have focus as it looks at the Cursor (mouse pointer) position anywhere on the screen

  • Boulderdude

    I don't think a Windows Service would be possible for this - which runs in the background btw.

    I guess you can hide the application in systray notification area Would this be a possibility You can hide your application in the background using Me.Hide() but perhaps you like the option to show the application



  • J.B. III

    how can i make it work
    Private Sub Form1_MouseMove(ByVal sender As Object, ByVal e As System.Windows.Forms.MouseEventArgs) Handles Me.MouseMove
    msgbox(e.X & " " & e.Y)
    'thats doesnt work when the from is "Me.Hide()"
    End Sub


    Edit :

    well i will try Tnx

    oh well thats work both way work good !
    tnx
    another lil qustion :
    can i convert Bitamp to String and convert it back

  • shmulik_segal

    can i "Hook" or get Clicks 2
    i doesnt really understand that Declare and Dlls
    how can i use it to get Mouse Clicks


  • allpdoff

    well i think i need to "hook" i will look at this post now
    and thats doesnt work if i use "me.hide"
    anyway thx for posting

  • battlex

    thats not a problem, you can still log the movements to a file or whatever you like. Even if the application is hidden, it will start be working in the background - how else are you going to hide the app without it effecting the user from doing their work You can hide the application in the background or even place it in the systray as an icon and itll still do the work it needs to do whilst the user is doing their work

  • Soby

    In order for your application to track the mouse outside of the application itself...you will need to provide a "Hook"...look at nobugz solution in this thread:

    http://forums.microsoft.com/MSDN/ShowPost.aspx PostID=698653&SiteID=1



  • Dee_dotnet_79

    you dont need to do a hook at all. It works even if the application is not in focus but hidden. I've done this many times and doing it just now.

    I placed a label on the form

    I placed a timer on the form

    I set the timer interval to be 100 milliseconds (to constantly show the mouse position) and enabled it so when we start the app it will kick in straight away.

    on the timer tick event, I did:

    Me.Label1.Text = Cursor.Position.ToString()

    I ran the application

    it showed me the x and y co-ords of the mouse pointer even if the app was not in focus.



  • makeing background form