Jump to content
MrCreatoR

GUICtrlSetOnHover UDF!

Recommended Posts

wraithdu

The second parameters to SetTimer and KillTimer are UINT_PTR types which are 64-bit values on x64 Windows. Maybe the SetTimer function is failing, which would break the whole UDF. Also the return from WindowFromPoint is a hwnd, not int.

Edited by wraithdu

Share this post


Link to post
Share on other sites
MrCreatoR

The second parameters to SetTimer and KillTimer are UINT_PTR types which are 64-bit values on x64 Windows. Maybe the SetTimer function is failing, which would break the whole UDF. Also the return from WindowFromPoint is a hwnd, not int.

Thanks.

Rawox, billthecreator, Homes32

Can you please change what wraithdu suggesting and check it under x64?


 

Spoiler

Using OS: Win 7 Professional, Using AutoIt Ver(s): 3.3.6.1 / 3.3.8.1

AutoIt_Rus_Community.png AutoIt Russian Community

My Work...

Spoiler

AutoIt_Icon_small.pngProjects: ATT - Application Translate Tool {new}| BlockIt - Block files & folders {new}| SIP - Selected Image Preview {new}| SISCABMAN - SciTE Abbreviations Manager {new}| AutoIt Path Switcher | AutoIt Menu for Opera! | YouTube Download Center! | Desktop Icons Restorator | Math Tasks | KeyBoard & Mouse Cleaner | CaptureIt - Capture Images Utility | CheckFileSize Program

AutoIt_Icon_small.pngUDFs: OnAutoItErrorRegister - Handle AutoIt critical errors {new}| AutoIt Syntax Highlight {new}| Opera Library! | Winamp Library | GetFolderToMenu | Custom_InputBox()! | _FileRun UDF | _CheckInput() UDF | _GUIInputSetOnlyNumbers() UDF | _FileGetValidName() UDF | _GUICtrlCreateRadioCBox UDF | _GuiCreateGrid() | _PathSplitByRegExp() | _GUICtrlListView_MoveItems - UDF | GUICtrlSetOnHover_UDF! | _ControlTab UDF! | _MouseSetOnEvent() UDF! | _ProcessListEx - UDF | GUICtrl_SetResizing - UDF! | Mod. for _IniString UDFs | _StringStripChars UDF | _ColorIsDarkShade UDF | _ColorConvertValue UDF | _GUICtrlTab_CoverBackground | CUI_App_UDF | _IncludeScripts UDF | _AutoIt3ExecuteCode | _DragList UDF | Mod. for _ListView_Progress | _ListView_SysLink | _GenerateRandomNumbers | _BlockInputEx | _IsPressedEx | OnAutoItExit Handler | _GUICtrlCreateTFLabel UDF | WinControlSetEvent UDF | Mod. for _DirGetSizeEx UDF
 
AutoIt_Icon_small.pngExamples: 
ScreenSaver Demo - Matrix included | Gui Drag Without pause the script | _WinAttach()! | Turn Off/On Monitor | ComboBox Handler Example | Mod. for "Thinking Box" | Cool "About" Box | TasksBar Imitation Demo

Like the Projects/UDFs/Examples? Please rate the topic (up-right corner of the post header: Rating AutoIt_Rating.gif)

* === My topics === *

==================================================
My_Userbar.gif
==================================================

 

 

 

AutoIt is simple, subtle, elegant. © AutoIt Team

Share this post


Link to post
Share on other sites
MrCreatoR

Ok, new version...

[v1.9] - [21.05.2010]

* UDF library now compatible with AutoIt 3.3.6.1.

* UDF library renamed to GUICtrlOnHover.au3.

* Changed the main function name to _GUICtrl_OnHoverRegister, For backwards compatibility reasons, other (old) function names are still supported:

----_GUICtrl_SetOnHover, GUICtrl_SetOnHover, GUICtrlSetOnHover, _GUICtrlSetOnHover

* Fixed(?) issue when the UDF is not working under 64-bit OS.

* Global variables and internal functions renaming (for "cosmetic" reasons only).

* UDF's code is more readable now.

See first post.

 

Spoiler

Using OS: Win 7 Professional, Using AutoIt Ver(s): 3.3.6.1 / 3.3.8.1

AutoIt_Rus_Community.png AutoIt Russian Community

My Work...

Spoiler

AutoIt_Icon_small.pngProjects: ATT - Application Translate Tool {new}| BlockIt - Block files & folders {new}| SIP - Selected Image Preview {new}| SISCABMAN - SciTE Abbreviations Manager {new}| AutoIt Path Switcher | AutoIt Menu for Opera! | YouTube Download Center! | Desktop Icons Restorator | Math Tasks | KeyBoard & Mouse Cleaner | CaptureIt - Capture Images Utility | CheckFileSize Program

AutoIt_Icon_small.pngUDFs: OnAutoItErrorRegister - Handle AutoIt critical errors {new}| AutoIt Syntax Highlight {new}| Opera Library! | Winamp Library | GetFolderToMenu | Custom_InputBox()! | _FileRun UDF | _CheckInput() UDF | _GUIInputSetOnlyNumbers() UDF | _FileGetValidName() UDF | _GUICtrlCreateRadioCBox UDF | _GuiCreateGrid() | _PathSplitByRegExp() | _GUICtrlListView_MoveItems - UDF | GUICtrlSetOnHover_UDF! | _ControlTab UDF! | _MouseSetOnEvent() UDF! | _ProcessListEx - UDF | GUICtrl_SetResizing - UDF! | Mod. for _IniString UDFs | _StringStripChars UDF | _ColorIsDarkShade UDF | _ColorConvertValue UDF | _GUICtrlTab_CoverBackground | CUI_App_UDF | _IncludeScripts UDF | _AutoIt3ExecuteCode | _DragList UDF | Mod. for _ListView_Progress | _ListView_SysLink | _GenerateRandomNumbers | _BlockInputEx | _IsPressedEx | OnAutoItExit Handler | _GUICtrlCreateTFLabel UDF | WinControlSetEvent UDF | Mod. for _DirGetSizeEx UDF
 
AutoIt_Icon_small.pngExamples: 
ScreenSaver Demo - Matrix included | Gui Drag Without pause the script | _WinAttach()! | Turn Off/On Monitor | ComboBox Handler Example | Mod. for "Thinking Box" | Cool "About" Box | TasksBar Imitation Demo

Like the Projects/UDFs/Examples? Please rate the topic (up-right corner of the post header: Rating AutoIt_Rating.gif)

* === My topics === *

==================================================
My_Userbar.gif
==================================================

 

 

 

AutoIt is simple, subtle, elegant. © AutoIt Team

Share this post


Link to post
Share on other sites
Yashied
MrCreatoR

As before, available only version 1.8

Are you sure? what are you trying to download? please check this link, it's the attached html with redirection.

P.S

Perhaps the files is downloaded from browser's cache?


 

Spoiler

Using OS: Win 7 Professional, Using AutoIt Ver(s): 3.3.6.1 / 3.3.8.1

AutoIt_Rus_Community.png AutoIt Russian Community

My Work...

Spoiler

AutoIt_Icon_small.pngProjects: ATT - Application Translate Tool {new}| BlockIt - Block files & folders {new}| SIP - Selected Image Preview {new}| SISCABMAN - SciTE Abbreviations Manager {new}| AutoIt Path Switcher | AutoIt Menu for Opera! | YouTube Download Center! | Desktop Icons Restorator | Math Tasks | KeyBoard & Mouse Cleaner | CaptureIt - Capture Images Utility | CheckFileSize Program

AutoIt_Icon_small.pngUDFs: OnAutoItErrorRegister - Handle AutoIt critical errors {new}| AutoIt Syntax Highlight {new}| Opera Library! | Winamp Library | GetFolderToMenu | Custom_InputBox()! | _FileRun UDF | _CheckInput() UDF | _GUIInputSetOnlyNumbers() UDF | _FileGetValidName() UDF | _GUICtrlCreateRadioCBox UDF | _GuiCreateGrid() | _PathSplitByRegExp() | _GUICtrlListView_MoveItems - UDF | GUICtrlSetOnHover_UDF! | _ControlTab UDF! | _MouseSetOnEvent() UDF! | _ProcessListEx - UDF | GUICtrl_SetResizing - UDF! | Mod. for _IniString UDFs | _StringStripChars UDF | _ColorIsDarkShade UDF | _ColorConvertValue UDF | _GUICtrlTab_CoverBackground | CUI_App_UDF | _IncludeScripts UDF | _AutoIt3ExecuteCode | _DragList UDF | Mod. for _ListView_Progress | _ListView_SysLink | _GenerateRandomNumbers | _BlockInputEx | _IsPressedEx | OnAutoItExit Handler | _GUICtrlCreateTFLabel UDF | WinControlSetEvent UDF | Mod. for _DirGetSizeEx UDF
 
AutoIt_Icon_small.pngExamples: 
ScreenSaver Demo - Matrix included | Gui Drag Without pause the script | _WinAttach()! | Turn Off/On Monitor | ComboBox Handler Example | Mod. for "Thinking Box" | Cool "About" Box | TasksBar Imitation Demo

Like the Projects/UDFs/Examples? Please rate the topic (up-right corner of the post header: Rating AutoIt_Rating.gif)

* === My topics === *

==================================================
My_Userbar.gif
==================================================

 

 

 

AutoIt is simple, subtle, elegant. © AutoIt Team

Share this post


Link to post
Share on other sites
Homes32

still not working on x64. :idea:

I'm using:

Windows 7 Pro x64

Autoit 3.3.6.1

any suggestions? if you need any more information just ask!

Share this post


Link to post
Share on other sites
Yashied

Replace

$p__GUICtrl_SOH_TimerProc = DllCallbackRegister("__GUICtrl_SOH_CALLBACK", "none", "hwnd;uint;uint_ptr;dword")

instead

$p__GUICtrl_SOH_TimerProc = DllCallbackRegister("__GUICtrl_SOH_CALLBACK", "none", "hwnd;int;int;dword")

Share this post


Link to post
Share on other sites
MrCreatoR

Replace

It's tested? the UDF will work under x64 after this change?

 

Spoiler

Using OS: Win 7 Professional, Using AutoIt Ver(s): 3.3.6.1 / 3.3.8.1

AutoIt_Rus_Community.png AutoIt Russian Community

My Work...

Spoiler

AutoIt_Icon_small.pngProjects: ATT - Application Translate Tool {new}| BlockIt - Block files & folders {new}| SIP - Selected Image Preview {new}| SISCABMAN - SciTE Abbreviations Manager {new}| AutoIt Path Switcher | AutoIt Menu for Opera! | YouTube Download Center! | Desktop Icons Restorator | Math Tasks | KeyBoard & Mouse Cleaner | CaptureIt - Capture Images Utility | CheckFileSize Program

AutoIt_Icon_small.pngUDFs: OnAutoItErrorRegister - Handle AutoIt critical errors {new}| AutoIt Syntax Highlight {new}| Opera Library! | Winamp Library | GetFolderToMenu | Custom_InputBox()! | _FileRun UDF | _CheckInput() UDF | _GUIInputSetOnlyNumbers() UDF | _FileGetValidName() UDF | _GUICtrlCreateRadioCBox UDF | _GuiCreateGrid() | _PathSplitByRegExp() | _GUICtrlListView_MoveItems - UDF | GUICtrlSetOnHover_UDF! | _ControlTab UDF! | _MouseSetOnEvent() UDF! | _ProcessListEx - UDF | GUICtrl_SetResizing - UDF! | Mod. for _IniString UDFs | _StringStripChars UDF | _ColorIsDarkShade UDF | _ColorConvertValue UDF | _GUICtrlTab_CoverBackground | CUI_App_UDF | _IncludeScripts UDF | _AutoIt3ExecuteCode | _DragList UDF | Mod. for _ListView_Progress | _ListView_SysLink | _GenerateRandomNumbers | _BlockInputEx | _IsPressedEx | OnAutoItExit Handler | _GUICtrlCreateTFLabel UDF | WinControlSetEvent UDF | Mod. for _DirGetSizeEx UDF
 
AutoIt_Icon_small.pngExamples: 
ScreenSaver Demo - Matrix included | Gui Drag Without pause the script | _WinAttach()! | Turn Off/On Monitor | ComboBox Handler Example | Mod. for "Thinking Box" | Cool "About" Box | TasksBar Imitation Demo

Like the Projects/UDFs/Examples? Please rate the topic (up-right corner of the post header: Rating AutoIt_Rating.gif)

* === My topics === *

==================================================
My_Userbar.gif
==================================================

 

 

 

AutoIt is simple, subtle, elegant. © AutoIt Team

Share this post


Link to post
Share on other sites
Yashied
Homes32

It's tested? the UDF will work under x64 after this change?

sorry. still not working with Yashied's change.

Share this post


Link to post
Share on other sites
Darter

I do not have x64, but it's the only thing left wrong.

hey i am form the german autoi Forum ans a think this is a nice UDF and i can use this allot but it still dont work. The hole examples dont work :-(

I also have a x64 system.

Edited by Darter

Share this post


Link to post
Share on other sites
Darter

hey i am form the german autoi Forum ans a think this is a nice UDF and i can use this allot but it still dont work. The hole examples dont work :-(

I have a x64 system and it dont work :-(

oh sorry i klickt the wrong button and no i find no button to delete this post xD

Edited by Darter

Share this post


Link to post
Share on other sites
Darter

nobody here how have a answer, because i think this funktion is very nice and i wanna use it but the funktion dont work :-(

Share this post


Link to post
Share on other sites
Homes32

ok finally figured it out.

WindowFromPoint actually expects a 64-bit POINT structure to be passed by value. see bug 1362 for more details.

replace __GUICtrl_SOH_ControlGetHovered() with the following rewrite and everything works as expected! :mellow:

Func __GUICtrl_SOH_ControlGetHovered()
    Local $iOld_Opt_MCM = Opt("MouseCoordMode", 1)

    Local $tPoint = DllStructCreate("int X;int Y")

    DllStructSetData($tPoint, "x", MouseGetPos(0))
    DllStructSetData($tPoint, "y", MouseGetPos(1))

    Local $tPointCast = DllStructCreate("int64", DllStructGetPtr($tPoint))

    Local $aRet = DllCall($s__GUICtrl_SOH_User32_Dll, "hwnd", "WindowFromPoint", "int64", DllStructGetData($tPointCast, 1))
    If @error Then Return SetError(@error, @extended, 0)

    Opt("MouseCoordMode", $iOld_Opt_MCM)

    Return $aRet[0]
EndFunc

ps: this works regardless of Yashied's suggested changes to SetTimer and KillTimer and $p__GUICtrl_SOH_TimerProc = DllCallbackRegister("__GUICtrl_SOH_CALLBACK", "none", "hwnd;uint;uint_ptr;dword")

cheers!

Homes32

Edited by Homes32

Share this post


Link to post
Share on other sites
wraithdu

_WinAPI_WindowFromPoint is now an included function that contains the fix you describe. You could just change the custom function to use the included WindowFromPoint function.

Share this post


Link to post
Share on other sites
MrCreatoR

Thanks!

Update available now:

[v2.0] - [09.06.2010]

* Fixed potential issue with calling $sPrimaryDownFunc function (first call was performed only after recieving WM_COMMAND message, wich is the control event).

* Fixed an issue with blocking the OnHover function - the OnLeaveHover function was not called untill the OnHover function was blocked.

* Fixed(?) (again) an issue when the UDF is not working under 64-bit OS.

* Optimized internal "__GUICtrl_SOH_Call" function to work faster when calling parameters functions.


 

Spoiler

Using OS: Win 7 Professional, Using AutoIt Ver(s): 3.3.6.1 / 3.3.8.1

AutoIt_Rus_Community.png AutoIt Russian Community

My Work...

Spoiler

AutoIt_Icon_small.pngProjects: ATT - Application Translate Tool {new}| BlockIt - Block files & folders {new}| SIP - Selected Image Preview {new}| SISCABMAN - SciTE Abbreviations Manager {new}| AutoIt Path Switcher | AutoIt Menu for Opera! | YouTube Download Center! | Desktop Icons Restorator | Math Tasks | KeyBoard & Mouse Cleaner | CaptureIt - Capture Images Utility | CheckFileSize Program

AutoIt_Icon_small.pngUDFs: OnAutoItErrorRegister - Handle AutoIt critical errors {new}| AutoIt Syntax Highlight {new}| Opera Library! | Winamp Library | GetFolderToMenu | Custom_InputBox()! | _FileRun UDF | _CheckInput() UDF | _GUIInputSetOnlyNumbers() UDF | _FileGetValidName() UDF | _GUICtrlCreateRadioCBox UDF | _GuiCreateGrid() | _PathSplitByRegExp() | _GUICtrlListView_MoveItems - UDF | GUICtrlSetOnHover_UDF! | _ControlTab UDF! | _MouseSetOnEvent() UDF! | _ProcessListEx - UDF | GUICtrl_SetResizing - UDF! | Mod. for _IniString UDFs | _StringStripChars UDF | _ColorIsDarkShade UDF | _ColorConvertValue UDF | _GUICtrlTab_CoverBackground | CUI_App_UDF | _IncludeScripts UDF | _AutoIt3ExecuteCode | _DragList UDF | Mod. for _ListView_Progress | _ListView_SysLink | _GenerateRandomNumbers | _BlockInputEx | _IsPressedEx | OnAutoItExit Handler | _GUICtrlCreateTFLabel UDF | WinControlSetEvent UDF | Mod. for _DirGetSizeEx UDF
 
AutoIt_Icon_small.pngExamples: 
ScreenSaver Demo - Matrix included | Gui Drag Without pause the script | _WinAttach()! | Turn Off/On Monitor | ComboBox Handler Example | Mod. for "Thinking Box" | Cool "About" Box | TasksBar Imitation Demo

Like the Projects/UDFs/Examples? Please rate the topic (up-right corner of the post header: Rating AutoIt_Rating.gif)

* === My topics === *

==================================================
My_Userbar.gif
==================================================

 

 

 

AutoIt is simple, subtle, elegant. © AutoIt Team

Share this post


Link to post
Share on other sites
Homes32

Thanks!

Update available now:

glad to help.

new version 2.0 is working fine in both 32 and 64 bit environments! :mellow:

Edited by Homes32

Share this post


Link to post
Share on other sites
PiroX

glad to help.

new version 2.0 is working fine in both 32 and 64 bit environments! :mellow:

If i use the obfuscator, the hovering of icons won't work

any fix for this?

/edit

found solution

after looking at the obfuscated script i saw that the functions in _GUICtrl_OnHoverRegister( didn'g got renamed

You have to ignore all user hover functions

e.g

_GUICtrl_OnHoverRegister(-1, "_Hover_button_run", "_Leave_Hover_button_run")

add: #Obfuscator_Ignore_Funcs=_Hover_button_run,_Leave_Hover_button_run

Edited by PiroX

Share this post


Link to post
Share on other sites
elawady

i use the button in Tab Item and when i moved on the button or click it fast

the button is flashing

how i can stop this flash

#include <GUIConstantsEx.au3>
#include <GuiTab.au3>
#include "UDFs\Icons.au3"
#include "UDFs\GUICtrlSetOnHover.au3"

Global $Hold = False
Global $Tab1_Background, $Tab1_Button1, $Tab1_Button2, $Tab1_Button3, $tab1

$GUI = GUICreate("Form1", 800, 600, -1, -1)
GUICtrlCreatePic(@ScriptDir & "\images\background_1.bmp", 0, 0, 800, 600, $WS_CLIPSIBLINGS)
GUICtrlSetState(-1, $GUI_DISABLE)

$MainTab = GUICtrlCreateTab(10, 200, 780, 390, $TCS_MULTILINE)
GUICtrlSetState(-1, $GUI_ONTOP)
GUISetFont(14, 700)

$tab1 = GUICtrlCreateTabItem("tab1")
$Tab1_Background = GUICtrlCreatePic(@ScriptDir & "\images\background_1.bmp", 10, 220, 780, 370)
GUICtrlSetState(-1, $GUI_DISABLE)
$Tab1_Button1 = GUICtrlCreatePic("", 380, 280, 90, 22)
GUICtrlSetOnHover(-1, '_HoverButton', '_LeaveButton', '_DownButton', '_HoverButton')
_LeaveButton($Tab1_Button1)
GUICtrlCreateTabItem("") ; end tabitem definition
GUISetState(@SW_SHOW)

While 1
    $nMsg = GUIGetMsg()
    Switch $nMsg
        Case $GUI_EVENT_CLOSE
            Exit

    EndSwitch
WEnd

Func _DownButton($CtrlID)
    If $Hold Then
        Return
    Else
        $Hold = True
    EndIf
    Local $File

    _SetImage($CtrlID, @ScriptDir & '\Images\Button1_down.png' & $File, $Tab1_Background)
EndFunc   ;==>_DownButton
Func _LeaveButton($CtrlID)
    Local $File
    _SetImage($CtrlID, @ScriptDir & '\Images\Button1_over.png' & $File, $Tab1_Background)
    $Hold = False
EndFunc   ;==>_LeaveButton
Func _HoverButton($CtrlID)
    Local $File
    _SetImage($CtrlID, @ScriptDir & '\Images\Button1_normal.png' & $File, $Tab1_Background)
    $Hold = False
EndFunc   ;==>_HoverButton

all files i used here

Share this post


Link to post
Share on other sites
cal

Thanks for the update. I missed this function.

Note that for me if I do not put in the "$sLeaveHover_Func" part then this only works once. The next time my mouse hovers over the control nothing happens. If however, I state both the enter and leave functions then it works fine whenever my mouse hovers over it.

Thanks for the update, its working fine for me now that I'm calling it with parameters for both enter and leave.

Don't know if it matters but I'm using Win7 64bit.

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

×