Leaderboard
Popular Content
Showing content with the highest reputation on 06/25/2012 in all areas
-
_GUIImageList_Create + _GUIImageList_AddIcon example1 point
-
I converted your BMP to PNG and it seems to be working: #include <GuiToolbar.au3> #include <GuiImageList.au3> #include <WindowsConstants.au3> #include <Constants.au3> #include <gdiplus.au3> $Debug_TB = False ; Check ClassName being passed to functions, set to True and use a handle to another control to see it work Global $iMemo _Main() Func _Main() Local $hGUI, $hToolbar, $hNormal, $hDisabled, $hHot Local Enum $id1 = 1000, $id2, $id3, $id4 ;~ Local $CloseBMP = _ImgProcess(Binary("0x424DEE000000000000007600000028000000100000000F00000001000" & _ ;~ "4000000000078000000120B0000120B00001000000010000000000000000000800000800000008080008" & _ ;~ "00000008000800080800000C0C0C000808080000000FF0000FF000000FFFF00FF000000FF00FF00FFFF0" & _ ;~ "000FFFFFF0077777777888888887777777F777777787770000F707770787770FFFF770707787770FFFF7" & _ ;~ "77077787770FFFF770707787770FFFF707770787770FFFF777777787770FFFFFFFFFFF77770FFFFFFFFF" & _ ;~ "0777770FFFFFFFFF0777770FFFFFF0000777770FFFFFF0F07777770FFFFFF0077777770000000077777")); Binary BMP image for the "File Close" icon Local $CloseBMP = _ImgProcess(Binary("0x89504E470D0A1A0A0000000D49484452000000100000000F0806000000ED734F2F000000097048597300000B1300000B1301009A9C180000008049444154785E9D93610A80200C85F7C2837934BBD93CD98B09239865CD0F4A067BDFDC0F41B981086501AD255024403E3B00589A517248029243B22D0030AD5A12D383C86FB0CFBE80E4F8FD5AA1F72E6F686BFC75835A6BAC732BA8AA87ECB43A0812120F67051EB6732D00E0DF1436A2A47C3C167AC88935286BCED6962D1714C53BA791E5B88A0000000049454E44AE426082")); Binary PNG image for the "File Close" icon ; Create GUI $hGUI = GUICreate("Toolbar", 400, 300) ;~ GUISetBkColor(0) $hToolbar = _GUICtrlToolbar_Create($hGUI, $TBSTYLE_FLAT) _GUICtrlToolbar_SetBitmapSize($hToolbar, 16, 16) _GUICtrlToolbar_AddBitmap($hToolbar, 1, 0, $CloseBMP) _GUICtrlToolbar_AddButton($hToolbar, $id1, 0) _GUICtrlToolbar_AddButtonSep($hToolbar) _GUICtrlToolbar_AddBitmap($hToolbar, 1, -1, $IDB_STD_SMALL_COLOR) _GUICtrlToolbar_AddButton($hToolbar, $id2, 1) _GUICtrlToolbar_AddButtonSep($hToolbar) _GUICtrlToolbar_AddButton($hToolbar, $id3, 2) _GUICtrlToolbar_AddButtonSep($hToolbar) _GUICtrlToolbar_AddButton($hToolbar, $id4, 3) $iMemo = GUICtrlCreateEdit("", 2, 36, 396, 262, $WS_VSCROLL) GUICtrlSetFont($iMemo, 10, 400, 0, "Courier New") GUISetState() ; Loop until user exits Do Until GUIGetMsg() = -3 EndFunc ;==>_Main Func _ImgProcess(Const $bBinary);Merged code by Progandy and Zedna Local $iLen = BinaryLen($bBinary) If $iLen = 0 Then Return SetError(2, 0, 0) Local $hMem = _MemGlobalAlloc($iLen, $GMEM_MOVEABLE) If @error Or Not $hMem Then Return SetError(3, 0, 0) DllStructSetData(DllStructCreate("byte[" & $iLen & "]", _MemGlobalLock($hMem)), 1, $bBinary) If @error Then _MemGlobalUnlock($hMem) _MemGlobalFree($hMem) Return SetError(4, 0, 0) EndIf _MemGlobalUnlock($hMem) _GDIPlus_Startup() Local $aResult = DllCall("ole32.dll", "int", "CreateStreamOnHGlobal", "handle", $hMem, "bool", True, "ptr*", 0) If @error Or $aResult[0] <> 0 Or $aResult[3] = 0 Then Return SetError(5, @error, 0) Local $hImage = DllCall($ghGDIPDll, "uint", "GdipLoadImageFromStream", "ptr", $aResult[3], "int*", 0) Local $error = @error Local $tVARIANT = DllStructCreate("word vt;word r1;word r2;word r3;ptr data; ptr") DllCall("oleaut32.dll", "long", "DispCallFunc", "ptr", $aResult[3], "dword", 8 + 8 * @AutoItX64, "dword", 4, "dword", 23, "dword", 0, "ptr", 0, "ptr", 0, "ptr", DllStructGetPtr($tVARIANT)) If @error Then Return SetError(6, $error, 0) If $hImage[2] = 0 Then Return SetError(7, 0, $hImage[2]) Local $hBitmap = _GDIPlus_BitmapCreateHBITMAPFromBitmap($hImage[2]) _GDIPlus_ImageDispose($hImage[2]) _GDIPlus_Shutdown() Return SetError(0, 0, $hBitmap) EndFunc ;==>_ImgProcess ; Write message to memo Func MemoWrite($sMessage = "") GUICtrlSetData($iMemo, $sMessage & @CRLF, 1) EndFunc ;==>MemoWrite Br, UEZ1 point
-
Another way to avoid uninitialized controls continuously firing is add a case o with a continue loop as the first case in a message loop. Something like this. While 1 Switch GUIGetMsg() Case 0 ContinueLoop Case $GUI_EVENT_CLOSE Exit Case $h_TempCtrl _GUICtrlTemp_Apply("$h_TempCtrl") EndSwitch WEnd1 point
-
"Deal-A-Day" Sites
Melba23 reacted to JLogan3o13 for a topic
For someone who "didn't find it very interesting" you sure are hanging around a lot on this thread If it is not your cup of tea, so be it. Wander elsewhere.1 point -
You do have the Bass.dll file and it's located in the script directory correct? BTW, there's no reason to compile the script if all you want to do is test it, you can run it from SciTE by pressing F5 if you're using SciTE.1 point
-
Artisan, Thanks for that - I enjoyed the detective work! You need to set a placeholder value for $h_TempCtrl when you first declare it: Global $h_TempCtrl = 9999 ; Or any other unlikely number When a variable is undefined and used as a GUIGetMsg Case, it fires every time through the loop. So you always tested the Case $h_TempCtrl code as the value of $h_TempCtrl was undefined - AutoIt takes the undefined value as 0 which is the return of GUIGetMsg when the queue is empty. As a result this Case was being checked every few millisecs and as soon as you created the temporary control, the If $h_TempCtrl <> 0 condition was met and the _GUICtrlTemp_Apply function was run. It seems that the loop was so fast it actually used different values of the $h_TempCtrl within the same section of code - undefined to fire the Case and the correct ControlID for the If! I hope that explanation is clear - please ask again if not. M231 point
-
Please take that back, I'm really furious and upset.1 point
-
' I've read it completely, Is it true that unlike java AutoIT only runs on winBlows, that it is not portable to other platforms ? That it doesn't support classes like java does ? That it doesn't support methods like javascript does ? That it doesn't support User Defined Types ? That it doesn't support User-Defined-Objects nor a constructor to create them or use prototypes on objects ? That it executes tuns of commands before the programmer gets to run his first instruction and therefor is not considered a real programming language by many professionals ? That it is a basic like language designed for people that are either too stupid or lazy to learn a real programming language ?1 point
-
There is an $f_wait parameter you can pass to _IECreate. You can also use _IELoadWaitTimeout to change how long it will wait for the load (default is 5 minutes). Dale1 point
-
You can use it just like this: $GUI_EVENT_CLOSE = -3 Global $gui = GUICreate("ComboBox Listener", 300, 300) Global $combo = GUICtrlCreateCombo("", 10, 10) GUICtrlSetData(-1, "Item 1|Item 2|Item 3|Item 4|Item 5|Item 6") Global $input = GUICtrlCreateInput("", 10, 100) Global $button = GUICtrlCreateButton("Test", 10, 200) GUISetState(@SW_SHOW) While 1 $msg = GUIGetMsg() If $msg = $GUI_EVENT_CLOSE Then ExitLoop If $msg = $input Then ConsoleWrite('Event from input control, value: ' & GUICtrlRead($input) & @CRLF) WEnd But this event is fired also when you change focus from input control to other control (and only when Enter is pressed on focused input control).1 point