Opened 16 years ago
Last modified 16 years ago
#500 closed Bug
_ChooseColor 64bit problems — at Version 14
Reported by: | Achilles | Owned by: | Gary |
---|---|---|---|
Milestone: | 3.2.13.8 | Component: | Standard UDFs |
Version: | 3.2.12.0 | Severity: | None |
Keywords: | 64 bit color | Cc: |
Description (last modified by Gary)
I just got a 64bit version of Vista and encountered several problems.
_ChooseColor does not work.
The function return a value as if the user canceled selection even though no sign of the dialog box appears.
Change History (14)
comment:1 Changed 16 years ago by TicketCleanup
- Severity changed from Blocking to None
comment:2 follow-up: ↓ 3 Changed 16 years ago by Gary
I don't have Vista let alone 64bit, maybe another dev can test.
Did you compile your script with the 64 bit compile?
comment:3 in reply to: ↑ 2 Changed 16 years ago by anonymous
Replying to Gary:
I don't have Vista let alone 64bit, maybe another dev can test.
Did you compile your script with the 64 bit compile?
When I installed AutoIt I set it to the options where it would "use 64bit features where possible." So when you right click a script you can either just "Compile Script" or "Compile Script (x86)". I tried "Compile Script" and both _ChooseFont and _ChooseColor failed. They work normally if I compile it with the x86.
comment:4 follow-up: ↓ 5 Changed 16 years ago by Gary
Everything looks fine as far as I can tell, might be a structure problem for 64bit.
Try the following change to the function and see if it gives any information:
Func _ChooseColor($iReturnType = 0, $iColorRef = 0, $iRefType = 0, $hWndOwnder = 0) Local $custcolors = "int[16]", $tcc, $tChoose, $color_picked, $iResult, $iDialogError $tChoose = DllStructCreate($tagCHOOSECOLOR) $tcc = DllStructCreate($custcolors) If ($iRefType == 1) Then ; BGR hex color to colorref $iColorRef = Int($iColorRef) ElseIf ($iRefType == 2) Then ; RGB hex color to colorref $iColorRef = Hex(String($iColorRef), 6) $iColorRef = '0x' & StringMid($iColorRef, 5, 2) & StringMid($iColorRef, 3, 2) & StringMid($iColorRef, 1, 2) EndIf DllStructSetData($tChoose, "Size", DllStructGetSize($tChoose)) DllStructSetData($tChoose, "hWndOwnder", $hWndOwnder) DllStructSetData($tChoose, "rgbResult", $iColorRef) DllStructSetData($tChoose, "CustColors", DllStructGetPtr($tcc)) DllStructSetData($tChoose, "Flags", BitOR($__MISCCONSTANT_CC_ANYCOLOR, $__MISCCONSTANT_CC_FULLOPEN, $__MISCCONSTANT_CC_RGBINIT)) $iResult = DllCall("comdlg32.dll", "long", "ChooseColor", "ptr", DllStructGetPtr($tChoose)) $iDialogError = DllCall("comdlg32.dll", "long", "CommDlgExtendedError") If $iDialogError Then MsgBox(0, "$iDialogError", $iDialogError) ConsoleWrite("$iDialogError: " & $iDialogError & @lf) EndIf If ($iResult[0] == 0) Then Return SetError(-3, -3, -1) ; user selected cancel or struct settings incorrect $color_picked = DllStructGetData($tChoose, "rgbResult") If ($iReturnType == 1) Then ; return Hex BGR Color Return '0x' & Hex(String($color_picked), 6) ElseIf ($iReturnType == 2) Then ; return Hex RGB Color $color_picked = Hex(String($color_picked), 6) Return '0x' & StringMid($color_picked, 5, 2) & StringMid($color_picked, 3, 2) & StringMid($color_picked, 1, 2) ElseIf ($iReturnType == 0) Then ; return RGB COLORREF Return $color_picked Else Return SetError(-4, -4, -1) EndIf EndFunc ;==>_ChooseColor
comment:5 in reply to: ↑ 4 Changed 16 years ago by anonymous
Replying to Gary:
Everything looks fine as far as I can tell, might be a structure problem for 64bit.
Try the following change to the function and see if it gives any information:
code
I tried that and it works good. I've encountered some other problems with listviews, should I post those too? I don't really need these fixed since I'm fine with just using 32bit compiling...
comment:6 follow-up: ↓ 7 Changed 16 years ago by Gary
I didn't change the function other than adding an dialog error check after the dll call.
Are you saying the function now works?
comment:7 in reply to: ↑ 6 Changed 16 years ago by anonymous
Replying to Gary:
I didn't change the function other than adding an dialog error check after the dll call.
Are you saying the function now works?
Oh sorry, I didn't realize I had only tested it with the normal AutoIt, not 64bit. It still does not work with 64bit.
(I put the | around the value to see if was completely blank). |
comment:8 Changed 16 years ago by anonymous
Sorry, I forgot to reread the last part I wrote. It shows up as completely blank.
comment:9 Changed 16 years ago by Gary
made a noob mistake in the above code.
should be:
$iDialogError = DllCall("comdlg32.dll", "long", "CommDlgExtendedError") If $iDialogError[0] Then MsgBox(0, "$iDialogError", $iDialogError[0]) ConsoleWrite("$iDialogError: " & $iDialogError[0] & @lf) EndIf
comment:10 Changed 16 years ago by Achilles
With that change, $iDialogError[0] is set to 1 (so it shows the msgbox you added). I added an _ArrayDisplay and that's the only value in the whole array.
comment:11 Changed 16 years ago by Gary
ok the points to an error in the structure size.
comment:12 Changed 16 years ago by Gary
in the structures.au3 replace $tagChooseColor with the following
Global Const $tagCHOOSECOLOR = "dword Size;hwnd hWndOwnder;hwnd hInstance;int rgbResult;int_ptr CustColors;dword Flags;int_ptr lCustData;" & _ "ptr lpfnHook;ptr lpTemplateName"
This still works in 32bit environment, not sure of 64bit.
comment:13 Changed 16 years ago by Achilles
Ok, that works with 64bit. I suppose that the solution to _ChooseFont is very similar. I'm still having some troubles with listviews. Should I post a more detailed description of those? Like I said above, it doesn't matter much for me...
comment:14 Changed 16 years ago by Gary
- Component changed from AutoIt to Standard UDFs
- Description modified (diff)
- Owner set to Gary
- Summary changed from 64bit problems to _ChooseColor 64bit problems
A separate ticket needs to be made up for listviews, as it is I'm splitting up the color and font issue
Automatic ticket cleanup.