Jump to content
Sign in to follow this  
jimollerhead

Problems using GuiRegisterMsg

Recommended Posts

jimollerhead

Hello Folks,

I'm not an AutoIt noob but I am new to the GuiRegisterMsg command.

What I am trying to do is to pop up a "long string edit" window when user double-clicks. Ideally I wanted it to be a duouble-click in the Input box itself but I couldn't get this to work so I was going to settle for a double-click *near* the input box.

Here's a severely curtailed version of my almost 1300-line script. From the msgbox "tell-tale" it appears that the GuiRegisterMsg definition interferes with the GuiGetMsg function and it 'remembers' the last GuiGetMsg return value -- is there some way to 'flush' the holding area? Note that there are bits in there from experiments -- if I comment out the While-Wend and replace it with the sleep line you can better see what I am trying to acheive. The list box is just to give a different kind of control than an input field to have the focus, it's contents are not relevant to the snippet, only to the full app.

All help gratefully acknowledged! Here's the code snippet:

#include <WindowsConstants.au3>
#include <ButtonConstants.au3>
#include <GuiConstantsEx.au3>
#include <EditConstants.au3>
#include <ListBoxConstants.au3>
Dim $InputFileId
Dim $OutputFileId
Dim $winMain
Dim $GUIMsg
GUIRegisterMsg($WM_LBUTTONDBLCLK, "EditText")
$winMain = GUICreate ("Test for Editing Long Strings", 800, 560, -1, -1)
GUICtrlCreateLabel("File to Process", 22,30)
GUICtrlCreateLabel("Output File", 40,60)
$InputFileId = GUICtrlCreateInput ( "", 100, 25, 400, 20)
$OutputFileId = GUICtrlCreateInput ( "", 100, 55, 400, 20)
$btnInputFile = GUICtrlCreateButton ( "Browse for File", 520, 22, 110, 25)
$btnOPFolder = GUICtrlCreateButton ( "Browse for Location", 520, 53, 110, 25)
; Create the list of actions
$ActionList = GUICtrlCreateList( "", 25, 260, 70, 200)
GUICtrlSetData($ActionList, "Delete|Exclude|Include|Insert|Kill Blanks|Move|Remove|Replace|Switch", "Delete")
GUISetState(@SW_SHOW, $winMain)
While 1
$GUIMsg = GUIGetMsg()
Switch $GUIMsg
Case $GUI_EVENT_CLOSE
ExitLoop
Case $btnInputFile
MsgBox(0, "Info", "Input Button pressed")
Case $btnOPFolder
MsgBox(0, "Info", "Output Button pressed")
EndSwitch
WEnd
Func EditText($Window, $Caller, $p1, $p2)
Dim $winEdit
Dim $CtrlName
Dim $edtString
Dim $btnAccept
Dim $btnReject
Dim $Response
Dim $RetString
Dim $CtrlId
Dim $ActCode
Dim $HasFocus
$CtrlName = ControlGetFocus("Test for Editing Long Strings")
msgbox(0,"DOUBLE-CLICK!","Control: " & $CtrlId & @CRLF & "Action: " & $ActCode & @CRLF & "CtrlName: " & $CtrlName)
If StringInStr($CtrlName,"Edit") > 0 Then
$winEdit = GUICreate("Long String Editor", 790, 100, -1, -1, $WS_BORDER)
$edtString = GUICtrlCreateEdit("This is a potentially long string", 5, 5, 780, 20, $ES_AUTOHSCROLL)
$btnAccept = GUICtrlCreateButton( "Accept String", 240, 33, 100, 30)
$btnReject = GUICtrlCreateButton( "Reject String", 440, 33, 100, 30)
GUISetState(@SW_SHOW, $winEdit)
GUICtrlSetState($edtString, $GUI_FOCUS)
; sleep(5000)
;#cs
While 1
$Response = GUIGetMsg()
if $Response = $btnAccept Then
ExitLoop
EndIf
Select
Case $Response = $btnReject
     ExitLoop
Case $Response = $btnAccept
; GUICtrlSetData($CtrlName, $RetString)
     ExitLoop
Case Else
     $RetString = GUICtrlRead($edtString)
EndSelect
WEnd
;#ce
Else
Return $GUI_RUNDEFMSG
EndIf
GUICtrlSetData($CtrlName, $RetString)
GUIDelete($winEdit)
Return $GUI_RUNDEFMSG
EndFunc
Edited by jimollerhead

Share this post


Link to post
Share on other sites
guinness

Well what sticks out is you have the message registered before the GUI is created. Also a couple of other points...

  • Don't use Dim, try to use Local or Global exclusively. Read the help file as to why Dim can cause more issues than solve them
  • Use [autoit][/autoit] tags when posting AutoIt code.

UDF List:

 
_AdapterConnections()_AlwaysRun()_AppMon()_AppMonEx()_ArrayFilter/_ArrayReduce_BinaryBin()_CheckMsgBox()_CmdLineRaw()_ContextMenu()_ConvertLHWebColor()/_ConvertSHWebColor()_DesktopDimensions()_DisplayPassword()_DotNet_Load()/_DotNet_Unload()_Fibonacci()_FileCompare()_FileCompareContents()_FileNameByHandle()_FilePrefix/SRE()_FindInFile()_GetBackgroundColor()/_SetBackgroundColor()_GetConrolID()_GetCtrlClass()_GetDirectoryFormat()_GetDriveMediaType()_GetFilename()/_GetFilenameExt()_GetHardwareID()_GetIP()_GetIP_Country()_GetOSLanguage()_GetSavedSource()_GetStringSize()_GetSystemPaths()_GetURLImage()_GIFImage()_GoogleWeather()_GUICtrlCreateGroup()_GUICtrlListBox_CreateArray()_GUICtrlListView_CreateArray()_GUICtrlListView_SaveCSV()_GUICtrlListView_SaveHTML()_GUICtrlListView_SaveTxt()_GUICtrlListView_SaveXML()_GUICtrlMenu_Recent()_GUICtrlMenu_SetItemImage()_GUICtrlTreeView_CreateArray()_GUIDisable()_GUIImageList_SetIconFromHandle()_GUIRegisterMsg()_GUISetIcon()_Icon_Clear()/_Icon_Set()_IdleTime()_InetGet()_InetGetGUI()_InetGetProgress()_IPDetails()_IsFileOlder()_IsGUID()_IsHex()_IsPalindrome()_IsRegKey()_IsStringRegExp()_IsSystemDrive()_IsUPX()_IsValidType()_IsWebColor()_Language()_Log()_MicrosoftInternetConnectivity()_MSDNDataType()_PathFull/GetRelative/Split()_PathSplitEx()_PrintFromArray()_ProgressSetMarquee()_ReDim()_RockPaperScissors()/_RockPaperScissorsLizardSpock()_ScrollingCredits_SelfDelete()_SelfRename()_SelfUpdate()_SendTo()_ShellAll()_ShellFile()_ShellFolder()_SingletonHWID()_SingletonPID()_Startup()_StringCompact()_StringIsValid()_StringRegExpMetaCharacters()_StringReplaceWholeWord()_StringStripChars()_Temperature()_TrialPeriod()_UKToUSDate()/_USToUKDate()_WinAPI_Create_CTL_CODE()_WinAPI_CreateGUID()_WMIDateStringToDate()/_DateToWMIDateString()Au3 script parsingAutoIt SearchAutoIt3 PortableAutoIt3WrapperToPragmaAutoItWinGetTitle()/AutoItWinSetTitle()CodingDirToHTML5FileInstallrFileReadLastChars()GeoIP databaseGUI - Only Close ButtonGUI ExamplesGUICtrlDeleteImage()GUICtrlGetBkColor()GUICtrlGetStyle()GUIEventsGUIGetBkColor()Int_Parse() & Int_TryParse()IsISBN()LockFile()Mapping CtrlIDsOOP in AutoItParseHeadersToSciTE()PasswordValidPasteBinPosts Per DayPreExpandProtect GlobalsQueue()Resource UpdateResourcesExSciTE JumpSettings INISHELLHOOKShunting-YardSignature CreatorStack()Stopwatch()StringAddLF()/StringStripLF()StringEOLToCRLF()VSCROLLWM_COPYDATAMore Examples...

Updated: 22/04/2018

Share this post


Link to post
Share on other sites
jimollerhead

Thanks for the quick reply Guinnes, but I don't think that's what my main problem was... I was doing too much in the EditText function (despite having read sevreal times in the Forum that you should "get in and out fast" when interrupting the messaging!

Here is an "almost there" version....my main problem now is detecting the field that had the focus when the double-click occurred. Using the ControlGetFocus function returns the CLASNN name which is useless for later when I want to copy the string back into the calling field because I need the internal ID then. I suspect I can get it by diddling around with the third parameter but the usual bitshifting that you use with WM_COMMAND doesn't work with WM_LBUTTONDBLCLK.... Here's the revised "almost there" version: (BTW I did try to use the 'AutoIT code' thing to paste last time but it just sat there and would not accept my mouse click) -- I'll research the "Don't use dim" thing if you can tell me what section of the helpfile it's in -- most examples use Dim and nothing says don't use it....

#include
#include
#include
#include
#include

Dim $InputFileId
Dim $OutputFileId
Dim $winMain
Dim $GUIMsg
Dim $EditCtrlId
Dim $EditCtrlName
Dim $EditCtrlHandle
Dim $DoubleClick = False

GUIRegisterMsg($WM_LBUTTONDBLCLK, "DblClick")

$winMain = GUICreate ("Test for Editing Long Strings", 800, 560, -1, -1)
GUICtrlCreateLabel("File to Process", 22,30)
GUICtrlCreateLabel("Output File", 40,60)
$InputFileId = GUICtrlCreateInput ( "", 100, 25, 400, 20)
$OutputFileId = GUICtrlCreateInput ( "", 100, 55, 400, 20)
$btnInputFile = GUICtrlCreateButton ( "Browse for File", 520, 22, 110, 25)
$btnOPFolder = GUICtrlCreateButton ( "Browse for Location", 520, 53, 110, 25)
; Create the list of actions
$ActionList = GUICtrlCreateList( "", 25, 260, 70, 200)
GUICtrlSetData($ActionList, "Delete|Exclude|Include|Insert|Kill Blanks|Move|Remove|Replace|Switch", "Delete")
GUISetState(@SW_SHOW, $winMain)

While 1
$GUIMsg = GUIGetMsg()
Switch $GUIMsg
Case $GUI_EVENT_CLOSE
ExitLoop

Case $btnInputFile
MsgBox(0, "Info", "Input Button pressed")

Case $btnOPFolder
MsgBox(0, "Info", "Output Button pressed")
EndSwitch
If $DoubleClick Then
EditText()
EndIf
WEnd

Func DblClick($Window, $Caller, $p1, $p2)

$EditCtrlId = $p2 ; BitAND($p1, 0x0000FFFF)
$EditCtrlName = ControlGetFocus("Test for Editing Long Strings")
$EditCtrlHandle = ControlGetHandle("Test for Editing Long Strings", "", $EditCtrlName)
msgbox(0,"DOUBLE-CLICK!","Control: " & $EditCtrlId & @CRLF & "ControlName: " & $EditCtrlName & @CRLF & "Handle: " & $EditCtrlHandle)
$DoubleClick = True
Return $GUI_RUNDEFMSG
EndFunc

Func EditText()
Dim $winEdit
Dim $edtString
Dim $btnAccept
Dim $btnReject
Dim $Response
Dim $RetString

If StringInStr($EditCtrlName,"Edit") > 0 Then
$winEdit = GUICreate("Long String Editor", 790, 100, -1, -1, $WS_BORDER)
$edtString = GUICtrlCreateEdit("This is a potentially long string", 5, 5, 780, 20, $ES_AUTOHSCROLL)
$btnAccept = GUICtrlCreateButton( "Accept String", 240, 33, 100, 30)
$btnReject = GUICtrlCreateButton( "Reject String", 440, 33, 100, 30)
GUISetState(@SW_SHOW, $winEdit)
GUICtrlSetState($edtString, $GUI_FOCUS)

While 1
$Response = GUIGetMsg()
Select
Case $Response = $btnReject
ExitLoop
Case $Response = $btnAccept
GUICtrlSetData(5, $RetString)
; GUICtrlSetData($EditCtrlHandle, $RetString)
ExitLoop
Case Else
$RetString = GUICtrlRead($edtString)
EndSelect
WEnd
GUIDelete($winEdit)
EndIf
$DoubleClick = False
EndFunc
Edited by jimollerhead

Share this post


Link to post
Share on other sites
guinness

http://www.autoitscript.com/autoit3/docs/keywords/Dim.htm

You should use Local or Global, instead of Dim, to explicitly state which scope is desired for a variable/constant/array.

Also 99% of the examples don't use Dim, if they did then they've been zapped in the latest beta version of the help file.


UDF List:

 
_AdapterConnections()_AlwaysRun()_AppMon()_AppMonEx()_ArrayFilter/_ArrayReduce_BinaryBin()_CheckMsgBox()_CmdLineRaw()_ContextMenu()_ConvertLHWebColor()/_ConvertSHWebColor()_DesktopDimensions()_DisplayPassword()_DotNet_Load()/_DotNet_Unload()_Fibonacci()_FileCompare()_FileCompareContents()_FileNameByHandle()_FilePrefix/SRE()_FindInFile()_GetBackgroundColor()/_SetBackgroundColor()_GetConrolID()_GetCtrlClass()_GetDirectoryFormat()_GetDriveMediaType()_GetFilename()/_GetFilenameExt()_GetHardwareID()_GetIP()_GetIP_Country()_GetOSLanguage()_GetSavedSource()_GetStringSize()_GetSystemPaths()_GetURLImage()_GIFImage()_GoogleWeather()_GUICtrlCreateGroup()_GUICtrlListBox_CreateArray()_GUICtrlListView_CreateArray()_GUICtrlListView_SaveCSV()_GUICtrlListView_SaveHTML()_GUICtrlListView_SaveTxt()_GUICtrlListView_SaveXML()_GUICtrlMenu_Recent()_GUICtrlMenu_SetItemImage()_GUICtrlTreeView_CreateArray()_GUIDisable()_GUIImageList_SetIconFromHandle()_GUIRegisterMsg()_GUISetIcon()_Icon_Clear()/_Icon_Set()_IdleTime()_InetGet()_InetGetGUI()_InetGetProgress()_IPDetails()_IsFileOlder()_IsGUID()_IsHex()_IsPalindrome()_IsRegKey()_IsStringRegExp()_IsSystemDrive()_IsUPX()_IsValidType()_IsWebColor()_Language()_Log()_MicrosoftInternetConnectivity()_MSDNDataType()_PathFull/GetRelative/Split()_PathSplitEx()_PrintFromArray()_ProgressSetMarquee()_ReDim()_RockPaperScissors()/_RockPaperScissorsLizardSpock()_ScrollingCredits_SelfDelete()_SelfRename()_SelfUpdate()_SendTo()_ShellAll()_ShellFile()_ShellFolder()_SingletonHWID()_SingletonPID()_Startup()_StringCompact()_StringIsValid()_StringRegExpMetaCharacters()_StringReplaceWholeWord()_StringStripChars()_Temperature()_TrialPeriod()_UKToUSDate()/_USToUKDate()_WinAPI_Create_CTL_CODE()_WinAPI_CreateGUID()_WMIDateStringToDate()/_DateToWMIDateString()Au3 script parsingAutoIt SearchAutoIt3 PortableAutoIt3WrapperToPragmaAutoItWinGetTitle()/AutoItWinSetTitle()CodingDirToHTML5FileInstallrFileReadLastChars()GeoIP databaseGUI - Only Close ButtonGUI ExamplesGUICtrlDeleteImage()GUICtrlGetBkColor()GUICtrlGetStyle()GUIEventsGUIGetBkColor()Int_Parse() & Int_TryParse()IsISBN()LockFile()Mapping CtrlIDsOOP in AutoItParseHeadersToSciTE()PasswordValidPasteBinPosts Per DayPreExpandProtect GlobalsQueue()Resource UpdateResourcesExSciTE JumpSettings INISHELLHOOKShunting-YardSignature CreatorStack()Stopwatch()StringAddLF()/StringStripLF()StringEOLToCRLF()VSCROLLWM_COPYDATAMore Examples...

Updated: 22/04/2018

Share this post


Link to post
Share on other sites
jimollerhead

OK thanks for the link...I was expecting some kind of performance-related reason rather than being too gormless to differentiate locals and globals without explicitly saying so. As I've been programming professionally with 3GLs since the early 80's (Basic then Pascal, the king of 3GLs, then C) I think I am OK to manage to make the differentiation unaided. I will, however take the advice for future AutoIt code if only to make it more readable for posting in the forum. My far more pressing issue is trying to identify the ID for the control that has the focus in my code!

Regards,

Jim.

Share this post


Link to post
Share on other sites
jimollerhead

Sorted! Found this little beauty in a Forum example: _WinAPI_GetDlgCtrlID - Thank you, thank you, thank you, Authenticity!!

It effectively is just a converter that takes a handle in and spits an ID (i.e. what you get from the Create...statement) out!

Here's the finally working beast:

#include <WindowsConstants.au3>
#include <ButtonConstants.au3>
#include <GuiConstantsEx.au3>
#include <EditConstants.au3>
#include <ListBoxConstants.au3>
#include <WinAPI.au3>
Global $InputFileId
Global $OutputFileId
Global $winMain
Global $GUIMsg
Global $EditCtrlId
Global $EditCtrlName
Global $EditCtrlHandle
Global $DoubleClick = False
$winMain = GUICreate ("Test for Editing Long Strings", 800, 560, -1, -1)
GUICtrlCreateLabel("File to Process", 22,30)
GUICtrlCreateLabel("Output File", 40,60)
$InputFileId = GUICtrlCreateInput ( "", 100, 25, 400, 20)
$OutputFileId = GUICtrlCreateInput ( "", 100, 55, 400, 20)
$btnInputFile = GUICtrlCreateButton ( "Browse for File", 520, 22, 110, 25)
$btnOPFolder = GUICtrlCreateButton ( "Browse for Location", 520, 53, 110, 25)
; Create the list of actions
$ActionList = GUICtrlCreateList( "", 25, 260, 70, 200)
GUICtrlSetData($ActionList, "Delete|Exclude|Include|Insert|Kill Blanks|Move|Remove|Replace|Switch", "Delete")
GUISetState(@SW_SHOW, $winMain)
GUIRegisterMsg($WM_LBUTTONDBLCLK, "DblClick")
While 1
$GUIMsg = GUIGetMsg()
Switch $GUIMsg
Case $GUI_EVENT_CLOSE
ExitLoop
Case $btnInputFile
MsgBox(0, "Info", "Input Button pressed")
Case $btnOPFolder
MsgBox(0, "Info", "Output Button pressed")
EndSwitch
If $DoubleClick Then
EditText()
EndIf
WEnd
Func DblClick($Window, $Caller, $p1, $p2)
; $EditCtrlId = $p2 ; BitAND($p1, 0x0000FFFF)
$EditCtrlName = ControlGetFocus("Test for Editing Long Strings")
$EditCtrlHandle = ControlGetHandle("Test for Editing Long Strings", "", $EditCtrlName)
$EditCtrlId = _WinAPI_GetDlgCtrlID($EditCtrlHandle)
msgbox(0,"DOUBLE-CLICK!","Control: " & $EditCtrlId & @CRLF & "ControlName: " & $EditCtrlName & @CRLF & "Handle: " & $EditCtrlHandle)
$DoubleClick = True
Return $GUI_RUNDEFMSG
EndFunc
Func EditText()
Local $winEdit
Local $edtString
Local $btnAccept
Local $btnReject
Local $Response
Local $RetString
If StringInStr($EditCtrlName,"Edit") > 0 Then
$winEdit = GUICreate("Long String Editor", 790, 100, -1, -1, $WS_BORDER)
$edtString = GUICtrlCreateEdit("This is a potentially long string", 5, 5, 780, 20, $ES_AUTOHSCROLL)
$btnAccept = GUICtrlCreateButton( "Accept String", 240, 33, 100, 30)
$btnReject = GUICtrlCreateButton( "Reject String", 440, 33, 100, 30)
GUISetState(@SW_SHOW, $winEdit)
GUICtrlSetState($edtString, $GUI_FOCUS)
While 1
$Response = GUIGetMsg()
Select
    Case $Response = $btnReject
     ExitLoop
    Case $Response = $btnAccept
;    GUICtrlSetData(5, $RetString)
     GUICtrlSetData($EditCtrlId, $RetString)
     ExitLoop
    Case Else
     $RetString = GUICtrlRead($edtString)
EndSelect
WEnd
GUIDelete($winEdit)
EndIf
$DoubleClick = False
EndFunc
Edited by jimollerhead

Share this post


Link to post
Share on other sites
guinness

This is how the message should be structured as per the instructions of the help file...

#include <GUIConstantsEx.au3>
#include <WinAPI.au3>
#include <WindowsConstants.au3>

Example()

Func Example()
    Local $hGUI = GUICreate('Left Button Click', 300, 300)

    GUIRegisterMsg($WM_LBUTTONDBLCLK, 'WM_LBUTTONDBLCLK')
    GUISetState(@SW_SHOW, $hGUI)

    While 1
        Switch GUIGetMsg()
            Case $GUI_EVENT_CLOSE
                ExitLoop

        EndSwitch
    WEnd
    GUIDelete($hGUI)
EndFunc   ;==>Example

; http://msdn.microsoft.com/en-us/library/windows/desktop/ms645606(v=vs.85).aspx
Func WM_LBUTTONDBLCLK($hWnd, $iMsg, $wParam, $lParam)
    #forceref $hWnd, $iMsg
    Local $iCode = _WinAPI_LoWord($wParam)
    Local $iX = _WinAPI_LoWord($lParam)
    Local $iY = _WinAPI_HiWord($lParam)
    ConsoleWrite($iCode & ' - Double-Click on GUI:  hWnd = ' & $hWnd & '; X = ' & $iX & '; Y = ' & $iY & @CRLF)
    Return $GUI_RUNDEFMSG
EndFunc   ;==>WM_LBUTTONDBLCLK

I still feel inclined to help and provide a more robust solution, but you seem to have things in hand.

Edited by guinness

UDF List:

 
_AdapterConnections()_AlwaysRun()_AppMon()_AppMonEx()_ArrayFilter/_ArrayReduce_BinaryBin()_CheckMsgBox()_CmdLineRaw()_ContextMenu()_ConvertLHWebColor()/_ConvertSHWebColor()_DesktopDimensions()_DisplayPassword()_DotNet_Load()/_DotNet_Unload()_Fibonacci()_FileCompare()_FileCompareContents()_FileNameByHandle()_FilePrefix/SRE()_FindInFile()_GetBackgroundColor()/_SetBackgroundColor()_GetConrolID()_GetCtrlClass()_GetDirectoryFormat()_GetDriveMediaType()_GetFilename()/_GetFilenameExt()_GetHardwareID()_GetIP()_GetIP_Country()_GetOSLanguage()_GetSavedSource()_GetStringSize()_GetSystemPaths()_GetURLImage()_GIFImage()_GoogleWeather()_GUICtrlCreateGroup()_GUICtrlListBox_CreateArray()_GUICtrlListView_CreateArray()_GUICtrlListView_SaveCSV()_GUICtrlListView_SaveHTML()_GUICtrlListView_SaveTxt()_GUICtrlListView_SaveXML()_GUICtrlMenu_Recent()_GUICtrlMenu_SetItemImage()_GUICtrlTreeView_CreateArray()_GUIDisable()_GUIImageList_SetIconFromHandle()_GUIRegisterMsg()_GUISetIcon()_Icon_Clear()/_Icon_Set()_IdleTime()_InetGet()_InetGetGUI()_InetGetProgress()_IPDetails()_IsFileOlder()_IsGUID()_IsHex()_IsPalindrome()_IsRegKey()_IsStringRegExp()_IsSystemDrive()_IsUPX()_IsValidType()_IsWebColor()_Language()_Log()_MicrosoftInternetConnectivity()_MSDNDataType()_PathFull/GetRelative/Split()_PathSplitEx()_PrintFromArray()_ProgressSetMarquee()_ReDim()_RockPaperScissors()/_RockPaperScissorsLizardSpock()_ScrollingCredits_SelfDelete()_SelfRename()_SelfUpdate()_SendTo()_ShellAll()_ShellFile()_ShellFolder()_SingletonHWID()_SingletonPID()_Startup()_StringCompact()_StringIsValid()_StringRegExpMetaCharacters()_StringReplaceWholeWord()_StringStripChars()_Temperature()_TrialPeriod()_UKToUSDate()/_USToUKDate()_WinAPI_Create_CTL_CODE()_WinAPI_CreateGUID()_WMIDateStringToDate()/_DateToWMIDateString()Au3 script parsingAutoIt SearchAutoIt3 PortableAutoIt3WrapperToPragmaAutoItWinGetTitle()/AutoItWinSetTitle()CodingDirToHTML5FileInstallrFileReadLastChars()GeoIP databaseGUI - Only Close ButtonGUI ExamplesGUICtrlDeleteImage()GUICtrlGetBkColor()GUICtrlGetStyle()GUIEventsGUIGetBkColor()Int_Parse() & Int_TryParse()IsISBN()LockFile()Mapping CtrlIDsOOP in AutoItParseHeadersToSciTE()PasswordValidPasteBinPosts Per DayPreExpandProtect GlobalsQueue()Resource UpdateResourcesExSciTE JumpSettings INISHELLHOOKShunting-YardSignature CreatorStack()Stopwatch()StringAddLF()/StringStripLF()StringEOLToCRLF()VSCROLLWM_COPYDATAMore Examples...

Updated: 22/04/2018

Share this post


Link to post
Share on other sites
kylomas

jimollerhead,

F.Y.I. - a method of detecting input control double clicks using control subclassing

; *** Start added by AutoIt3Wrapper ***
#include <WindowsConstants.au3>
; *** End added by AutoIt3Wrapper ***

; based on code developed by D4ARKON3 and modified by PhoenixXL

#AutoIt3Wrapper_Add_Constants=n

Local $gui010 = GUICreate('SubClass Two Input Controls', 400, 300)
Local $inp010 = GUICtrlCreateInput('', 10, 20, 380, 20)
Local $inp020 = GUICtrlCreateInput('', 10, 120, 380, 20)
GUISetState()

$hInputSubClassProc = DllCallbackGetPtr(DllCallbackRegister('_InputSubClassProc', 'LRESULT', 'HWND;UINT;WPARAM;LPARAM;UINT_PTR;DWORD_PTR'))
If ($hInputSubClassProc == 0) Then
    MsgBox(16, 'Subclass Test', 'Call to DllCallbackRegister failed.')
    Exit
EndIf

SetWindowSubclass(GUICtrlGetHandle($inp010), $hInputSubClassProc, 0, 0)
If (@error) Then
    MsgBox(16, 'Subclass Test', 'Call to WinProc for inp010 failed.')
    Exit
EndIf

SetWindowSubclass(GUICtrlGetHandle($inp020), $hInputSubClassProc, 1, 0)
If (@error) Then
    MsgBox(16, 'Subclass Test', 'Call to WinProc for inp020 failed.')
    Exit
EndIf

While (True)
    Switch (GUIGetMsg())
        Case -3 ;GUI_EVENT_CLOSE
            ExitLoop
    EndSwitch
WEnd

RemoveWindowSubclass(GUICtrlGetHandle($inp010), $hInputSubClassProc, 0, 0)
RemoveWindowSubclass(GUICtrlGetHandle($inp020), $hInputSubClassProc, 1, 0)

Exit

Func _InputSubClassProc($hWnd, $uMsg, $wParam, $lParam, $uIdSubclass, $dwRefData)
    Switch $uMsg
        Case $wm_lbuttondblclk
            Switch $uIdSubclass
                Case 0
                    GUICtrlSetData($inp010, 'I was double clicked')
                Case 1
                    GUICtrlSetData($inp020, 'I was double clicked')
            EndSwitch
    EndSwitch
    Return DefSubclassProc($hWnd, $uMsg, $wParam, $lParam)
EndFunc   ;==>_InputSubClassProc

Func SetWindowSubclass($hWnd, $pfnSubclass, $uIdSubclass, $dwRefData)
    Local $bResult = DllCall('Comctl32.dll', 'BOOL', 'SetWindowSubclass', _
            'HWND', $hWnd, _
            'ptr', $pfnSubclass, _
            'UINT_PTR', $uIdSubclass, _
            'DWORD_PTR', $dwRefData)
    If (@error) Or ($bResult[0] == 0) Then Return SetError(1, 0, 0)
    Return SetError(0, 0, 1)
EndFunc   ;==>SetWindowSubclass

Func GetWindowSubclass($hWnd, $pfnSubclass, $uIdSubclass, ByRef $dwRefData)
    Local $bResult = DllCall('Comctl32.dll', 'BOOL', 'GetWindowSubclass', _
            'HWND', $hWnd, _
            'ptr', $pfnSubclass, _
            'UINT_PTR', $uIdSubclass, _
            'DWORD_PTR*', 0)
    If (@error) Or ($bResult[0] == 0) Then Return SetError(1, 0, 0)
    $dwRefData = $bResult[4]
    Return SetError(0, 0, 1)
EndFunc   ;==>GetWindowSubclass

Func RemoveWindowSubclass($hWnd, $pfnSubclass, $uIdSubclass, $dwRefData)
    Local $bResult = DllCall('Comctl32.dll', 'BOOL', 'RemoveWindowSubclass', _
            'HWND', $hWnd, _
            'ptr', $pfnSubclass, _
            'UINT_PTR', $uIdSubclass)
    If (@error) Or ($bResult[0] == 0) Then Return SetError(1, 0, 0)
    Return SetError(0, 0, 1)
EndFunc   ;==>RemoveWindowSubclass

Func DefSubclassProc($hWnd, $uMsg, $wParam, $lParam)
    Local $aRet = DllCall('Comctl32.dll', 'LRESULT', 'DefSubclassProc', _
            'HWND', $hWnd, _
            'UINT', $uMsg, _
            'WPARAM', $wParam, _
            'LPARAM', $lParam)
    Return $aRet[0]
EndFunc   ;==>DefSubclassProc

kylomas


Forum Rules         Procedure for posting code

"I like pigs.  Dogs look up to us.  Cats look down on us.  Pigs treat us as equals."

- Sir Winston Churchill

Share this post


Link to post
Share on other sites
guinness

That's not for your 'average AutoIt user' and actually you've given me my next topic to grasp. Thanks kylomas.


UDF List:

 
_AdapterConnections()_AlwaysRun()_AppMon()_AppMonEx()_ArrayFilter/_ArrayReduce_BinaryBin()_CheckMsgBox()_CmdLineRaw()_ContextMenu()_ConvertLHWebColor()/_ConvertSHWebColor()_DesktopDimensions()_DisplayPassword()_DotNet_Load()/_DotNet_Unload()_Fibonacci()_FileCompare()_FileCompareContents()_FileNameByHandle()_FilePrefix/SRE()_FindInFile()_GetBackgroundColor()/_SetBackgroundColor()_GetConrolID()_GetCtrlClass()_GetDirectoryFormat()_GetDriveMediaType()_GetFilename()/_GetFilenameExt()_GetHardwareID()_GetIP()_GetIP_Country()_GetOSLanguage()_GetSavedSource()_GetStringSize()_GetSystemPaths()_GetURLImage()_GIFImage()_GoogleWeather()_GUICtrlCreateGroup()_GUICtrlListBox_CreateArray()_GUICtrlListView_CreateArray()_GUICtrlListView_SaveCSV()_GUICtrlListView_SaveHTML()_GUICtrlListView_SaveTxt()_GUICtrlListView_SaveXML()_GUICtrlMenu_Recent()_GUICtrlMenu_SetItemImage()_GUICtrlTreeView_CreateArray()_GUIDisable()_GUIImageList_SetIconFromHandle()_GUIRegisterMsg()_GUISetIcon()_Icon_Clear()/_Icon_Set()_IdleTime()_InetGet()_InetGetGUI()_InetGetProgress()_IPDetails()_IsFileOlder()_IsGUID()_IsHex()_IsPalindrome()_IsRegKey()_IsStringRegExp()_IsSystemDrive()_IsUPX()_IsValidType()_IsWebColor()_Language()_Log()_MicrosoftInternetConnectivity()_MSDNDataType()_PathFull/GetRelative/Split()_PathSplitEx()_PrintFromArray()_ProgressSetMarquee()_ReDim()_RockPaperScissors()/_RockPaperScissorsLizardSpock()_ScrollingCredits_SelfDelete()_SelfRename()_SelfUpdate()_SendTo()_ShellAll()_ShellFile()_ShellFolder()_SingletonHWID()_SingletonPID()_Startup()_StringCompact()_StringIsValid()_StringRegExpMetaCharacters()_StringReplaceWholeWord()_StringStripChars()_Temperature()_TrialPeriod()_UKToUSDate()/_USToUKDate()_WinAPI_Create_CTL_CODE()_WinAPI_CreateGUID()_WMIDateStringToDate()/_DateToWMIDateString()Au3 script parsingAutoIt SearchAutoIt3 PortableAutoIt3WrapperToPragmaAutoItWinGetTitle()/AutoItWinSetTitle()CodingDirToHTML5FileInstallrFileReadLastChars()GeoIP databaseGUI - Only Close ButtonGUI ExamplesGUICtrlDeleteImage()GUICtrlGetBkColor()GUICtrlGetStyle()GUIEventsGUIGetBkColor()Int_Parse() & Int_TryParse()IsISBN()LockFile()Mapping CtrlIDsOOP in AutoItParseHeadersToSciTE()PasswordValidPasteBinPosts Per DayPreExpandProtect GlobalsQueue()Resource UpdateResourcesExSciTE JumpSettings INISHELLHOOKShunting-YardSignature CreatorStack()Stopwatch()StringAddLF()/StringStripLF()StringEOLToCRLF()VSCROLLWM_COPYDATAMore Examples...

Updated: 22/04/2018

Share this post


Link to post
Share on other sites
kylomas

D4RKON3 developed the UDF (in examples section), PhoenixXL corrected some errors and provided example.

MSDN has a small intro here.


Forum Rules         Procedure for posting code

"I like pigs.  Dogs look up to us.  Cats look down on us.  Pigs treat us as equals."

- Sir Winston Churchill

Share this post


Link to post
Share on other sites
guinness

Thanks. I could see from the comments you were only the messenger 0_-.


UDF List:

 
_AdapterConnections()_AlwaysRun()_AppMon()_AppMonEx()_ArrayFilter/_ArrayReduce_BinaryBin()_CheckMsgBox()_CmdLineRaw()_ContextMenu()_ConvertLHWebColor()/_ConvertSHWebColor()_DesktopDimensions()_DisplayPassword()_DotNet_Load()/_DotNet_Unload()_Fibonacci()_FileCompare()_FileCompareContents()_FileNameByHandle()_FilePrefix/SRE()_FindInFile()_GetBackgroundColor()/_SetBackgroundColor()_GetConrolID()_GetCtrlClass()_GetDirectoryFormat()_GetDriveMediaType()_GetFilename()/_GetFilenameExt()_GetHardwareID()_GetIP()_GetIP_Country()_GetOSLanguage()_GetSavedSource()_GetStringSize()_GetSystemPaths()_GetURLImage()_GIFImage()_GoogleWeather()_GUICtrlCreateGroup()_GUICtrlListBox_CreateArray()_GUICtrlListView_CreateArray()_GUICtrlListView_SaveCSV()_GUICtrlListView_SaveHTML()_GUICtrlListView_SaveTxt()_GUICtrlListView_SaveXML()_GUICtrlMenu_Recent()_GUICtrlMenu_SetItemImage()_GUICtrlTreeView_CreateArray()_GUIDisable()_GUIImageList_SetIconFromHandle()_GUIRegisterMsg()_GUISetIcon()_Icon_Clear()/_Icon_Set()_IdleTime()_InetGet()_InetGetGUI()_InetGetProgress()_IPDetails()_IsFileOlder()_IsGUID()_IsHex()_IsPalindrome()_IsRegKey()_IsStringRegExp()_IsSystemDrive()_IsUPX()_IsValidType()_IsWebColor()_Language()_Log()_MicrosoftInternetConnectivity()_MSDNDataType()_PathFull/GetRelative/Split()_PathSplitEx()_PrintFromArray()_ProgressSetMarquee()_ReDim()_RockPaperScissors()/_RockPaperScissorsLizardSpock()_ScrollingCredits_SelfDelete()_SelfRename()_SelfUpdate()_SendTo()_ShellAll()_ShellFile()_ShellFolder()_SingletonHWID()_SingletonPID()_Startup()_StringCompact()_StringIsValid()_StringRegExpMetaCharacters()_StringReplaceWholeWord()_StringStripChars()_Temperature()_TrialPeriod()_UKToUSDate()/_USToUKDate()_WinAPI_Create_CTL_CODE()_WinAPI_CreateGUID()_WMIDateStringToDate()/_DateToWMIDateString()Au3 script parsingAutoIt SearchAutoIt3 PortableAutoIt3WrapperToPragmaAutoItWinGetTitle()/AutoItWinSetTitle()CodingDirToHTML5FileInstallrFileReadLastChars()GeoIP databaseGUI - Only Close ButtonGUI ExamplesGUICtrlDeleteImage()GUICtrlGetBkColor()GUICtrlGetStyle()GUIEventsGUIGetBkColor()Int_Parse() & Int_TryParse()IsISBN()LockFile()Mapping CtrlIDsOOP in AutoItParseHeadersToSciTE()PasswordValidPasteBinPosts Per DayPreExpandProtect GlobalsQueue()Resource UpdateResourcesExSciTE JumpSettings INISHELLHOOKShunting-YardSignature CreatorStack()Stopwatch()StringAddLF()/StringStripLF()StringEOLToCRLF()VSCROLLWM_COPYDATAMore Examples...

Updated: 22/04/2018

Share this post


Link to post
Share on other sites
Melba23

kylomas,

Thank you for posting that - I have been trying (and failing) to detect double-clicks in inputs since this thread started. ;)

M23


Any of my own code posted anywhere on the forum is available for use by others without any restriction of any kind._______My UDFs:

Spoiler

ArrayMultiColSort ---- Sort arrays on multiple columns
ChooseFileFolder ---- Single and multiple selections from specified path treeview listing
Date_Time_Convert -- Easily convert date/time formats, including the language used
ExtMsgBox --------- A highly customisable replacement for MsgBox
GUIExtender -------- Extend and retract multiple sections within a GUI
GUIFrame ---------- Subdivide GUIs into many adjustable frames
GUIListViewEx ------- Insert, delete, move, drag, sort, edit and colour ListView items
GUITreeViewEx ------ Check/clear parent and child checkboxes in a TreeView
Marquee ----------- Scrolling tickertape GUIs
NoFocusLines ------- Remove the dotted focus lines from buttons, sliders, radios and checkboxes
Notify ------------- Small notifications on the edge of the display
Scrollbars ----------Automatically sized scrollbars with a single command
StringSize ---------- Automatically size controls to fit text
Toast -------------- Small GUIs which pop out of the notification area

 

Share this post


Link to post
Share on other sites
kylomas

Thanks. I could see from the comments you were only the messenger 0_-.

 

Clarification - D4ARKON developed the UDF.  PhoenixXL corrected a problem with not handing back control correctly.  I wrote this code using an example from the origional topic but expanded it it to show subclassing multiple controls to the same procedure (function).  You can probably tell that from the coding style.

Not to get all anal about it but if there is something wrong with this code then I don't want it to blow back on PhoenixXL or D4RKON3...

edit: spelling

Edited by kylomas

Forum Rules         Procedure for posting code

"I like pigs.  Dogs look up to us.  Cats look down on us.  Pigs treat us as equals."

- Sir Winston Churchill

Share this post


Link to post
Share on other sites
guinness

You can probably tell that from the coding style.

Your style is unique, that's true. 0_-


UDF List:

 
_AdapterConnections()_AlwaysRun()_AppMon()_AppMonEx()_ArrayFilter/_ArrayReduce_BinaryBin()_CheckMsgBox()_CmdLineRaw()_ContextMenu()_ConvertLHWebColor()/_ConvertSHWebColor()_DesktopDimensions()_DisplayPassword()_DotNet_Load()/_DotNet_Unload()_Fibonacci()_FileCompare()_FileCompareContents()_FileNameByHandle()_FilePrefix/SRE()_FindInFile()_GetBackgroundColor()/_SetBackgroundColor()_GetConrolID()_GetCtrlClass()_GetDirectoryFormat()_GetDriveMediaType()_GetFilename()/_GetFilenameExt()_GetHardwareID()_GetIP()_GetIP_Country()_GetOSLanguage()_GetSavedSource()_GetStringSize()_GetSystemPaths()_GetURLImage()_GIFImage()_GoogleWeather()_GUICtrlCreateGroup()_GUICtrlListBox_CreateArray()_GUICtrlListView_CreateArray()_GUICtrlListView_SaveCSV()_GUICtrlListView_SaveHTML()_GUICtrlListView_SaveTxt()_GUICtrlListView_SaveXML()_GUICtrlMenu_Recent()_GUICtrlMenu_SetItemImage()_GUICtrlTreeView_CreateArray()_GUIDisable()_GUIImageList_SetIconFromHandle()_GUIRegisterMsg()_GUISetIcon()_Icon_Clear()/_Icon_Set()_IdleTime()_InetGet()_InetGetGUI()_InetGetProgress()_IPDetails()_IsFileOlder()_IsGUID()_IsHex()_IsPalindrome()_IsRegKey()_IsStringRegExp()_IsSystemDrive()_IsUPX()_IsValidType()_IsWebColor()_Language()_Log()_MicrosoftInternetConnectivity()_MSDNDataType()_PathFull/GetRelative/Split()_PathSplitEx()_PrintFromArray()_ProgressSetMarquee()_ReDim()_RockPaperScissors()/_RockPaperScissorsLizardSpock()_ScrollingCredits_SelfDelete()_SelfRename()_SelfUpdate()_SendTo()_ShellAll()_ShellFile()_ShellFolder()_SingletonHWID()_SingletonPID()_Startup()_StringCompact()_StringIsValid()_StringRegExpMetaCharacters()_StringReplaceWholeWord()_StringStripChars()_Temperature()_TrialPeriod()_UKToUSDate()/_USToUKDate()_WinAPI_Create_CTL_CODE()_WinAPI_CreateGUID()_WMIDateStringToDate()/_DateToWMIDateString()Au3 script parsingAutoIt SearchAutoIt3 PortableAutoIt3WrapperToPragmaAutoItWinGetTitle()/AutoItWinSetTitle()CodingDirToHTML5FileInstallrFileReadLastChars()GeoIP databaseGUI - Only Close ButtonGUI ExamplesGUICtrlDeleteImage()GUICtrlGetBkColor()GUICtrlGetStyle()GUIEventsGUIGetBkColor()Int_Parse() & Int_TryParse()IsISBN()LockFile()Mapping CtrlIDsOOP in AutoItParseHeadersToSciTE()PasswordValidPasteBinPosts Per DayPreExpandProtect GlobalsQueue()Resource UpdateResourcesExSciTE JumpSettings INISHELLHOOKShunting-YardSignature CreatorStack()Stopwatch()StringAddLF()/StringStripLF()StringEOLToCRLF()VSCROLLWM_COPYDATAMore Examples...

Updated: 22/04/2018

Share this post


Link to post
Share on other sites
jimollerhead

Thanks for carrying on with this folks even though I managed a solution (of sorts)

@Guinness, I did indeed spot that example in the helpfile, however knowing the X/Y coordinates at the time of the double-click would give me no end of grief in performing other programming cartwheels in order to figure out which of the many (and dynamically created and destroyed within the app) input fields named 'EditN' the mouse cursor was over.... my main problem in the end was switching from the CLASSNN descriptor to the ID which I had to do by going via the handle.... it would be nice for the double-click to be actually ON the edit field rather than close to it but I am happy with "good enough" rather than "perfect" using the 80/20 rule of programming!! In case you are curious what I am up to, the executable is called Textreme and downloadable from jollybean.co.uk -- I had an enhancement request from a user asking if it would be possible to have a pop-up editor for the functon parameters as some of his search strings were quite long and he'd like to see them in full without having to sideways-scroll the input box. BTW, the current release doesn't yet incorporate the Long String Editor, because the same user asked for a batch run function which is even more work!

@kylomas - Whilst I am sure that your example is a neat and elegant solution, I use AutoIT to *avoid* DLL-hell, not to jump straight in welly-deep! Thank you for contributing though and, even though I am not taking on your solution, you have apparently helped out Melba23 in the process!

Share this post


Link to post
Share on other sites
kylomas

If it works, it works...K.I.S.S.


Forum Rules         Procedure for posting code

"I like pigs.  Dogs look up to us.  Cats look down on us.  Pigs treat us as equals."

- Sir Winston Churchill

Share this post


Link to post
Share on other sites
guinness

I'm aware of Textreme, didn't realise you were the developer though.

Believe it or not I used to be anti-UDF, anti-DLL, anti-GUIRegisterMsg, anti-non-Native AutoIt functions but that's the old me.


UDF List:

 
_AdapterConnections()_AlwaysRun()_AppMon()_AppMonEx()_ArrayFilter/_ArrayReduce_BinaryBin()_CheckMsgBox()_CmdLineRaw()_ContextMenu()_ConvertLHWebColor()/_ConvertSHWebColor()_DesktopDimensions()_DisplayPassword()_DotNet_Load()/_DotNet_Unload()_Fibonacci()_FileCompare()_FileCompareContents()_FileNameByHandle()_FilePrefix/SRE()_FindInFile()_GetBackgroundColor()/_SetBackgroundColor()_GetConrolID()_GetCtrlClass()_GetDirectoryFormat()_GetDriveMediaType()_GetFilename()/_GetFilenameExt()_GetHardwareID()_GetIP()_GetIP_Country()_GetOSLanguage()_GetSavedSource()_GetStringSize()_GetSystemPaths()_GetURLImage()_GIFImage()_GoogleWeather()_GUICtrlCreateGroup()_GUICtrlListBox_CreateArray()_GUICtrlListView_CreateArray()_GUICtrlListView_SaveCSV()_GUICtrlListView_SaveHTML()_GUICtrlListView_SaveTxt()_GUICtrlListView_SaveXML()_GUICtrlMenu_Recent()_GUICtrlMenu_SetItemImage()_GUICtrlTreeView_CreateArray()_GUIDisable()_GUIImageList_SetIconFromHandle()_GUIRegisterMsg()_GUISetIcon()_Icon_Clear()/_Icon_Set()_IdleTime()_InetGet()_InetGetGUI()_InetGetProgress()_IPDetails()_IsFileOlder()_IsGUID()_IsHex()_IsPalindrome()_IsRegKey()_IsStringRegExp()_IsSystemDrive()_IsUPX()_IsValidType()_IsWebColor()_Language()_Log()_MicrosoftInternetConnectivity()_MSDNDataType()_PathFull/GetRelative/Split()_PathSplitEx()_PrintFromArray()_ProgressSetMarquee()_ReDim()_RockPaperScissors()/_RockPaperScissorsLizardSpock()_ScrollingCredits_SelfDelete()_SelfRename()_SelfUpdate()_SendTo()_ShellAll()_ShellFile()_ShellFolder()_SingletonHWID()_SingletonPID()_Startup()_StringCompact()_StringIsValid()_StringRegExpMetaCharacters()_StringReplaceWholeWord()_StringStripChars()_Temperature()_TrialPeriod()_UKToUSDate()/_USToUKDate()_WinAPI_Create_CTL_CODE()_WinAPI_CreateGUID()_WMIDateStringToDate()/_DateToWMIDateString()Au3 script parsingAutoIt SearchAutoIt3 PortableAutoIt3WrapperToPragmaAutoItWinGetTitle()/AutoItWinSetTitle()CodingDirToHTML5FileInstallrFileReadLastChars()GeoIP databaseGUI - Only Close ButtonGUI ExamplesGUICtrlDeleteImage()GUICtrlGetBkColor()GUICtrlGetStyle()GUIEventsGUIGetBkColor()Int_Parse() & Int_TryParse()IsISBN()LockFile()Mapping CtrlIDsOOP in AutoItParseHeadersToSciTE()PasswordValidPasteBinPosts Per DayPreExpandProtect GlobalsQueue()Resource UpdateResourcesExSciTE JumpSettings INISHELLHOOKShunting-YardSignature CreatorStack()Stopwatch()StringAddLF()/StringStripLF()StringEOLToCRLF()VSCROLLWM_COPYDATAMore Examples...

Updated: 22/04/2018

Share this post


Link to post
Share on other sites
jimollerhead

Well that's one of the most surprising things I have read in the forum -- that someone was "aware" of Textreme!

It's very much just a hobby project that was originally much simpler and for my own use only, that I have expanded the versatility of over time. As I use my own name in here you can now, I guess, make the link from the warp of my initial and surname to the website name!  :o)   I don't make any efforts to hide the WhoIs info so it would hardly take Clouseau to track down the registered owner! 

Personally, I am not really "anti" anything *provided there is supporting information*. The 3rd and 4th parameters of the GUIRegisterMsg-responding function obviously contain different things depending upon which of the Windows messages you are intercepting. How you all know what these are is a mystery to me as is how you find out about the DLL functions, what they do,  and the parameters they expect/return. There is nowt to be found in the help file (nor would I expect there to be, TBH) so you must have some esoteric info gained from somewhere that I have no knowledge of!

Share this post


Link to post
Share on other sites
guinness

How you all know what these are is a mystery to me as is how you find out about the DLL functions, what they do,  and the parameters they expect/return. There is nowt to be found in the help file (nor would I expect there to be, TBH) so you must have some esoteric info gained from somewhere that I have no knowledge of!

 

By reading MSDN and looking at working examples. The help file explains the function, but the backend stuff is nothing to do with AutoIt. Also considering Microsoft are changing this and that, would mean the help would soon become out dated.


UDF List:

 
_AdapterConnections()_AlwaysRun()_AppMon()_AppMonEx()_ArrayFilter/_ArrayReduce_BinaryBin()_CheckMsgBox()_CmdLineRaw()_ContextMenu()_ConvertLHWebColor()/_ConvertSHWebColor()_DesktopDimensions()_DisplayPassword()_DotNet_Load()/_DotNet_Unload()_Fibonacci()_FileCompare()_FileCompareContents()_FileNameByHandle()_FilePrefix/SRE()_FindInFile()_GetBackgroundColor()/_SetBackgroundColor()_GetConrolID()_GetCtrlClass()_GetDirectoryFormat()_GetDriveMediaType()_GetFilename()/_GetFilenameExt()_GetHardwareID()_GetIP()_GetIP_Country()_GetOSLanguage()_GetSavedSource()_GetStringSize()_GetSystemPaths()_GetURLImage()_GIFImage()_GoogleWeather()_GUICtrlCreateGroup()_GUICtrlListBox_CreateArray()_GUICtrlListView_CreateArray()_GUICtrlListView_SaveCSV()_GUICtrlListView_SaveHTML()_GUICtrlListView_SaveTxt()_GUICtrlListView_SaveXML()_GUICtrlMenu_Recent()_GUICtrlMenu_SetItemImage()_GUICtrlTreeView_CreateArray()_GUIDisable()_GUIImageList_SetIconFromHandle()_GUIRegisterMsg()_GUISetIcon()_Icon_Clear()/_Icon_Set()_IdleTime()_InetGet()_InetGetGUI()_InetGetProgress()_IPDetails()_IsFileOlder()_IsGUID()_IsHex()_IsPalindrome()_IsRegKey()_IsStringRegExp()_IsSystemDrive()_IsUPX()_IsValidType()_IsWebColor()_Language()_Log()_MicrosoftInternetConnectivity()_MSDNDataType()_PathFull/GetRelative/Split()_PathSplitEx()_PrintFromArray()_ProgressSetMarquee()_ReDim()_RockPaperScissors()/_RockPaperScissorsLizardSpock()_ScrollingCredits_SelfDelete()_SelfRename()_SelfUpdate()_SendTo()_ShellAll()_ShellFile()_ShellFolder()_SingletonHWID()_SingletonPID()_Startup()_StringCompact()_StringIsValid()_StringRegExpMetaCharacters()_StringReplaceWholeWord()_StringStripChars()_Temperature()_TrialPeriod()_UKToUSDate()/_USToUKDate()_WinAPI_Create_CTL_CODE()_WinAPI_CreateGUID()_WMIDateStringToDate()/_DateToWMIDateString()Au3 script parsingAutoIt SearchAutoIt3 PortableAutoIt3WrapperToPragmaAutoItWinGetTitle()/AutoItWinSetTitle()CodingDirToHTML5FileInstallrFileReadLastChars()GeoIP databaseGUI - Only Close ButtonGUI ExamplesGUICtrlDeleteImage()GUICtrlGetBkColor()GUICtrlGetStyle()GUIEventsGUIGetBkColor()Int_Parse() & Int_TryParse()IsISBN()LockFile()Mapping CtrlIDsOOP in AutoItParseHeadersToSciTE()PasswordValidPasteBinPosts Per DayPreExpandProtect GlobalsQueue()Resource UpdateResourcesExSciTE JumpSettings INISHELLHOOKShunting-YardSignature CreatorStack()Stopwatch()StringAddLF()/StringStripLF()StringEOLToCRLF()VSCROLLWM_COPYDATAMore Examples...

Updated: 22/04/2018

Share this post


Link to post
Share on other sites
jimollerhead

Apologies for not responding to the convo this afternoon Guinness but I was just checking the thread in my lunch-hour so could not engage in a 'live' interaction....I do find your nick a tad ironic given that I am an Englishman marooned in the ROI and I cannot stand the stuff!  [grin].....and not only that I live next door to the original site of the first Guinness brewery!  (which has just been sold BTW)

Edited by jimollerhead

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  

  • Similar Content

    • Skysnake
      By Skysnake
      I have read the Tutorial. Used the Help File and used an example script by @Melba23.  I am still struggling.
      To use GUIRegisterMsg one needs the following
      a control in the GUI a GUIRegisterMsg instruction in the GUI to link the control to the WM_COMMAND function a Case statement in the Switch loop to run it a WM_COMMAND function and a processor function... Mine looks like this
      ;~ ; QuickSearch combo box $g_cbQwkSrch = GUICtrlCreateCombo("", 8, 26, 180, 17) ; start blank GUICtrlSetTip($g_cbQwkSrch, "Type to search", "QuickSearch") GUIRegisterMsg($WM_COMMAND, "__WM_COMMAND_QWKSEARCH_CMB") ;------------------------------------ ; use in Switch Loop ;~ ; QuickSearch Case $g_cbQwkSrch ConsoleWrite("221 Case $g_cbQwkSrch" & @CRLF) ;-------------------------------------- Func _QwkSrch_Edit_Changed() ConsoleWrite("41 _QwkSrch_Edit_Changed" & @CRLF) ; Autocomplete the edit _GUICtrlComboBox_AutoComplete($g_cbQwkSrch) ; Change the label to match the autocompleted edit entry EndFunc ;==>_QwkSrch_Edit_Changed Func __WM_COMMAND_QWKSEARCH_CMB($hWnd, $iMsg, $wParam, $lParam) ; GUIRegisterMsg($WM_COMMAND, "__WM_COMMAND_QWKSEARCH_CMB") ConsoleWrite("50 _WM_COMMAND_QWKSEARCH_CMB fired " & @CRLF) Local $Found = '' #forceref $hWnd, $iMsg If $lParam = GUICtrlGetHandle($g_cbQwkSrch) And BitShift($wParam, 16) = $CBN_EDITCHANGE Then ; Our combo edit content has changed ; get data from source ---------------------------- Local $datafromsource = fFindFilesForQuickSearch($stringtofind) ; datafromsource convert to Combo friendly format ; Add data to combo _GUICtrlComboBox_BeginUpdate($g_cbQwkSrch) GUICtrlSetData($g_cbQwkSrch, $Found) _GUICtrlComboBox_EndUpdate($g_cbQwkSrch) EndIf _QwkSrch_Edit_Changed() ; Action this function EndIf EndFunc ;==>_WM_COMMAND_QWKSEARCH_CMB Func fFindFilesForQuickSearch($stringtofind) ; helper function for QuickSearch ; get data here Return $aResult EndFunc ;==>fFindFilesForQuickSearch Now the following:
      Can I declare the variable $g_cbQwkSrch in Global, then use in multiple functions - reassigning different combo's to it as I go along? Should GUIRegisterMsg be expressly de-registered, or does that happen automatically at GuiDelete()? Where is the best/correct place to call GUIRegisterMsg? With the creation of its control, before the GUISetState, or before the start of the loop? The Help File contains this entry, what is the intent?  Must this always be called with four args, or a max of four...   !!! To make the user function workable you have to define it with maximum 4 function parameters otherwise the function won't be called !!!
    • Skysnake
      By Skysnake
      Hi
      Best example I could find is here
      ::/html/libfunctions/_GUICtrlTreeView_ClickItem.htm
      The way I understand this, the standard Windows messages, such as Left/Right Click etc are covered by AutoIt macros, but the real power is locked up inside this WM_NOTIFY .  I have tried, but I am not even sure I understand what I am looking at.
      I need help understanding this.  What I am looking for is Help file or Tutorial explaining how this works?  
      Perhaps if there is a script showing both the working of an AutoIt macro and the WM_NOTIFY  in action, it would help.
      Right now I am so lost, I do not even know what are the right questions to ask.  One issue I have is on ListViews, how to combine the "Click" of a line with a standard Switch loop?  Like users clicks a line, then get the loop to detect the click and ;do something ...
      Any ideas?
      Skysnake
    • kcvinu
      By kcvinu
      Hi all,
      I am using GuiGetMsg(). Assume that i have a combo box in my gui. And when i use this code - 
      While 1     $nMsg = GUIGetMsg()     Switch $nMsg         Case $GUI_EVENT_CLOSE             Exit         Case $CMB_NamesList ; Handle of my Combo box             CellSelect()          EndSwitch WEnd This code will call my "CellSelect()" function only when the selection change event occurred. But assume that i need to call this function right after the user clicks on the combo box. So do i need to use GuiRegisterMsg function for that ? Or can i simply do the task with GUIGetMsg() ? If the second option is possible, then i wonder how to do it. 
    • kcvinu
      By kcvinu
        Hi all,
      I know this is a crazy idea. But i think it might be a help for somebody. The name of this program is GRM Helper. i.e. GUIRegisterMsg Helper. 
      This program helps you to write the guiregistermsg function code automatically. You can choose a control from the combo box. Then all events of that control will be displayed in a list view. You can click on an event for it;s details. Then you can check the events which you want to include in your code. Then type some details like; 1) Your control's handle. 2) Line number for inserting GUIRegisterMsg code. 3) Line number for inserting main function.
      And press the "Isert To SciTE" button. Your code is ready in scite.
       
      Here is the program.
      Updated Version 1.1
      GRM Helper V1.1.zip
       
       

      The code written by this program.
      GUIRegisterMsg($WM_COMMAND, "WM_COMMAND") Func WM_COMMAND($hWnd, $iMsg, $wParam, $lParam) #forceref $hWnd, $iMsg Local $hWndFrom, $iIDFrom, $iCode, $hWndListBox If Not IsHWnd($Sample) Then $hWndListBox = GUICtrlGetHandle($Sample) $hWndFrom = $lParam $iIDFrom = BitAND($wParam, 0xFFFF) ; Low Word $iCode = BitShift($wParam, 16) ; Hi Word Switch $hWndFrom Case $Sample, $hWndListBox Switch $iCode Case $LBN_ERRSPACE ; Insert your code here Case $LBN_SELCHANGE ; Insert your code here Case $LBN_DBLCLK ; Insert your code here Case $LBN_SELCANCEL ; Insert your code here EndSwitch EndSwitch Return $GUI_RUNDEFMSG EndFunc ;==>WM_COMMAND  
       
    • kcvinu
      By kcvinu
      Hi all,
      I am playing with a combo box. The code from help file is working. But the code i wrote is not working. Help file uses "_GUICtrlComboBox_Create" for creating combo box. But i used native "GUICtrlCreateCombo". Then i replaced my native combo creation function with the UDF. Then my code worked. I think the hi word and low word parameters are the problem. 
      Here is my code.
      #include <ComboConstants.au3> #include <GUIConstantsEx.au3> #include <WindowsConstants.au3> Local $sCMB_Items = "Apple|Orange|Mango|Banana|Grape" #Region ### START Koda GUI section ### Form= Global $hForm1 = GUICreate("Form1", 283, 188, 312, 166) Global $hCombo1 = GUICtrlCreateCombo("", 40, 48, 185, 25, BitOR($CBS_DROPDOWN,$CBS_AUTOHSCROLL)) GUISetState(@SW_SHOW) #EndRegion ### END Koda GUI section ### GUICtrlSetData($hCombo1, $sCMB_Items) GUIRegisterMsg($WM_COMMAND, "WM_COMMAND") While 1 $nMsg = GUIGetMsg() Switch $nMsg Case $GUI_EVENT_CLOSE Exit EndSwitch WEnd Func WM_COMMAND($hWnd, $iMsg, $wParam, $lParam) #forceref $hWnd, $iMsg Local $hWndFrom, $iIDFrom, $iCode $hWndFrom = $lParam $iIDFrom = BitAND($wParam, 0xFFFF) ; Low Word $iCode = BitShift($wParam, 16) ; Hi Word Switch $hWndFrom Case $hCombo1 Switch $iCode Case $CBN_DBLCLK ; Insert your code here MsgBox(0,"","$CBN_DBLCLK") Case $CBN_DROPDOWN ; Insert your code here MsgBox(0,"","$CBN_DROPDOWN") Case $CBN_EDITCHANGE ; Insert your code here MsgBox(0,"","$CBN_EDITCHANGE") Case $CBN_SELCHANGE ; Insert your code here MsgBox(0,"","$CBN_SELCHANGE") EndSwitch EndSwitch Return $GUI_RUNDEFMSG EndFunc ;==>WM_COMMAND And this is the code from help file. Slightly modified. But working
      #include <GuiComboBox.au3> #include <GUIConstantsEx.au3> #include <MsgBoxConstants.au3> #include <WindowsConstants.au3> Global $g_hCombo Example() Func Example() Local $hGUI ; Create GUI $hGUI = GUICreate("(UDF) ComboBox Create", 400, 296) $g_hCombo = _GUICtrlComboBox_Create($hGUI, "", 2, 2, 396, 296) GUISetState(@SW_SHOW) ; Add files _GUICtrlComboBox_BeginUpdate($g_hCombo) _GUICtrlComboBox_AddDir($g_hCombo, "", $DDL_DRIVES, False) _GUICtrlComboBox_EndUpdate($g_hCombo) GUIRegisterMsg($WM_COMMAND, "WM_COMMAND") ; Loop until the user exits. Do Until GUIGetMsg() = $GUI_EVENT_CLOSE GUIDelete() EndFunc ;==>Example Func WM_COMMAND($hWnd, $iMsg, $wParam, $lParam) #forceref $hWnd, $iMsg Local $hWndFrom, $iIDFrom, $iCode $hWndFrom = $lParam $iIDFrom = BitAND($wParam, 0xFFFF) ; Low Word $iCode = BitShift($wParam, 16) ; Hi Word Switch $hWndFrom Case $g_hCombo Switch $iCode Case $CBN_CLOSEUP ; Sent when the list box of a combo box has been closed MsgBox(0,"","$CBN_CLOSEUP") Case $CBN_DBLCLK ; Sent when the user double-clicks a string in the list box of a combo box MsgBox(0,"","$CBN_DBLCLK") Case $CBN_DROPDOWN ; Sent when the list box of a combo box is about to be made visible MsgBox(0,"","$CBN_DROPDOWN") Case $CBN_EDITCHANGE ; Sent after the user has taken an action that may have altered the text in the edit control portion of a combo box MsgBox(0,"","$CBN_EDITCHANGE") Case $CBN_EDITUPDATE ; Sent when the edit control portion of a combo box is about to display altered text Case $CBN_ERRSPACE ; Sent when a combo box cannot allocate enough memory to meet a specific request Case $CBN_KILLFOCUS ; Sent when a combo box loses the keyboard focus Case $CBN_SELCHANGE ; Sent when the user changes the current selection in the list box of a combo box MsgBox(0,"","$CBN_SELCHANGE") EndSwitch EndSwitch Return $GUI_RUNDEFMSG EndFunc ;==>WM_COMMAND For those who wants the au3 file;
      Here it is
       
      Code From help file.au3
      My code.au3
×