Hi

excuse me, probably a very simple thing, but I am new to VBScript:

During a Script-controlled presentation I'd like to hide the mouse cursor.
Which is the sacred command?

Thanks
Rupert

Re: VBScript: How to hide the mouse-Cursor by Ulf

Ulf
Fri Oct 29 07:49:37 CDT 2004

Rupert Hildenbrand wrote:
> During a Script-controlled presentation I'd like to hide the mouse
> cursor. Which is the sacred command?

Hi Rupert,

What is a script controlled presentation?

Ulf



Re: VBScript: How to hide the mouse-Cursor by Rupert

Rupert
Fri Oct 29 08:34:36 CDT 2004

"Ulf Dornheck Busscher" <ulfdb@web.de> schrieb im Newsbeitrag
news:uKUxvWbvEHA.1512@TK2MSFTNGP12.phx.gbl...
> Rupert Hildenbrand wrote:
>> During a Script-controlled presentation I'd like to hide the mouse
>> cursor. Which is the sacred command?
>
> Hi Rupert,
>
> What is a script controlled presentation?

The script opens and closes documents step by step

Rupert




Re: VBScript: How to hide the mouse-Cursor by mayayana

mayayana
Fri Oct 29 09:14:58 CDT 2004

I think Ulf is asking what it is that you're trying to
do. There's no VBS method to hide the screen cursor,
so you want to try to hide the cursor in the window
of whatever program is opening the "documents".
If that can be done it will depend on what the program
is.
_____________________________

mayayXXana1a@mindYYspring.com
For return email remove XX and YY.
_____________________________
Rupert Hildenbrand <hildenbrand@t-online.de> wrote in message
news:cltgu6$dcd$02$1@news.t-online.com...
> "Ulf Dornheck Busscher" <ulfdb@web.de> schrieb im Newsbeitrag
> news:uKUxvWbvEHA.1512@TK2MSFTNGP12.phx.gbl...
> > Rupert Hildenbrand wrote:
> >> During a Script-controlled presentation I'd like to hide the mouse
> >> cursor. Which is the sacred command?
> >
> > Hi Rupert,
> >
> > What is a script controlled presentation?
>
> The script opens and closes documents step by step
>
> Rupert
>
>
>



Re: VBScript: How to hide the mouse-Cursor by mr

mr
Fri Oct 29 12:37:10 CDT 2004

servus Rupert,

There is no way to do this using "pure" script.

However, it is quite easy to do if you are willing to call api's from script
(gasp!).

If you are willing to call api's, then you will have to either: write an
actX object "wrapping" the api calls, _OR_ use some utility which is able to
define-and-call an api at "run time". Such a utility (DynaWrap, a.k.a.
DynaCall) may be found on Guenter Born's website.

http://www.borncity.com/WSHBazaar/WSHBazaar.htm

What you do (with the api's) is to re-set the system cursor to a cursor
which is completely transparent (I call it a "null" cursor).

Here is a snippet of code that does that:

--- <snip> ---
' use DynaWrap to change the system cursor, jw 24Apr00

Option Explicit

Dim oDW ' as object (Dynawrap)
Dim hNullCursor, hCurHourGlass, hCurArrow ' as long (cursor handle)
Dim bAns ' as long (success/fail)

Const IDC_ARROW = 32512 ' standard cursors
Const IDC_IBEAM = 32513
Const IDC_WAIT = 32514

Const OCR_NORMAL = 32512 ' system cursor ID's
Const OCR_IBEAM = 32513
Const OCR_WAIT = 32514

Const sNullCurFileSpec = "c:\windows\temp\null.cur"


MsgBox("Clear the decks!, your cursor is about to be changed")

' this code will load the hourglass cursor...
' Call DeclareAPI("USER32.DLL", "LoadCursorA", "i=ll", "f=s", "r=h")
' hCurHourGlass = oDW.LoadCursorA(0, CLng(IDC_WAIT)) ' load hourglass
' bAns = oDW.SetSystemCursor(CLng(hCurHourGlass), CLng(OCR_NORMAL))

' this code loads a "null cursor" (from a file)...
Call DeclareAPI("USER32.DLL", "LoadCursorFromFileA", "i=r", "f=s", "r=h")
hNullCursor = oDW.LoadCursorA(CStr(sNullCurFileSpec)) ' load null cursor

Call DeclareAPI("USER32.DLL", "SetSystemCursor", "i=ll", "f=s", "r=l")
bAns = oDW.SetSystemCursor(CLng(hNullCursor), CLng(OCR_NORMAL))


MsgBox("If all went well, you should be seeing an _NO_ cursor" & vbCrLf &
vbCrLf _
& " Now click OK to change it back to the normal arrow")

' this code will re-load the arrow cursor...
Call DeclareAPI("USER32.DLL", "LoadCursorA", "i=ll", "f=s", "r=h")
hCurArrow = oDW.LoadCursorA(0, CLng(IDC_ARROW))
Call DeclareAPI("USER32.DLL", "SetSystemCursor", "i=ll", "f=s", "r=l")
bAns = oDW.SetSystemCursor(Clng(hCurArrow), CLng(OCR_NORMAL))

' no cleanup required if you loaded a system standard cursor,
' (it's not considered "cricket" to delete the standard cursors)

' er wait. The "null" cursor was was not a standard cursor,
' so it must be cleaned up...
Call DeclareAPI("USER32.DLL", "DestroyCursor", "i=l", "f=s", "r=l")
bAns = oDW.DestroyCursor(Clng(hNullCursor))

WScript.Quit


' ================================================
' === SUBROUTINES FOLLOW =========================
' ================================================

Sub DeclareAPI(sDLL, sAPI, sInput, sType, sResult)

' the DynaWrap doc is rather inscrutable, but as best I can make out,
' DynaWrap can only accomodate ONE api at a time. (If I'm wrong,
' maybe you experts can straighten me out on this).

' Assuming that my one-at-a-time hypothesis is correct,
' then one has two choices:
' - you need to set up a separate obj for EVERY api (ugh!), or
' - declare the api's to be used (one-at-a-time),
' which is what you see here (yes, it's "ugly")...

Set oDW = nothing ' clear any previous instance
Set oDW = CreateObject("DynamicWrapper") ' start over...
oDW.Register CStr(sDLL),CStr(sAPI),CStr(sInput),CStr(sType),CStr(sResult)

End Sub
--- </snip> ---

o.k. now for the caveats. You must store the null cursor somewhere handy,
and then modify the script to point to the cursor's location.

Also, after the system cursor is set to the null cursor, then you are not
going to have a pointer to click on anything. When that message box appears
saying "click OK to restore the arrow cursor" appears, you won't be able to
click. I suggest using the "enter" key to dismiss the msgbox.

Finally, it was previously pointed out to me that not everybody uses the
"standard" arrow as a cursor, and so setting the cursor "back" to the arrow
is not strictly kosher. If you want to be politically correct about this,
you have to call the "SystemParametersInfo" api (with an appropriate
constant) to get the handle of the "real" system cursor.

mfg, jw
"Rupert Hildenbrand" <franzruppert@gmx.net> wrote in message
news:cltdd4$51h$02$1@news.t-online.com...
> During a Script-controlled presentation I'd like to hide the mouse cursor.



begin 666 null.cur
M4DE&1D(#``!!0T].86YI:"0````D`````0````$````````````````````!
M````"@````$```!,25-4"@,``&9R86UI8V]N_@(``````@`!`" @````````
MZ (``!8````H````( ```$ ````!``0``````( "````````````````````
M````````````@ ``@ ```(" `( ```" `( `@( ``,# P " @( ```#_``#_
M````__\`_P```/\`_P#__P``____````````````````````````````````
M````````````````````````````````````````````````````````````
M````````````````````````````````````````````````````````````
M````````````````````````````````````````````````````````````
M````````````````````````````````````````````````````````````
M````````````````````````````````````````````````````````````
M````````````````````````````````````````````````````````````
M````````````````````````````````````````````````````````````
M````````````````````````````````````````````````````````````
M````````````````````````````````````````````````````````````
M````````````````````````````````````````````````````````````
M````````````````````````````````````````````````````________
M____________________________________________________________
M____________________________________________________________
@__________________________________________\`
`
end


Show/Hide System Cursor, Take II by mr

mr
Fri Oct 29 13:52:52 CDT 2004

uh-oh. Forget that "null cursor" suggestion.

There is a much more simple and direct way to hide the system cursor,
i.e., use the "Show Cursor" api.

--- <snip> ---
' use DynaWrap to show/hide the system cursor, jw 29Oct04

Option Explicit

Dim oDW ' as object (Dynawrap)
Dim nRtn ' as long (api return value)

MsgBox("Achtung, Vorsicht!, your cursor is about to be HIDDEN (gasp!)...
")

Call DeclareAPI("USER32.DLL", "ShowCursor", "i=l", "f=s", "r=l")
nRtn = oDW.ShowCursor(CLng(False)) ' hide the system cursor

MsgBox("If all went well, you should be seeing _NO_ cursor" & vbCrLf &
vbCrLf _
& " Now click OK (by pressing the enter key) to see system cursor
again... ")

nRtn = oDW.ShowCursor(CLng(True)) ' (hopefully) show the system cursor
again

WScript.Quit


' ================================================
' === SUBROUTINES FOLLOW =========================
' ================================================

Sub DeclareAPI(sDLL, sAPI, sInput, sType, sResult)

' the DynaWrap doc is rather inscrutable, but as best I can make out,
' DynaWrap can only accomodate ONE api at a time. (If I'm wrong,
' maybe you experts can straighten me out on this).

' Assuming that my one-at-a-time hypothesis is correct,
' then one has two choices:
' - you need to set up a separate obj for EVERY api (ugh!), or
' - declare the api's to be used (one-at-a-time),
' which is what you see here (yes, it's "ugly")...

Set oDW = nothing ' clear any previous instance
Set oDW = CreateObject("DynamicWrapper") ' start over...
oDW.Register CStr(sDLL),CStr(sAPI),CStr(sInput),CStr(sType),CStr(sResult)

End Sub


--- </snip> ---

Caveat Emptor. Calling api's from script is risky business, and should only
be attempted by those who are willing to suffer extreme dis-respect from
professional scripters...

mit groß Verlegenheit, jw



Show/Hide System Cursor, Take III by mr

mr
Fri Oct 29 14:12:35 CDT 2004

Upon further consideration, I can name-that-tune,
er, write-that-script in 7 lines of code:

--- <snip> ---
' use DynaWrap to show/hide the system cursor (take III), jw 29Oct04

Option Explicit

Dim oDW : Set oDW = CreateObject("DynamicWrapper")
oDW.Register "USER32.DLL", "ShowCursor", "i=l", "f=s", "r=l" ' declare
api

MsgBox("Achtung, Vorsicht!, your cursor is about to be HIDDEN (gasp!)...
")

Call oDW.ShowCursor(CLng(False)) ' hide the system cursor

MsgBox("If all went well, you should be seeing _NO_ cursor" & vbCrLf &
vbCrLf _
& " Now click OK (by pressing the enter key) to see system cursor
again... ")

Call oDW.ShowCursor(CLng(True)) ' (hopefully) show the system cursor
again

WScript.Quit
--- </snip> ---

mfg, jw



Re: Show/Hide System Cursor, Take III by Rupert

Rupert
Tue Nov 02 08:11:34 CST 2004

if I run Take III, I get an error in line 2: Dim oDW: Set oDW =
CreateObject("DynamicWrapper")

the message is: ActiveX cannot create object

Thanks for your great effort
Rupert

"mr unreliable" <ReplyToNewsgroup@notmail.com> schrieb im Newsbeitrag
news:eCZSypevEHA.3200@TK2MSFTNGP14.phx.gbl...
> Upon further consideration, I can name-that-tune,
> er, write-that-script in 7 lines of code:
>
> --- <snip> ---
> ' use DynaWrap to show/hide the system cursor (take III), jw 29Oct04
>
> Option Explicit
>
> Dim oDW : Set oDW = CreateObject("DynamicWrapper")
> oDW.Register "USER32.DLL", "ShowCursor", "i=l", "f=s", "r=l" ' declare
> api
>
> MsgBox("Achtung, Vorsicht!, your cursor is about to be HIDDEN (gasp!)...
> ")
>
> Call oDW.ShowCursor(CLng(False)) ' hide the system cursor
>
> MsgBox("If all went well, you should be seeing _NO_ cursor" & vbCrLf &
> vbCrLf _
> & " Now click OK (by pressing the enter key) to see system cursor
> again... ")
>
> Call oDW.ShowCursor(CLng(True)) ' (hopefully) show the system cursor
> again
>
> WScript.Quit
> --- </snip> ---
>
> mfg, jw
>
>