What happened to the Messenger Plus! forums on msghelp.net?
Shoutbox » MsgHelp Archive » Skype & Technology » Tech Talk » Hidie mouse in visual basic

Hidie mouse in visual basic
Author: Message:
Necroman
Junior Member
**

Avatar
YUP, that's REAL blood :p

Posts: 62
39 / Male / –
Joined: Dec 2002
O.P. Hidie mouse in visual basic
I was making a little app in vb that makes a little guy fly accross the screen

and I was wondering how I can hide the mousecursor
I searched the web and I only found info on the ShowCursor function ... but that will only hide the mouse in a certain form

does anybody know how to hide the mouse completely?
You ain't drunk till you have to grab the grass to keep from falling off the earth.
---------------------------
I'm not fat, I'm festively plump! :d
05-20-2004 02:59 PM
Profile E-Mail PM Find Quote Report
Stigmata
Veteran Member
*****



Posts: 3520
Reputation: 45
21 / Other / Flag
Joined: Jul 2003
RE: Hidie mouse in visual basic
hmmmmm get a book mate....


code:
Declare Function ShowCursor& Lib "user32" _
    (ByVal bShow As Long)
    'Add this code to Command1.

Private Sub Command1_Click()

    ShowCursor (bShow = True)
End Sub

'Add this to Command2.

Private Sub Command2_Click()

    ShowCursor (bShow = False)
End Sub

05-20-2004 03:55 PM
Profile PM Web Find Quote Report
Necroman
Junior Member
**

Avatar
YUP, that's REAL blood :p

Posts: 62
39 / Male / –
Joined: Dec 2002
O.P. RE: Hidie mouse in visual basic
with that, you're still able to see the cursor if it is positioned over the taskbar, and when you click to bring another application to the front ... the mouse becomes visible again :S
You ain't drunk till you have to grab the grass to keep from falling off the earth.
---------------------------
I'm not fat, I'm festively plump! :d
05-20-2004 04:18 PM
Profile E-Mail PM Find Quote Report
dotNorma
Veteran Member
*****

Avatar

Posts: 1745
Reputation: 17
33 / Male / –
Joined: May 2003
RE: Hidie mouse in visual basic
code:
Private Declare Function ShowCursor Lib "user32" (ByVal lShow As Long) As Long

Public Sub ButtonName_Click()
    ShowCursor False
End Sub

Public Sub ButtonName_Click()
    ShowCursor True
End Sub


When testing use the Tab button to find the other button because it would be hard to click it without being able to see the mouse.
05-20-2004 04:20 PM
Profile PM Web Find Quote Report
Stigmata
Veteran Member
*****



Posts: 3520
Reputation: 45
21 / Other / Flag
Joined: Jul 2003
RE: Hidie mouse in visual basic
:S


make the form your using a maximsed ontop form :P

eg if linking the form use

code:
private sub command1_click ()
form2.show 1
' the 1 makes it show as a modual which has it on top :P
end sub

05-20-2004 04:20 PM
Profile PM Web Find Quote Report
Mike
Elite Member
*****

Avatar
Meet the Spam Family!

Posts: 2795
Reputation: 48
32 / Male / Flag
Joined: Mar 2003
Status: Online
RE: Hidie mouse in visual basic
That will only work for your application.
If you want it on top for all windows then you have to use the ShowWindow api if i remember correcly.
I'll post an example when i get home...
YouTube closed-captions ripper (also allows you to download videos!)
05-20-2004 04:30 PM
Profile E-Mail PM Web Find Quote Report
CookieRevised
Elite Member
*****

Avatar

Posts: 15517
Reputation: 173
– / Male / Flag
Joined: Jul 2003
Status: Away
RE: Hidie mouse in visual basic
quote:
Originally posted by Mike2
That will only work for your application.
If you want it on top for all windows then you have to use the ShowWindow api if i remember correcly.
I'll post an example when i get home...
eh yeah... but he asked for hiding the mousecursor system-wide, not about a code to show your window alwyas on top (although, that could help him for this application also ;))


To keep your window always on top:
code:
Declare Function SetWindowPos Lib "User" (ByVal h%, ByVal hb%, ByVal X%, ByVal Y%, ByVal cx%, ByVal cy%, ByVal f%) As Integer
Const FLAGS = 1
Const HWND_TOPMOST = -1
' Use the above Declaration and Constants along with
' the code in "Form_Load" to make a window remain On Top.

Sub Form_Load ()
    'Sets form1 always on top.
    Dim Success As Integer
    Success% = SetWindowPos(Form1.hWnd, HWND_TOPMOST, 0, 0, 0, 0, FLAGS)
    ' Change the "0's" above to position the window.
End Sub


This post was edited on 05-20-2004 at 04:59 PM by CookieRevised.
.-= A 'frrrrrrrituurrr' for Wacky =-.
05-20-2004 04:43 PM
Profile PM Find Quote Report
Necroman
Junior Member
**

Avatar
YUP, that's REAL blood :p

Posts: 62
39 / Male / –
Joined: Dec 2002
O.P. RE: Hidie mouse in visual basic
aah, thats how I should have asked the question ...


"how do you hide the mouse system-wide?" :)
You ain't drunk till you have to grab the grass to keep from falling off the earth.
---------------------------
I'm not fat, I'm festively plump! :d
05-20-2004 04:45 PM
Profile E-Mail PM Find Quote Report
CookieRevised
Elite Member
*****

Avatar

Posts: 15517
Reputation: 173
– / Male / Flag
Joined: Jul 2003
Status: Away
RE: Hidie mouse in visual basic
Yeah, and the solution to that is already given...

code:
Private Declare Function ShowCursor Lib "user32" (ByVal lShow As Long) As Long
Sub Form_Load ()
    ShowCursor False
    ' do whatever you want with the mouse gone
    ShowCursor True
End Sub
But keep in mind that if you call the ShowCursor function more than once passing False as an argument, then you must call ShowCursor with True an equal number of times, otherwise the cursor will remain invisible!!!!
.-= A 'frrrrrrrituurrr' for Wacky =-.
05-20-2004 05:31 PM
Profile PM Find Quote Report
« Next Oldest Return to Top Next Newest »


Threaded Mode | Linear Mode
View a Printable Version
Send this Thread to a Friend
Subscribe | Add to Favorites
Rate This Thread:

Forum Jump:

Forum Rules:
You cannot post new threads
You cannot post replies
You cannot post attachments
You can edit your posts
HTML is Off
myCode is On
Smilies are On
[img] Code is On