Sign in to follow this  
Followers 0
gosu

Problems with DllCall

7 posts in this topic

#1 ·  Posted (edited)

Can you tell me what´s wrong with this code? I want the cursor to hide and show up again. It just happens nothing :)

DllCall("User32.dll","long","ShowCursor","long",0)

Sleep(5000)

DllCall("User32.dll","long","ShowCursor","long",1)

Edited by gosu

[quote name='d2hacker88' date='Jan 6 2005, 05:10 PM']Can someone please help me out with autoit like gimme a link on how to use it cause i have no experience with computer languages and i'd like to make a program with autoit in order to empress my computer teacher.[right][snapback]52215[/snapback][/right][/quote]

Share this post


Link to post
Share on other sites



Wrong? nothing.

But it seems that AutoIt's dllcall ignores ShowCursor.

(I tried also... :) )

Share this post


Link to post
Share on other sites

#3 ·  Posted (edited)

Can you tell me what´s wrong with this code? I want the cursor to hide and show up again. It just happens nothing  :)

The code looks ok, but some of the mouse functions don't work like you always expect (like changing the mouse cursor) so it might just not be that easy...

Google found this:

Introduction

Ever wanted to make the mouse cursor invisble? It theory it is a fairly simple thing to achieve using the ShowCursor API call. Pass True to show the cursor and False to hide the cursor. However, you might find that sometimes ShowCursor stops working. The reason for this is that the cursor's internal counter (which is the value returned by the ShowCursor function) gets out of sync. ShowCursor works by keeping an internal counter of calls to ShowCursor. Passing True increments the counter and passing False decrements the counter. The cursor is invisible when the cursor internal counter drops below 0 and is visible at all other times. Straight away you can see that calling the ShowCursor(True) twice and then calling ShowCursor(False) will not make the mouse cursor invisible. You must call ShowCursor(False) once more to do this!

Edited by Jon

Share this post


Link to post
Share on other sites

Yes I think so!

Share this post


Link to post
Share on other sites

#5 ·  Posted (edited)

Yeah!!

_CurVisInv(0)
MsgBox(0, 'Test time', 'Try to click OK, pal. The cursor is invisible!')
_CurVisInv(1)
MsgBox(0, 'Test time', 'Try to click OK, pal. This time it is not!')

Func _CurVisInv($bV)
   Local $cursorinternalc
   
   Select
      Case $bV = 1
         Do
            $cursorinternalc = DllCall("User32.dll", "long", "ShowCursor", "long", $bV)
            Sleep(1)
         Until $cursorinternalc[0] > 0
      Case $bV = 0
         Do
            $cursorinternalc = DllCall("User32.dll", "long", "ShowCursor", "long", $bV)
            Sleep(1)
         Until $cursorinternalc[0] < 0
      Case Else
         Return 0
   EndSelect

  ;MsgBox(0, '', $cursorinternalc[0])
   Return 1
EndFunc  ;==>_CurVisInv
Edited by ezzetabi

Share this post


Link to post
Share on other sites

wow, this is strange. well, thanks! i was just wondering what was wrong about my code :)


[quote name='d2hacker88' date='Jan 6 2005, 05:10 PM']Can someone please help me out with autoit like gimme a link on how to use it cause i have no experience with computer languages and i'd like to make a program with autoit in order to empress my computer teacher.[right][snapback]52215[/snapback][/right][/quote]

Share this post


Link to post
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
Sign in to follow this  
Followers 0