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