Jump to content

Change & activate mouse cursor


Recommended Posts

HI,

I can change the Reg value for the current mouse cursor by

$NewCursor = "hmove.cur"

$UrsprungArrow = RegRead("HKEY_CURRENT_USER\Control Panel\Cursors", "Arrow")
$StringArray = StringSplit($UrsprungArrow, "\")
$Path = StringTrimRight($UrsprungArrow, StringLen($StringArray[$StringArray[0]]))                       
RegWrite("HKEY_CURRENT_USER\Control Panel\Cursors", "Arrow", "REG_EXPAND_SZ", $Path & $NewCursor)

The regValue will change correctly, but how to activate? I have to say : Hey Windows look there has something changed. :o

If I open the control panel --> Mouse --> second tap and then press ok.

The new Cursor appears.

Thanks!

So long,

Mega

Scripts & functions Organize Includes Let Scite organize the include files

Yahtzee The game "Yahtzee" (Kniffel, DiceLion)

LoginWrapper Secure scripts by adding a query (authentication)

_RunOnlyOnThis UDF Make sure that a script can only be executed on ... (Windows / HD / ...)

Internet-Café Server/Client Application Open CD, Start Browser, Lock remote client, etc.

MultipleFuncsWithOneHotkey Start different funcs by hitting one hotkey different times

Link to comment
Share on other sites

this is a messy way but you could end explorer.exe and re-start it.

ProcessClose("explorer.exe")
Run ("explorer.exe")

that should refresh the registry.

NOTE: I use Windows XP SP2. I have no way of knowing if this will work on other systems.

The cake is a lie.www.theguy0000.com is currentlyUP images.theguy0000.com is currentlyUP all other *.theguy0000.com sites are DOWN

Link to comment
Share on other sites

I may be wrong but i think this can all be done thru dllcalls

1st use LoadCursorFromFile to get a handle to the cursor

if the cursur is not an ani cursor then use CopyCursor

else use CopyImage

then use SetSystemCursor

need to make sure when done to use DestroyCursor to free system resources

SciTE for AutoItDirections for Submitting Standard UDFs

 

Don't argue with an idiot; people watching may not be able to tell the difference.

 

Link to comment
Share on other sites

I may be wrong but i think this can all be done thru dllcalls

1st use LoadCursorFromFile to get a handle to the cursor

if the cursur is not an ani cursor then use CopyCursor

else use CopyImage

then use SetSystemCursor

need to make sure when done to use DestroyCursor to free system resources

Hi,

and happy belated birthday! Thanks for the reply, but I have never worked with that DLL-stuff. Could you please give me and example how to do that?

Thanks!

So long,

Mega

Scripts & functions Organize Includes Let Scite organize the include files

Yahtzee The game "Yahtzee" (Kniffel, DiceLion)

LoginWrapper Secure scripts by adding a query (authentication)

_RunOnlyOnThis UDF Make sure that a script can only be executed on ... (Windows / HD / ...)

Internet-Café Server/Client Application Open CD, Start Browser, Lock remote client, etc.

MultipleFuncsWithOneHotkey Start different funcs by hitting one hotkey different times

Link to comment
Share on other sites

Hi,

and happy belated birthday! Thanks for the reply, but I have never worked with that DLL-stuff. Could you please give me and example how to do that?

Thanks!

So long,

Mega

Thanks,

Here's somthing for you to play around with

Global Const $OCR_APPSTARTING = 32650
Global Const $OCR_NORMAL = 32512
Global Const $OCR_CROSS = 32515
Global Const $OCR_HAND = 32649
Global Const $OCR_IBEAM = 32513
Global Const $OCR_NO = 32648
Global Const $OCR_SIZEALL = 32646
Global Const $OCR_SIZENESW = 32643
Global Const $OCR_SIZENS = 32645
Global Const $OCR_SIZENWSE = 32642
Global Const $OCR_SIZEWE = 32644
Global Const $OCR_UP = 32516
Global Const $OCR_WAIT = 32514

;~ _SetCursor(@WindowsDir & "\cursors\3dgarro.cur", $OCR_NORMAL)
;~ _SetCursor(@WindowsDir & "\cursors\3dwarro.cur", $OCR_NORMAL)
_SetCursor(@WindowsDir & "\cursors\banana.ani", $OCR_NORMAL)

;==================================================================
; $s_file - file to load cursor from
; $i_cursor - system cursor to change
;==================================================================
Func _SetCursor($s_file, $i_cursor)
   Local $newhcurs, $lResult
   $newhcurs = DllCall("user32.dll", "int", "LoadCursorFromFile", "str", $s_file)
   If Not @error Then
      $lResult = DllCall("user32.dll", "int", "SetSystemCursor", "int", $newhcurs[0], "int", $i_cursor)
      If Not @error Then
         $lResult = DllCall("user32.dll", "int", "DestroyCursor", "int", $newhcurs[0])
      Else
         MsgBox(0, "Error", "Failed SetSystemCursor")
      EndIf
   Else
      MsgBox(0, "Error", "Failed LoadCursorFromFile")
   EndIf
EndFunc  ;==>_SetCursor

SciTE for AutoItDirections for Submitting Standard UDFs

 

Don't argue with an idiot; people watching may not be able to tell the difference.

 

Link to comment
Share on other sites

Hi,

ahhhh I see. Works great. Thank you very much!

But why did you do that.

Global Const $OCR_APPSTARTING = 32650

Global Const $OCR_NORMAL = 32512

Global Const $OCR_CROSS = 32515

Global Const $OCR_HAND = 32649

Could that also be ... ?

Global Const $OCR_APPSTARTING = "AppStarting"

Global Const $OCR_NORMAL = "Arrow"

Global Const $OCR_CROSS = "Crosshair"

Global Const $OCR_HAND = "Hand"

I think I have to look a bit closer to to DLLCall. I think that could be very mighty! :o

So long,

Mega

Scripts & functions Organize Includes Let Scite organize the include files

Yahtzee The game "Yahtzee" (Kniffel, DiceLion)

LoginWrapper Secure scripts by adding a query (authentication)

_RunOnlyOnThis UDF Make sure that a script can only be executed on ... (Windows / HD / ...)

Internet-Café Server/Client Application Open CD, Start Browser, Lock remote client, etc.

MultipleFuncsWithOneHotkey Start different funcs by hitting one hotkey different times

Link to comment
Share on other sites

Hi,

ahhhh I see. Works great. Thank you very much!

But why did you do that.

Could that also be ... ?

Global Const $OCR_APPSTARTING = "AppStarting"

Global Const $OCR_NORMAL = "Arrow"

Global Const $OCR_CROSS = "Crosshair"

Global Const $OCR_HAND = "Hand"

I think I have to look a bit closer to to DLLCall. I think that could be very mighty! :o

So long,

Mega

No it couldn't

$lResult = DllCall("user32.dll", "int", "SetSystemCursor", "int", $newhcurs[0], "int", $i_cursor)

yw

Gary

SciTE for AutoItDirections for Submitting Standard UDFs

 

Don't argue with an idiot; people watching may not be able to tell the difference.

 

Link to comment
Share on other sites

No it couldn't

$lResult = DllCall("user32.dll", "int", "SetSystemCursor", "int", $newhcurs[0], "int", $i_cursor)

yw

Gary

Oh well, like I learned from Valuater. Duh to me! :geek:

But I can take whatever number if it is an int, right? I was wondering about your 32XXX. Why not just 1,2,3,...

Thanks, again!

P.S.:That should definitively be the last qustion at the topic. :o

So long,

Mega

Edited by th.meger

Scripts & functions Organize Includes Let Scite organize the include files

Yahtzee The game "Yahtzee" (Kniffel, DiceLion)

LoginWrapper Secure scripts by adding a query (authentication)

_RunOnlyOnThis UDF Make sure that a script can only be executed on ... (Windows / HD / ...)

Internet-Café Server/Client Application Open CD, Start Browser, Lock remote client, etc.

MultipleFuncsWithOneHotkey Start different funcs by hitting one hotkey different times

Link to comment
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now
 Share

  • Recently Browsing   0 members

    • No registered users viewing this page.
×
×
  • Create New...