Jump to content

This site uses cookies. By continuing to browse the site you are agreeing to our use of cookies. Find out more here. X
X


Photo

ChooseFileFolder - New Version 11 Dec 13


  • Please log in to reply
100 replies to this topic

#1 Melba23

Melba23

    I'm old - what's your excuse?

  • Moderators
  • 19,892 posts

Posted 09 February 2011 - 06:34 PM

NEW VERSION 11 Dec 13

Changed

- 1. If you want to choose between various drives, the UDF now adds them directly to the treeview. In _CFF_Choose having them appear in a separate combo is still an option.

- 2. Following user feedback, the automatic scroll to the first file when selecting files from a tree is now an option in the $iDisplay parameter.


Added: You can now not only define a default drive but also a default folder when choosing between various drives - adding a trailing "\" to the folder path will additionally open the folder. In my testing this sometimes fails for native TreeViews - I imagine because the internal processing that AutoIt needs to carry out delays the expansion process. If the tree has not correctly expanded the UDF automatically reruns the expansion up to 5 times with an increased delay between events until the desired endstate is reached - if there is still a problem then the TreeView is displayed unexpanded. Thanks to Tankbuster for prodding me to get the UDF to do this. :)

Note: The UDF code uses the new Beta File.au3 include file - if you are still running 3.3.8.1 then look for the 3 lines highlighted by ~~~~~~~~~~~~~~~~~ and amend them as shown. You will also need my RecFileListToArray UDF which is in the zip - you do NOT need this file if you run the Beta.

Previous versions: Attached File  ChangeLog.txt   8.62KB   66 downloads

 
I was fed up with using the native FileOpenDialog and FileSelectFolder which appeared anywhere on the screen in seemingly random sizes and often allowed users to select files from other than the path desired. So I decided to write my own version of an Explorer-type treeview and here it is: ChooseFileFolder.

What are the main advantages of this UDF over the normal dialogs?

- Common format for both file and folder selection.

- Ability to size and place the dialog where you want it rather than how Windows last left it.

- Ability to select (and delete) multiple items - even from different folders or drives. You can also select both files and folders from the same tree.

- And there is also a function to allow you to use an existing treeview in your own GUI to display the folder tree - no need to have a dialog at all.


The ChooseFileFolder UDF and examples are now too large to fit within code tags - so here is a zip file with the examples and UDF (and the RecFileListToArray UDF for those not running the Beta): Attached File  ChooseFileFolder.zip   22.87KB   212 downloads

As usual happy to take feedback and, preferably, plaudits. :D

M23

Edited by Melba23, 11 December 2013 - 12:18 PM.

  • yahaosoft likes this
StringSize - Automatically size controls to fit text                                                               ExtMsgBox - A user customisable replacement for MsgBox
Toast - Small GUIs which pop out of the Systray                                                                Marquee - Scrolling tickertape GUIs
Scrollbars - Automatically sized scrollbars with a single command                                   GUIFrame - Subdivide GUIs into many adjustable frames
GUIExtender - Extend and retract multiple sections within a GUI                                      NoFocusLines - Remove the dotted focus lines from buttons, sliders, radios and checkboxes
ChooseFileFolder - Single and multiple selections from specified path tree structure      Notify - Small notifications on the edge of the display
Date_Time_Convert - Easily convert date/time formats, including the language               GUIListViewEx - Insert, delete, move, drag, sort and edit ListView items







#2 guinness

guinness

    I've a handle on the fiction

  • Developers
  • 15,711 posts

Posted 10 February 2011 - 01:14 PM

Wouldn't expect any less! Purely brilliant, I am sure I will find some use for this UDF.

Edited by guinness, 10 February 2011 - 01:14 PM.

Example List: _AdapterConnections()_AlwaysRun()_AppMon()_AppMonEx()_BinaryBin()_CheckMsgBox()_CmdLineRaw()_ContextMenu()_ConvertLHWebColor()/_ConvertSHWebColor()_DesktopDimensions()_DisplayPassword()_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()_GUISetIcon()_Icon_Clear()/_Icon_Set()_InetGet()_InetGetGUI()_InetGetProgress()_IPDetails()_IsFileOlder()_IsGUID()_IsHex()_IsPalindrome()_IsRegKey()_IsStringRegExp()_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_CreateGUID()_WMIDateStringToDate()/_DateToWMIDateString()Au3 script parsingAutoIt SearchAutoIt3 PortableAutoIt3WrapperToPragmaAutoItWinGetTitle()/AutoItWinSetTitle()CodingFileInstallrGeoIP databaseGUI - Only Close ButtonGUI ExamplesGUICtrlDeleteImage()GUICtrlGetBkColor()GUICtrlGetStyle()GUIGetBkColor()LockFile()PasswordValidPasteBinPosts Per DayPreExpandQueue()SciTE JumpSHELLHOOKShunting-YardSignature CreatorStack()StringAddLF()/StringStripLF()StringEOLToCRLF()WM_COPYDATAMore Examples...
Updated: 12/04/2014


#3 UEZ

UEZ

    Never say never

  • MVPs
  • 4,497 posts

Posted 10 February 2011 - 01:38 PM

I get an error on example 6 when I select my C drive ->

Line 419 (File "C:\Coding\AU3\GUI\ChooseFileFolder\ChooseFileFolder.au3"):

$hTreeView = GUICtrlCreateTreeView(0, 0, $iW - 20, $aTV_Pos[3])
$hTreeView = GUICtrlCreateTreeView(0, 0, $iW - 20, $aTV_Pos^ ERROR

Error: Subscript used with non-Array variable.

Btw, nice coding!

Br,
UEZ

 
The own fart smells best!
Her 'sikim hıyar' diyene bir avuç tuz alıp koşma!
¯\_(ツ)_/¯


#4 Melba23

Melba23

    I'm old - what's your excuse?

  • Moderators
  • 19,892 posts

Posted 10 February 2011 - 02:02 PM

UEZ,

That has nothing to do with the C: drive - it is a result of an existing treeview not being found. :idiot:

I cannot reproduce it at the moment - which makes it a bit tricky to debug. When you first run Example 6 do you get a visible list control under a vertically moveable separator bar? Had you selected any other drive before your C: drive or was this the first one? :)

Aside from that, it must have taken an eternity to index the whole C: drive - I just did it once and nearly died of boredom. ;)

M23
StringSize - Automatically size controls to fit text                                                               ExtMsgBox - A user customisable replacement for MsgBox
Toast - Small GUIs which pop out of the Systray                                                                Marquee - Scrolling tickertape GUIs
Scrollbars - Automatically sized scrollbars with a single command                                   GUIFrame - Subdivide GUIs into many adjustable frames
GUIExtender - Extend and retract multiple sections within a GUI                                      NoFocusLines - Remove the dotted focus lines from buttons, sliders, radios and checkboxes
ChooseFileFolder - Single and multiple selections from specified path tree structure      Notify - Small notifications on the edge of the display
Date_Time_Convert - Easily convert date/time formats, including the language               GUIListViewEx - Insert, delete, move, drag, sort and edit ListView items

#5 guinness

guinness

    I've a handle on the fiction

  • Developers
  • 15,711 posts

Posted 10 February 2011 - 02:10 PM

I selected another Drive and then the C:\ Drive and I didn't get the same error! I also repeated Example 6 with just selecting the C:\ Drive and still no problem. Very weird indeed why UEZ got this error.

Edited by guinness, 10 February 2011 - 02:10 PM.

Example List: _AdapterConnections()_AlwaysRun()_AppMon()_AppMonEx()_BinaryBin()_CheckMsgBox()_CmdLineRaw()_ContextMenu()_ConvertLHWebColor()/_ConvertSHWebColor()_DesktopDimensions()_DisplayPassword()_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()_GUISetIcon()_Icon_Clear()/_Icon_Set()_InetGet()_InetGetGUI()_InetGetProgress()_IPDetails()_IsFileOlder()_IsGUID()_IsHex()_IsPalindrome()_IsRegKey()_IsStringRegExp()_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_CreateGUID()_WMIDateStringToDate()/_DateToWMIDateString()Au3 script parsingAutoIt SearchAutoIt3 PortableAutoIt3WrapperToPragmaAutoItWinGetTitle()/AutoItWinSetTitle()CodingFileInstallrGeoIP databaseGUI - Only Close ButtonGUI ExamplesGUICtrlDeleteImage()GUICtrlGetBkColor()GUICtrlGetStyle()GUIGetBkColor()LockFile()PasswordValidPasteBinPosts Per DayPreExpandQueue()SciTE JumpSHELLHOOKShunting-YardSignature CreatorStack()StringAddLF()/StringStripLF()StringEOLToCRLF()WM_COPYDATAMore Examples...
Updated: 12/04/2014


#6 UEZ

UEZ

    Never say never

  • MVPs
  • 4,497 posts

Posted 10 February 2011 - 02:31 PM

I'm starting ChooseFileFolder_Ex.au3.

Ex 1: seems to be ok -> I can see the tree
Ex 2: seems to be ok -> I can see the tree
Ex 3: seems to be ok -> I can see the tree
Ex 4: seems not to be ok -> nothing is displayed -> $hTreeView = 0
Ex 5: no tree. I can select a drive and it starting to indexing it
Ex 6: no tree. I can select a drive. When I select my C drive the error appears. I've only one local drive - C. -> $hTreeView = 0
Ex 7: files are listed

Looks like there is no handle to the treeview.

If I find the the bug I will tell you!

Br,
UEZ

Edited by UEZ, 10 February 2011 - 02:32 PM.

 
The own fart smells best!
Her 'sikim hıyar' diyene bir avuç tuz alıp koşma!
¯\_(ツ)_/¯


#7 UEZ

UEZ

    Never say never

  • MVPs
  • 4,497 posts

Posted 10 February 2011 - 02:49 PM

If you start Ex 6 with $sRet = _CFF_Choose("Ex 6: Select multiple files", 300, 500, -1, -1, "", Default, 0, True) it is working properly.

If $fSingle_Sel = False it will fail.

Test system: Win7 x64 with latest AutoIt version.

Ex 6 debug lines when $fSingle_Sel = False
@@ Debug(249) : $sRoot = >Error code: 0 @@ Debug(250) : $fSingle_Sel = False >Error code: 0 @@ Debug(325) : $hTreeView = 0 >Error code: 0 @@ Debug(326) : $hTreeView_Handle = 0 >Error code: 0


Ex 6 debug lines when $fSingle_Sel = True
@@ Debug(249) : $sRoot = >Error code: 0 @@ Debug(250) : $fSingle_Sel = True >Error code: 0 @@ Debug(325) : $hTreeView = 7 >Error code: 0 @@ Debug(326) : $hTreeView_Handle = 0x004A08CE >Error code: 0



Br,
UEZ

 
The own fart smells best!
Her 'sikim hıyar' diyene bir avuç tuz alıp koşma!
¯\_(ツ)_/¯


#8 Melba23

Melba23

    I'm old - what's your excuse?

  • Moderators
  • 19,892 posts

Posted 10 February 2011 - 03:11 PM

UEZ,

It looks like the problem is in the GUIFrame UDF not this one, as you only have a problem when $fSingleSel = False. In that case, the UDF creates a treeview within a frame created by GUIFrame and this is obviously not happening.

Have you tried to run the GUIFrame UDF and its examples - if not could you please do do? I wonder if there is a problem with it on x64 systems - it uses many DllCalls so I would not be at all surprised. :)

M23
StringSize - Automatically size controls to fit text                                                               ExtMsgBox - A user customisable replacement for MsgBox
Toast - Small GUIs which pop out of the Systray                                                                Marquee - Scrolling tickertape GUIs
Scrollbars - Automatically sized scrollbars with a single command                                   GUIFrame - Subdivide GUIs into many adjustable frames
GUIExtender - Extend and retract multiple sections within a GUI                                      NoFocusLines - Remove the dotted focus lines from buttons, sliders, radios and checkboxes
ChooseFileFolder - Single and multiple selections from specified path tree structure      Notify - Small notifications on the edge of the display
Date_Time_Convert - Easily convert date/time formats, including the language               GUIListViewEx - Insert, delete, move, drag, sort and edit ListView items

#9 UEZ

UEZ

    Never say never

  • MVPs
  • 4,497 posts

Posted 10 February 2011 - 03:29 PM

I tested GUIFrame on following virtual machines:

WinXP x86 -> working properly
Win2003 x64 -> not working
Windows2008 x86 -> working

And on my notebook:
Win7 x64 -> not working

Seems to be a problem with x64 operating systems!

Em is:
C:\Coding\AU3\GUI\GUIFrame\GUIFrame_Example_1.au3 (17) : ==> Subscript used with non-Array variable.: GUICtrlCreateLabel("", 5, 5, $aWinSize[0] - 10, $aWinSize[1] - 10) GUICtrlCreateLabel("", 5, 5, $aWinSize^ ERROR


#AutoIt3Wrapper_UseX64=n will not help!

Br,
UEZ

 
The own fart smells best!
Her 'sikim hıyar' diyene bir avuç tuz alıp koşma!
¯\_(ツ)_/¯


#10 Melba23

Melba23

    I'm old - what's your excuse?

  • Moderators
  • 19,892 posts

Posted 10 February 2011 - 03:59 PM

UEZ,

Interesting. With some help from Yashied I thought the GUIFrame UDF was x64 compatible. - see here and the next few posts. :)

M23
StringSize - Automatically size controls to fit text                                                               ExtMsgBox - A user customisable replacement for MsgBox
Toast - Small GUIs which pop out of the Systray                                                                Marquee - Scrolling tickertape GUIs
Scrollbars - Automatically sized scrollbars with a single command                                   GUIFrame - Subdivide GUIs into many adjustable frames
GUIExtender - Extend and retract multiple sections within a GUI                                      NoFocusLines - Remove the dotted focus lines from buttons, sliders, radios and checkboxes
ChooseFileFolder - Single and multiple selections from specified path tree structure      Notify - Small notifications on the edge of the display
Date_Time_Convert - Easily convert date/time formats, including the language               GUIListViewEx - Insert, delete, move, drag, sort and edit ListView items

#11 guinness

guinness

    I've a handle on the fiction

  • Developers
  • 15,711 posts

Posted 10 February 2011 - 04:47 PM

I tested on x64 and it worked, but then I have a single drive with multiple partitions.

Example List: _AdapterConnections()_AlwaysRun()_AppMon()_AppMonEx()_BinaryBin()_CheckMsgBox()_CmdLineRaw()_ContextMenu()_ConvertLHWebColor()/_ConvertSHWebColor()_DesktopDimensions()_DisplayPassword()_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()_GUISetIcon()_Icon_Clear()/_Icon_Set()_InetGet()_InetGetGUI()_InetGetProgress()_IPDetails()_IsFileOlder()_IsGUID()_IsHex()_IsPalindrome()_IsRegKey()_IsStringRegExp()_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_CreateGUID()_WMIDateStringToDate()/_DateToWMIDateString()Au3 script parsingAutoIt SearchAutoIt3 PortableAutoIt3WrapperToPragmaAutoItWinGetTitle()/AutoItWinSetTitle()CodingFileInstallrGeoIP databaseGUI - Only Close ButtonGUI ExamplesGUICtrlDeleteImage()GUICtrlGetBkColor()GUICtrlGetStyle()GUIGetBkColor()LockFile()PasswordValidPasteBinPosts Per DayPreExpandQueue()SciTE JumpSHELLHOOKShunting-YardSignature CreatorStack()StringAddLF()/StringStripLF()StringEOLToCRLF()WM_COPYDATAMore Examples...
Updated: 12/04/2014


#12 Melba23

Melba23

    I'm old - what's your excuse?

  • Moderators
  • 19,892 posts

Posted 10 February 2011 - 05:11 PM

guinness,

Thanks for that. I have no other reports of the GUIFrames UDF not being x64 compatible after Yashied helped me fix it. ;)

The size of drive has nothing to do with it - it is a simple case of the treeview not being created as a result of GUIFrames failing to create the frame! So as the error is most certainly coming from that UDF (and the fact that UEZ cannot run that UDF on x64) I am wondering what is different with UEZ's machine. :)

M23

Edit: Typnig.

Edited by Melba23, 10 February 2011 - 05:13 PM.

StringSize - Automatically size controls to fit text                                                               ExtMsgBox - A user customisable replacement for MsgBox
Toast - Small GUIs which pop out of the Systray                                                                Marquee - Scrolling tickertape GUIs
Scrollbars - Automatically sized scrollbars with a single command                                   GUIFrame - Subdivide GUIs into many adjustable frames
GUIExtender - Extend and retract multiple sections within a GUI                                      NoFocusLines - Remove the dotted focus lines from buttons, sliders, radios and checkboxes
ChooseFileFolder - Single and multiple selections from specified path tree structure      Notify - Small notifications on the edge of the display
Date_Time_Convert - Easily convert date/time formats, including the language               GUIListViewEx - Insert, delete, move, drag, sort and edit ListView items

#13 Ascend4nt

Ascend4nt

    Universalist

  • Active Members
  • PipPipPipPipPipPip
  • 1,305 posts

Posted 10 February 2011 - 10:41 PM

Another nice UDF Melba. I looked into the x64 stuff.. the only issue I see is the same one as GUIListViewEx had with the NMHDR, and a simple 'Program Files' location change.

Here's the 'x64 compatible' change :) for double-click notifications to work properly in x64 mode:

Func _CFF_WM_NOTIFY_Handler($hWnd, $iMsg, $wParam, $lParam)     #forceref $hWnd, $iMsg, $wParam     Local $tStruct = DllStructCreate("hwnd hWndFrom;uint_ptr IDFrom;int_ptr Code;int Spec", $lParam)     If @error Then Return     Switch BitAnd(DllStructGetData($tStruct, "Code"),0xFFFFFFFF)         Case 0xFFFFFFFD ; $NM_DBLCLK             $fCFF_DblClk = DllStructGetData($tStruct, "hWndFrom")     EndSwitch EndFunc   ;==>_CFF_WM_NOTIFY_Handler


And at the top of 'ChooseFileFolder_Ex.au3', you might put this:

Local $sProgFiles=@ProgramFilesDir If @AutoItX64 Then $sProgFiles&=' (x86)'


..and then change any occurrences of @ProgramFilesDir to $sProgFiles. This change is due to the fact that AutoIt installs in the x86 Program Files folder ('C:\Program Files (x86)") on 64-bit O/S's. In x86 mode, that's where it looks by default, but not in x64 mode. This will give your example the ability to run the same in both bit modes.

*edit: oops, meant 'double' click

Edited by Ascend4nt, 10 February 2011 - 10:45 PM.


#14 Yashied

Yashied

    Happy in Moscow

  • MVPs
  • 2,572 posts

Posted 11 February 2011 - 08:38 AM

You can't. The "Code" member in NMHDR structure requires four bytes (UINT). At least it did not correctly. Just replace UINT to INT. BTW, exactly in this form, NMHDR structure is defined in StructureConstants.au3.

Func _CFF_WM_NOTIFY_Handler($hWnd, $iMsg, $wParam, $lParam)     #forceref $hWnd, $iMsg, $wParam     Local $tStruct = DllStructCreate("hwnd hWndFrom;uint_ptr IDFrom;int Code", $lParam)     Switch DllStructGetData($tStruct, "Code")         Case -3 ; $NM_DBLCLK             $fCFF_DblClk = DllStructGetData($tStruct, "hWndFrom")     EndSwitch EndFunc   ;==>_CFF_WM_NOTIFY_Handler

And the following condition is unnecessary.


If the pointer is invalid (not zero), you get a garbage in the structure or crash with "Access is denied", but not @error.

Edited by Yashied, 11 February 2011 - 08:52 AM.


#15 Ascend4nt

Ascend4nt

    Universalist

  • Active Members
  • PipPipPipPipPipPip
  • 1,305 posts

Posted 11 February 2011 - 08:45 AM

'INT' is 4 bytes. NMHDR changed in x64 so that the last item is 8 bytes (int_ptr), and apparently without notifying anyone. The MSDN info is wrong.

The 'Spec' item was Melba's addition, I just kept it in there in case that was what he was going to use someday if it points to a larger struct.

Ahh, and the @error thing is Melba's idea, not mine - I only left it as it was coded.

*edit: for reference, you can look at my post on Melba's GuiListViewEx thread.

Edited by Ascend4nt, 11 February 2011 - 08:51 AM.


#16 Yashied

Yashied

    Happy in Moscow

  • MVPs
  • 2,572 posts

Posted 11 February 2011 - 08:51 AM

'INT' is 4 bytes.

Yes of course, I wanted to say a double word.

:)

#17 Ascend4nt

Ascend4nt

    Universalist

  • Active Members
  • PipPipPipPipPipPip
  • 1,305 posts

Posted 11 February 2011 - 08:56 AM

BTW, exactly in this form, NMHDR structure is defined in StructureConstants.au3.

Yeah, that's an issue that has supposedly been fixed in 3.3.7.0, check out ticket # 1479 regarding WM_NOTIFY. For now I've manually edited my AutoIt Includes to fix that problem, since it seems unlikely we'll see a new version of AutoIt released any time soon.

#18 Yashied

Yashied

    Happy in Moscow

  • MVPs
  • 2,572 posts

Posted 11 February 2011 - 09:50 AM

Yes, you are right, this is an alignments problem under x64 (similar problem). But the Melba23's problem in this case in the following.

"int IDFrom" instead of "uint_ptr IDFrom".

Thanks for the links.

:)

#19 Yashied

Yashied

    Happy in Moscow

  • MVPs
  • 2,572 posts

Posted 11 February 2011 - 12:51 PM

I think MSDN is correct, NMHDR structure looks like this.

$tagNMHDR = "hwnd hWndFrom;uint_ptr IDFrom;int Code"

But the following structures that includes NMHDR must be aligned to sizeof(ptr). For example

; x64 $tagNMHEADER = $tagNMHDR & ";byte Alignment[4];int Item;int Button;ptr pItem" ; x86 $tagNMHEADER = $tagNMHDR & ";int Item;int Button;ptr pItem"


#20 Melba23

Melba23

    I'm old - what's your excuse?

  • Moderators
  • 19,892 posts

Posted 11 February 2011 - 01:14 PM

Ascend4nt and Yashied,

Thank you both for your efforts. :)

I mentioned a tutorial on this x64 compatability problem to enlighten hobbyist coders like me the last time it came up - I suppose both of you are still not interested in writing one? :idiot:

New UDF and example in the first post. ;)

M23
StringSize - Automatically size controls to fit text                                                               ExtMsgBox - A user customisable replacement for MsgBox
Toast - Small GUIs which pop out of the Systray                                                                Marquee - Scrolling tickertape GUIs
Scrollbars - Automatically sized scrollbars with a single command                                   GUIFrame - Subdivide GUIs into many adjustable frames
GUIExtender - Extend and retract multiple sections within a GUI                                      NoFocusLines - Remove the dotted focus lines from buttons, sliders, radios and checkboxes
ChooseFileFolder - Single and multiple selections from specified path tree structure      Notify - Small notifications on the edge of the display
Date_Time_Convert - Easily convert date/time formats, including the language               GUIListViewEx - Insert, delete, move, drag, sort and edit ListView items




0 user(s) are reading this topic

0 members, 0 guests, 0 anonymous users