Tipulatoid Posted September 4, 2016 Share Posted September 4, 2016 (edited) Hello. I have such script that shows flags of different states taken from SQLite DB: Spoiler expandcollapse popup#AutoIt3Wrapper_Run_AU3Check=n #include <GDIPlus.au3> #include <SQLite.au3> #include <Array.au3> #include <GUIConstantsEx.au3> #include <ComboConstants.au3> #include <WindowsConstants.au3> #include <GuiComboBox.au3> Global $DataBase = @ScriptDir & "\parcels_clear.db" _OpenDataBase($DataBase) _CreateCountriesTable () $iWidth = 1000 $iHeight = 900 $MainGUI = GuiCreate("Test GUI", $iWidth, $iHeight) $NavigationBar = GuiCtrlCreateTab(20, 10, 960, 880) $Tab0 = GuiCtrlCreateTabItem("Tab0") $CountriesCombo = GUICtrlCreateCombo ("", 50, 50, 300, 50, BitOR($CBS_DROPDOWNLIST, $WS_VSCROLL)) _FillCombo ($CountriesCombo, _GetInfoFromDataBase ("SELECT eng FROM countries WHERE ISO_3166_1_alpha_2 <> '' ORDER BY eng;", True), "Austria") $Tab1 = GuiCtrlCreateTabItem("Tab1") GuiCtrlCreateLabel("Test", 200, 200) GUICtrlCreateTabItem(""); end tabitem definition GUIRegisterMsg($WM_COMMAND, "WM_COMMAND") GUISetState(@SW_SHOW) _ShowFlag () Do Until GUIGetMsg() = $GUI_EVENT_CLOSE _ExitProg () Func _ShowFlag () _GDIPlus_Startup () Local $hGraphics = _GDIPlus_GraphicsCreateFromHWND($MainGUI) Local $hBitmap = _GDIPlus_BitmapCreateFromMemory(Binary (_GetInfoFromDataBase ("SELECT flag FROM countries WHERE eng = " & _SQLite_Escape (GUICtrlRead($CountriesCombo)) & ";"))) Local $iPicWidth = _GDIPlus_ImageGetWidth($hBitmap) Local $iPicHeight = _GDIPlus_ImageGetHeight($hBitmap) _GDIPlus_GraphicsDrawImage($hGraphics, $hBitmap, ($iWidth - $iPicWidth) / 2 + Random (0, 300, 1), ($iHeight - $iPicHeight) / 2 + Random (0, 300, 1)) _GDIPlus_BitmapDispose($hBitmap) _GDIPlus_GraphicsDispose($hGraphics) _GDIPlus_Shutdown() EndFunc ; _ShowFlag Func WM_COMMAND($hWnd, $iMsg, $iWparam, $iLparam) $hWndCountriesCombo = $CountriesCombo If Not IsHWnd($CountriesCombo) Then $hWndCountriesCombo = GUICtrlGetHandle($CountriesCombo) $nNotifyCode = BitShift($iwParam, 16) $nID = BitAND($iwParam, 0x0000FFFF) $hWndFrom = $ilParam $iIDFrom = BitAND($iwParam, 0xFFFF) $iCode = BitShift($iwParam, 16) Switch $hWndFrom Case $hWndCountriesCombo Switch $iCode Case $CBN_SELCHANGE _ShowFlag () EndSwitch EndSwitch Return $GUI_RUNDEFMSG EndFunc ;==>WM_COMMAND Func _CheckIfTableExists ($sfTableName) If _GetInfoFromDataBase ("SELECT count(name) FROM sqlite_master WHERE name = '" & $sfTableName & "';") = 1 Then Return True Return False EndFunc ; _CheckIfTableExists Func _CreateCountriesTable () $sTableName = "countries" If _CheckIfTableExists ($sTableName) = True Then Return Local $aCounties[3][7] = _ [['Австралия', 'Australia', '036', 'AU', 'AUS', '036', 'FFD8FFE000104A46494600010101006000600000FFE1003A4578696600004D4D002A00000008000351100001000000010100000051110004000000010000000051120004000000010000000000000000FFDB00430001010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101FFDB00430101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101FFC00011080016002C03012200021101031101FFC4001F0000010501010101010100000000000000000102030405060708090A0BFFC400B5100002010303020403050504040000017D01020300041105122131410613516107227114328191A1082342B1C11552D1F02433627282090A161718191A25262728292A3435363738393A434445464748494A535455565758595A636465666768696A737475767778797A838485868788898A92939495969798999AA2A3A4A5A6A7A8A9AAB2B3B4B5B6B7B8B9BAC2C3C4C5C6C7C8C9CAD2D3D4D5D6D7D8D9DAE1E2E3E4E5E6E7E8E9EAF1F2F3F4F5F6F7F8F9FAFFC4001F0100030101010101010101010000000000000102030405060708090A0BFFC400B51100020102040403040705040400010277000102031104052131061241510761711322328108144291A1B1C109233352F0156272D10A162434E125F11718191A262728292A35363738393A434445464748494A535455565758595A636465666768696A737475767778797A82838485868788898A92939495969798999AA2A3A4A5A6A7A8A9AAB2B3B4B5B6B7B8B9BAC2C3C4C5C6C7C8C9CAD2D3D4D5D6D7D8D9DAE2E3E4E5E6E7E8E9EAF2F3F4F5F6F7F8F9FAFFDA000C03010002110311003F00C4F07785AD7F6A1F8657FF000D3F68CF80BE25FF008283F867E1AF87235B3F1735F7C0DD2BE27FC22F0E2BDB5B5A5C699F14BE0FF8EA0D7FE1F786F47B6B3F2F46F0FE92FE1DF875A8EAD24FABF8FBC2DE3DBB91D0F172FECD3E0DF8CBAC7C59F815E2DFD8E7F69CF1B7C22F82CFFB156B6FE02B7F88FE0EB2F19F847C31F02FF663F1AFC1EF06BFC5BF1B695A1F8774ABD1E37F05F8A6E7C6BA7EB9E17B5F0E69D0DFE976D7379A6DE68AF77A3DCFF3E9F16FFE0AAFFB567C4AF867A2FC15F08DC7C3CFD9BFE0EE82F74FA6FC33FD993C212FC29F0B4125C34E82EE18E1D6357D52D35B7D3EE6E747D6FC57A7EA767E2EF1D697712C1F11F5EF18CAC271EB7F1BFC69FF000528F863FB33FC11F8AFE32F84BE25F803F09FC45A87ECC1ABFC15FDA17C1FA778FF00C05AF5F6A9FB347C07F14FC18F83FA8F843E212F8BE4B292FBC6DF0DBC49AD78CEE6EBC3EAD378A8E9EDE2AF09BE8DE15B1D46C64FEB6CDFE87DF4899E73C0338F8F73E13C1D3E3ECD71F916530FF5532EC4F08BADC1DC4F967FAC3C3F94F0F65BC3F9160F3DCC2A63E183C570F708D1AB470D82C7D7CD7FB571198612' & _ '8BA5FDCBC37F4B5FA38E4D90F8A786C67D1C785736CE7897C35C9F87EAD75C41E2BE2F01C6B8CC278B3E17F1654E1BCF731E20E34CE339C565984C070C6373CC3F146734F099956CC723CAB20A997FF63E331987C77E837FC14E75F1E19FD94BE21FC1CF865E0DB0FD98FE15F8653C10B7DF02F44B3FD9F65D7BC5A6EFE21781B52B7BCF88DE23B4F126AFF141DE6BE8349F185C787BE16E83F0EBE1BEABE21D2F49F166ABE001716D36B29FCBE446312C466567844886554215DA30C3CC546208562B90AC4100904835FA05FB40FF00C148FE367ED4BF072C3E167C77F027C08F1DF8AF4DBD8AE6D3F68597E1BBE83F1D92DD753B5D5AF2D1B55F0BEBDA2FC3A7BCD76E2D553C5BE2F6F86A7E20F8D2291C78BBC5FADCAB04B0FCBBADFC70F15EBDF03BC0DF002EF44F87F07843E1FF008E7C61E3ED23C41A77807C33A7FC49D4B54F19D8E8D617BA5F897E225AD847E27F10786F4A5D1CDC681A1EA37D2DA69975A9EA2EBE6C634E8B4FFEECFA37F871C77E14700E2385F8D31F84E21CEEBF196659863338A2B21C1C2BE5F89CA72DA2B33A788C8F87723C46758AC5E37033AD5F11C47828F114AB632BD2C66698DC26030156B7F16F8EFC79C1BE2371860B8878278623C1F944787303819E490CCF8BB357471D87CC333AB52329F17F1571756C1D3A385C4E1B0984C1E499961F20A780C2612AE1729CB31B88CC30F1E9BE2A7863C01F12BE26FC4AD5FF0063CF855F1B20F827E12F0BD978C5F43F1B4F6DF123C73E08F0AE91A468361E32F1578F3C45E09F0EE93A25A78721F16DE5D4D0EAF2695A769FA4E97A8E9367A85CBDD2497337CEB5EB7E17F8A3AE7C36F0BDFDAFC2CF19FC4CF04789FC7BE1EF18F80BE309D17C4FFD91E17F19FC37D724D0A5D3FC20F61A425A6A17DA6DDCB63A84BE28B0D7AEF50D36FE44D15ACAD2D5AD2E5AE3C92BF7DCBA96270F4DE1AA394F0B86851C360AAE22BD7C46635A187A7EC6AD6CC2B567275AAD5A90F6B0AFED2752B539AA95B96ACA48FC5E4D3775F136DC9249415DDD28A56B257B5AC92D96885048208C7041E40238F5041047A82083D08C57E8BFED0BFF00054CFDAE3F69DFD96FE0FF00EC7FF15BC59A26A9F067E078B01E08D36CBC39A658EAA7EC366D6D1FF6CEA11458BE366DB534036D6F607C35A579FA069262D1EEEEAD2528A8CC323C9F35C56578DCCB2CC163B179262E58FCA3138AC3D3AD5B2DC6CE94A84B1582A938B961EBCA8CE54DD4A6E3270938DECC2352A42338C2728C6A4796A28B694E37BF2C9755757B33F39EA489C452C523451CCB1C88ED0CBBFCA942306314BE5BC72797201B5FCB9237DA4ED756C3028AF53FAEC41EB9F1E7E28685F197E29F893E22F86FE12FC3CF81DA36BD1E8A969F0CFE15DA6A963E07F0F9D2741D3346B89348B5D6751D56FA29358B9D3E6D6F52F32F191F53D42EE48D11580AF1FA28AC30B86A583C361F0987538D0C2D1A587A319D5AB5E71A54611A74D4EB579D4AD564A1149D4AB527526FDE9CE526DB6DB936DEEDB6EC92D5EAF4564BD1249743FFD9'], _ ['Австрия', 'Austria', '978', 'AT', 'AUT', '040', 'FFD8FFE000104A46494600010101006000600000FFE1003A4578696600004D4D002A00000008000351100001000000010100000051110004000000010000000051120004000000010000000000000000FFDB00430001010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101FFDB00430101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101FFC0001108001D002C03012200021101031101FFC4001F0000010501010101010100000000000000000102030405060708090A0BFFC400B5100002010303020403050504040000017D01020300041105122131410613516107227114328191A1082342B1C11552D1F02433627282090A161718191A25262728292A3435363738393A434445464748494A535455565758595A636465666768696A737475767778797A838485868788898A92939495969798999AA2A3A4A5A6A7A8A9AAB2B3B4B5B6B7B8B9BAC2C3C4C5C6C7C8C9CAD2D3D4D5D6D7D8D9DAE1E2E3E4E5E6E7E8E9EAF1F2F3F4F5F6F7F8F9FAFFC4001F0100030101010101010101010000000000000102030405060708090A0BFFC400B51100020102040403040705040400010277000102031104052131061241510761711322328108144291A1B1C109233352F0156272D10A162434E125F11718191A262728292A35363738393A434445464748494A535455565758595A636465666768696A73747576777879' & _ '7A82838485868788898A92939495969798999AA2A3A4A5A6A7A8A9AAB2B3B4B5B6B7B8B9BAC2C3C4C5C6C7C8C9CAD2D3D4D5D6D7D8D9DAE2E3E4E5E6E7E8E9EAF2F3F4F5F6F7F8F9FAFFDA000C03010002110311003F00F89E8AFEF3FF00E1D61FF04FEFFA366F067FE0DBC67FFCD351FF000EB0FF00827F7FD1B37833FF0006DE33FF00E69ABF06FF0088559E7FD07E55FF0081E2FF00F990FF00757FE2A93E0AFF00D107E28FFE11709FFF004547F061457F79FF00F0EB0FF827F7FD1B37833FF06DE33FFE69A8FF0087587FC13FBFE8D9BC19FF00836F19FF00F34D47FC42ACF3FE83F2AFFC0F17FF00CC81FF001549F057FE883F147FF08B84FF00FA2A3F830A2BFBCFFF0087587FC13FBFE8D9BC19FF00836F19FF00F34D47FC3AC3FE09FDFF0046CDE0CFFC1B78CFFF009A6A3FE215679FF41F957FE078BFFE640FF8AA4F82BFF441F8A3FF00845C27FF00D151F863FF0011097ED0FF00F4433E0C7FE0578E3FF9A0A3FE2212FDA1FF00E8867C18FF00C0AF1C7FF3415FCFF515F35FEBB7157FD0E713FF008061FF00F94F97F5767F497FC496FD177FE8CFF0FF00FE16F107FF003E3FAFBCFE807FE2212FDA1FFE8867C18FFC0AF1C7FF0034147FC4425FB43FFD10CF831FF815E38FFE682BF9FEA28FF5DB8ABFE87389FF00C030FF00FCA7CBFABB0FF892DFA2EFFD19FE1FFF00C2DE20FF00E7C7F5F79FD00FFC4425FB43FF00D10CF831FF00815E38FF00E6828FF8884BF687FF00A219F063FF0002BC71FF00CD057F3FD451FEBB7157FD0E713FF8061FFF0094F97F5761FF00125BF45DFF00A33FC3FF00F85BC41FFCF8FEBEF3FFD9'], _ ['Сербия', 'Serbia', '891', 'RS', 'SRB', '688', 'FFD8FFE000104A46494600010101006000600000FFE1003A4578696600004D4D002A00000008000351100001000000010100000051110004000000010000000051120004000000010000000000000000FFDB00430001010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101FFDB00430101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101FFC0001108001D002C03012200021101031101FFC4001F0000010501010101010100000000000000000102030405060708090A0BFFC400B5100002010303020403050504040000017D01020300041105122131410613516107227114328191A1082342B1C11552D1F02433627282090A161718191A25262728292A3435363738393A434445464748494A535455565758595A636465666768696A737475767778797A838485868788898A92939495969798999AA2A3A4A5A6A7A8A9AAB2B3B4B5B6B7B8B9BAC2C3C4C5C6C7C8C9CAD2D3D4D5D6D7D8D9DAE1E2E3E4E5E6E7E8E9EAF1F2F3F4F5F6F7F8F9FAFFC4001F0100030101010101010101010000000000000102030405060708090A0BFFC400B51100020102040403040705040400010277000102031104052131061241510761711322328108144291A1B1C109233352F0156272D10A162434E125F11718191A262728292A35363738393A434445464748494A535455565758595A636465666768696A737475767778797A82838485868788898A92939495969798999AA2A3A4A5A6A7A8A9AAB2B3B4B5B6B7B8B9BAC2C3C4C5C6C7C8C9CAD2D3D4D5D6D7D8D9DAE2E3E4E5E6E7E8E9EAF2F3F4F5F6F7F8F9FAFFDA000C03010002110311003F00F83EBD6FE1DFC3287C6D687509F5F8EC238B5ED2F49974FB5D36E754D423B4BBBAB286F758BC8E39ACE3B5D32C62BE49F30CD77A85D436DA9CB69632269972EBF927FF000B77E23FFD0D77FF00F7EACBFF00916BFA57FF008275FC00F0F78DFF0064EF811F1A758F10EB1A9789BE2A7C5BF88FF0CFE2245E4EA30DDA692E75AD2FE1E4DE0A7D3F53D2B4393C5DE12D5B40BEF1035BF8AA6B4D0F5FB3D762B1B970DA00B3D7FE23C4FF00A39F881C07C32B39A79CF0C632BD7CCF0396E1E8E1EB662FDFC4BA956AD4AD2C565F86853A14F0D87C44E73A72AB5D35054A8CE52F77FD21E19FDA1BE1D78B38AC770B706E4BC75C299DD3CB2BE6B4F33CFF0001903C154C3' & _ 'E0EBE1A9E23034E597E6B9DD6A58CC5C712A185AB2C12A51A8ACF11427284CF80BC73F0F4F82ECF47BC7D660BA9355173E66937369269DACD835BDFEA3681E6B4F3AF2092D6586CA0BC4B84BB0EB1EA36914B6F1CBE6AA79B57DFFF00F053AF851E1AF02FECBB07ED23E0AD5B54D235DF13FED2DE23F01780B4E43AC5CBD8FC1AB21E27B2D26D3C5973E2079E1B8F1D5AEB3E10BBD47559F428E6D2255F14CD0C3A85DDAD8E971DAFF3DFFF000B77E23FFD0D77FF00F7EACBFF00916B7F0DBE8DDC7FC71C2D86CF679D70C612B4F1188C3D7A588AB9845FB4A6E15232A5F55CBB134E541D1AD4FD9CE538559D9CAA52A6DD91C53FB45BC36F0BB328F09F17F0FF001EF11E7F87A0F138DC7E4797F0E43034A55B158AA71C03FAE675954E788C02A3F56AF56961A746A4E1CD0C456939C97E88D15F9DDFF0B77E23FF00D0D77FFF007EACBFF9168FF85BBF11FF00E86BBFFF00BF565FFC8B5F7BFF00127DC7DFF451F087FE0FCEBFF9CDEBFD3D3E6FFE2AB5E087FD101E2AFF00E11708FF00F4587F6BDFF10A7FECA3FF00472DFB42FF00E00FC37FFE65EBD1ACBF641D73FE09DD3FC09FD98FC25AE78AB5AFD9ED7C7FAAFC54D07E3EF8A2E96C2F7C37E3582DAF752BEF077898F86B4FD3B458D2E161D5AC34BD32FDACE3F1169FE3796FB4CBC1AE7839F67F4AB4D6557528EAAE8C30CACA19587A1520823EA2BA38B388F8AB8C32EC3E5B9A711E36587C3E6582CC943D860671A92C24E4A742A27865254B1386AB5F0D52746A52AD4E359D4A556138A3F81B80F0BC3BC039C62738CB787B0B3AB8BCA71F9454E5C46228D6A54F18A9D4A589C3D49CB114A35F098CC3E171508D7C3622856546587AD4A54EACADFCCBE97FB00EADFF00051AF87DE33FD9F7E2C6B3E39F037C03F85FF1635AF18F83FE32787B54B4D7BC49F12FC53F6BD4F4BB24B5B9F15E872D85DE8F71A15FDEEBFADAE9301B1F0CEAD7BA7F872C2F2F425DA69FC77FC429FF00B28FFD1CB7ED0BFF00803F0DFF00F997AFEA6940501540555015554602803000038000E001C014B57C29C4DC59C2394ACA32CE24C77D5962F178B5CD43030E578AACE71A508C30A92A586A2A961697339D4952A30956A952ACA75259F1E6078738F7886BF10E63C3983A35EAD0C3E1D53588C5D6972D18C9CEA55ACEAD3F6B5B1188A95F13566A953829D670842308C51FCB27FC429FFB28FF00D1CB7ED0BFF803F0DFFF00997A3FE214FF00D947FE8E5BF685FF00C01F86FF00FCCBD7F537457D27FC44EE3CFF00A29319FF0082B07FFCCC7C6FFC43EE0DFF00A10E17FF000662BFF979FFD9']] _GetInfoFromDataBase ("BEGIN;") _GetInfoFromDataBase ("CREATE TABLE IF NOT EXISTS " & $sTableName & " (id INTEGER PRIMARY KEY AUTOINCREMENT, rus TEXT NOT NULL, eng TEXT NOT NULL, ISO_4217_id TINYTEXT NOT NULL DEFAULT 0, ISO_3166_1_alpha_2 TINYTEXT NOT NULL DEFAULT '', ISO_3166_1_alpha_3 TINYTEXT NOT NULL DEFAULT '', ISO_3166_1_digital TINYTEXT NOT NULL DEFAULT '', flag BLOB NOT NULL DEFAULT '');") For $i = 0 To UBound ($aCounties) -1 _GetInfoFromDataBase ("INSERT INTO " & $sTableName & " (rus, eng, ISO_4217_id, ISO_3166_1_alpha_2, ISO_3166_1_alpha_3, ISO_3166_1_digital, flag) VALUES (" & _SQLite_Escape ($aCounties[$i][0]) & ", " & _SQLite_Escape ($aCounties[$i][1]) & ", " & _SQLite_Escape ($aCounties[$i][2]) & ", " & _SQLite_Escape ($aCounties[$i][3]) & ", " & _SQLite_Escape ($aCounties[$i][4]) & ", " & _SQLite_Escape ($aCounties[$i][5]) & ", x" & _SQLite_Escape ($aCounties[$i][6]) & ");") Next _GetInfoFromDataBase ("COMMIT;") EndFunc ; _CreateCountriesTable () Func _GetInfoFromDataBase($Query, $GetArray = False, $ShowFirstRow = False) If $GetArray = False Then Local $hQuery, $aRow, $foo _SQLite_Query($hDataBase, $Query, $hQuery) While _SQLite_FetchData($hQuery, $aRow, False, False) = $SQLITE_OK $foo = $aRow[0] WEnd _SQLite_QueryFinalize ($hQuery) Return $foo ElseIf $GetArray = True Then Local $aResult, $iRows, $iColumns, $iRval $iRval = _SQLite_GetTable2d($hDataBase, $Query, $aResult, $iRows, $iColumns) If $iRval = $SQLITE_OK Then If $ShowFirstRow = False Then _ArrayDelete($aResult, 0) Return $aResult Else MsgBox(0 + 16, "Ошибка SQLite: " & $iRval, _SQLite_ErrMsg()) EndIf EndIf EndFunc ;==>_GetInfoFromDataBase Func _ExitProg () _SQLite_Close($hDataBase) _SQLite_Shutdown() Exit EndFunc ; _ExitProg ; ============== Func _FillCombo ($hCombo, $aComboValues, $sDefaultValue = "") GUICtrlSetData($hCombo, "") For $i = 0 to UBound ($aComboValues) - 1 _GUICtrlComboBox_AddString ($hCombo, $aComboValues[$i][0]) Next If $sDefaultValue <> "" Then _SetComboActiveValue ($hCombo, $sDefaultValue) EndFunc ; _FillCombo Func _SetComboActiveValue ($hfCombo, $sfActiveValue) $aTMP2 = _GUICtrlComboBox_GetListArray($hfCombo) _GUICtrlComboBox_SetCurSel ($hfCombo, _ArraySearch ($aTMP2, $sfActiveValue, 1) - 1) EndFunc ; _SetComboActiveValue Func _OpenDataBase($fDataBaseFile) _SQLite_Startup() If @error Then MsgBox(16, "Ошибка SQLite", "SQLite3.dll Не может быть загружен!") Exit -1 EndIf Global $hDataBase = _SQLite_Open($fDataBaseFile) If @error Then MsgBox(16, "Ошибка SQLite", "Не могу открыть или создать базу данных!") Exit -1 EndIf Return EndFunc ;==>_OpenDataBase I need to improve two things: 1. The image must not be shown when user clicks Tab1 2. The image (if exists) must be removed before drawing another one when user chooses another value in combobox. Thanks in advance. Edited September 5, 2016 by Tipulatoid Link to comment Share on other sites More sharing options...
mikell Posted September 5, 2016 Share Posted September 5, 2016 If you need to display only one image at once on $Tab0, it would be *much* more simple to use an usual pic control ... Link to comment Share on other sites More sharing options...
Tipulatoid Posted September 6, 2016 Author Share Posted September 6, 2016 (edited) 7 hours ago, mikell said: If you need to display only one image at once on $Tab0, it would be *much* more simple to use an usual pic control ... Thank you for the response. Does it mean that I will have to create intermediate image file in ScriptDir? If so, I don't like this decision. If not, could you give an example, please. If there is problem with tabs, I will redesign the interface and refuse from them. But I can't got how to clear already created image when user chooses another value in combo? Thank you Edited September 6, 2016 by Tipulatoid Link to comment Share on other sites More sharing options...
mikell Posted September 6, 2016 Share Posted September 6, 2016 (edited) No image file to create, and you can keep your tabs. The job is done by creating and deleting one pic control only Please try this in your script in post #1 #Include <WinAPI.au3> ; add this include ;..... Func _ShowFlag () Local Const $STM_SETIMAGE = 0x0172 Local Static $pic GuiCtrlDelete($pic) GuiSwitch($MainGUI, $Tab0) _GDIPlus_Startup () Local $hBitmap = _GDIPlus_BitmapCreateFromMemory(Binary (_GetInfoFromDataBase ("SELECT flag FROM countries WHERE eng = " & _SQLite_Escape (GUICtrlRead($CountriesCombo)) & ";"))) Local $iPicWidth = _GDIPlus_ImageGetWidth($hBitmap) Local $iPicHeight = _GDIPlus_ImageGetHeight($hBitmap) $pic = GUICtrlCreatePic("", ($iWidth - $iPicWidth) / 2 + Random (0, 300, 1), ($iHeight - $iPicHeight) / 2 + Random (0, 300, 1), $iPicWidth, $iPicHeight) $hHBmp = _GDIPlus_BitmapCreateHBITMAPFromBitmap($hBitmap) _WinAPI_DeleteObject(GUICtrlSendMsg($pic, $STM_SETIMAGE, 0, $hHBmp)) GUICtrlCreateTabItem("") GUISetState() _GDIPlus_BitmapDispose($hBitmap) _WinAPI_DeleteObject($hHBmp) _GDIPlus_Shutdown() EndFunc ; _ShowFlag Edited September 6, 2016 by mikell replaced magic number Skysnake 1 Link to comment Share on other sites More sharing options...
Tipulatoid Posted September 6, 2016 Author Share Posted September 6, 2016 Awesome!! Huge thanks to you! Link to comment Share on other sites More sharing options...
mikell Posted September 6, 2016 Share Posted September 6, 2016 You're welcome Link to comment Share on other sites More sharing options...
bullmoose20 Posted March 10, 2017 Share Posted March 10, 2017 I am trying to load a users picture that is stored in their customer record as a BLOB in MySQL. I am trying to find a way to show this in an autoit gui but I dont really know where to begin. I can get all the text fields without issue, but dont know about the image itself. Any pointers would be appreciated. I am using the MySQL udf by progandy, but no examples showing the retrieval of an image stired in a blob. Link to comment Share on other sites More sharing options...
Recommended Posts
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 accountSign in
Already have an account? Sign in here.
Sign In Now