Sannie72 Posted February 10, 2021 Share Posted February 10, 2021 I would like to have a Pic(ture) control in a gui that is filled with an online jpg, I have a deeplink to a library of images and depending on the selection I want to show a different URL. This images has an url like https://fleet.siemens-healthineers.com/static/images/02_11060815_NL.jpg Is this directly possible, or do I need to download an image first and then use it? Link to comment Share on other sites More sharing options...
Moderators Melba23 Posted February 10, 2021 Moderators Share Posted February 10, 2021 Sannie72, Welcome to the AutoIt forums. I am unsure quite what you want to do. How are you intending the user to select the image? I would suggest a combo filled with short item descriptions and then when the user selects the required item you can use a 2D array to link the item to an image URL and display it. M23 Any of my own code posted anywhere on the forum is available for use by others without any restriction of any kind Open spoiler to see my UDFs: Spoiler ArrayMultiColSort ---- Sort arrays on multiple columnsChooseFileFolder ---- Single and multiple selections from specified path treeview listingDate_Time_Convert -- Easily convert date/time formats, including the language usedExtMsgBox --------- A highly customisable replacement for MsgBoxGUIExtender -------- Extend and retract multiple sections within a GUIGUIFrame ---------- Subdivide GUIs into many adjustable framesGUIListViewEx ------- Insert, delete, move, drag, sort, edit and colour ListView itemsGUITreeViewEx ------ Check/clear parent and child checkboxes in a TreeViewMarquee ----------- Scrolling tickertape GUIsNoFocusLines ------- Remove the dotted focus lines from buttons, sliders, radios and checkboxesNotify ------------- Small notifications on the edge of the displayScrollbars ----------Automatically sized scrollbars with a single commandStringSize ---------- Automatically size controls to fit textToast -------------- Small GUIs which pop out of the notification area Link to comment Share on other sites More sharing options...
Sannie72 Posted February 10, 2021 Author Share Posted February 10, 2021 40 minutes ago, Melba23 said: Sannie72, Welcome to the AutoIt forums. I am unsure quite what you want to do. How are you intending the user to select the image? I would suggest a combo filled with short item descriptions and then when the user selects the required item you can use a 2D array to link the item to an image URL and display it. M23 The thing I want to do is the following. This is the GUI I created so far: It is an app to be used (mainly) by our Call Center to quickly find telephone numbers and system numbers for the systems installed throughout the country. Select a city (1), select the customer (2), select the equipment (3) and see the contact and contract info (4). It would be nice to also show an image there, indicated by the red box. Because of compliance issues I cannot post the whole sourcecode, but I hope this makes it clear what I am trying to accomplish. The 8-digit number is also the number in the URL I posted before. Because of the number of possibilities (thousands of images) I do not want to download all images but just show them on the fly. Link to comment Share on other sites More sharing options...
Moderators Melba23 Posted February 10, 2021 Moderators Share Posted February 10, 2021 Sannie72, Much clearer now, thanks. I quite understand why you do not want to download all the images - so I think you will have to embed some form of browser to display the images when required. M23 Any of my own code posted anywhere on the forum is available for use by others without any restriction of any kind Open spoiler to see my UDFs: Spoiler ArrayMultiColSort ---- Sort arrays on multiple columnsChooseFileFolder ---- Single and multiple selections from specified path treeview listingDate_Time_Convert -- Easily convert date/time formats, including the language usedExtMsgBox --------- A highly customisable replacement for MsgBoxGUIExtender -------- Extend and retract multiple sections within a GUIGUIFrame ---------- Subdivide GUIs into many adjustable framesGUIListViewEx ------- Insert, delete, move, drag, sort, edit and colour ListView itemsGUITreeViewEx ------ Check/clear parent and child checkboxes in a TreeViewMarquee ----------- Scrolling tickertape GUIsNoFocusLines ------- Remove the dotted focus lines from buttons, sliders, radios and checkboxesNotify ------------- Small notifications on the edge of the displayScrollbars ----------Automatically sized scrollbars with a single commandStringSize ---------- Automatically size controls to fit textToast -------------- Small GUIs which pop out of the notification area Link to comment Share on other sites More sharing options...
Nine Posted February 10, 2021 Share Posted February 10, 2021 Here one easy way you could do it : #include <GUIConstantsEx.au3> #include <InetConstants.au3> #include <StaticConstants.au3> #include <SendMessage.au3> #include <GDIPlus.au3> InetGet ("https://fleet.siemens-healthineers.com/static/images/02_11060815_NL.jpg", "Test.jpg", $INET_FORCERELOAD) _GDIPlus_Startup() $hImage = _GDIPlus_ImageLoadFromFile("Test.jpg") $hImageRez = _GDIPlus_ImageResize($hImage, 100, 80) _GDIPlus_ImageDispose($hImage) $hGUI = GUICreate("Test") $idPic = GUICtrlCreatePic("", 10, 10, 100, 80) $hBitMap = _GDIPlus_BitmapCreateHBITMAPFromBitmap($hImageRez) _GDIPlus_ImageDispose($hImageRez) _WinAPI_DeleteObject(_SendMessage(GUICtrlGetHandle($idPic), $STM_SETIMAGE, $IMAGE_BITMAP, $hBitmap)) _WinAPI_DeleteObject($hBitmap) _GDIPlus_Shutdown() FileDelete("Test.jpg") GUISetState() While True Switch GUIGetMsg() Case $GUI_EVENT_CLOSE ExitLoop EndSwitch WEnd Sannie72 1 “They did not know it was impossible, so they did it” ― Mark Twain Spoiler Block all input without UAC Save/Retrieve Images to/from Text Monitor Management (VCP commands) Tool to search in text (au3) files Date Range Picker Virtual Desktop Manager Sudoku Game 2020 Overlapped Named Pipe IPC HotString 2.0 - Hot keys with string x64 Bitwise Operations Multi-keyboards HotKeySet Recursive Array Display Fast and simple WCD IPC Multiple Folders Selector Printer Manager GIF Animation (cached) Screen Scraping Multi-Threading Made Easy Link to comment Share on other sites More sharing options...
Nine Posted February 10, 2021 Share Posted February 10, 2021 An even better way, without file : #include <GUIConstantsEx.au3> #include <InetConstants.au3> #include <StaticConstants.au3> #include <SendMessage.au3> #include <GDIPlus.au3> $dImage = InetRead ("https://fleet.siemens-healthineers.com/static/images/02_11060815_NL.jpg", $INET_FORCERELOAD) _GDIPlus_Startup() $hImage = _GDIPlus_BitmapCreateFromMemory($dImage) $hImageRez = _GDIPlus_ImageResize($hImage, 100, 80) _GDIPlus_ImageDispose($hImage) $hGUI = GUICreate("Test") $idPic = GUICtrlCreatePic("", 10, 10, 100, 80) $hBitMap = _GDIPlus_BitmapCreateHBITMAPFromBitmap($hImageRez) _GDIPlus_ImageDispose($hImageRez) _WinAPI_DeleteObject(_SendMessage(GUICtrlGetHandle($idPic), $STM_SETIMAGE, $IMAGE_BITMAP, $hBitmap)) _WinAPI_DeleteObject($hBitmap) _GDIPlus_Shutdown() GUISetState() While True Switch GUIGetMsg() Case $GUI_EVENT_CLOSE ExitLoop EndSwitch WEnd Sannie72 and pixelsearch 1 1 “They did not know it was impossible, so they did it” ― Mark Twain Spoiler Block all input without UAC Save/Retrieve Images to/from Text Monitor Management (VCP commands) Tool to search in text (au3) files Date Range Picker Virtual Desktop Manager Sudoku Game 2020 Overlapped Named Pipe IPC HotString 2.0 - Hot keys with string x64 Bitwise Operations Multi-keyboards HotKeySet Recursive Array Display Fast and simple WCD IPC Multiple Folders Selector Printer Manager GIF Animation (cached) Screen Scraping Multi-Threading Made Easy Link to comment Share on other sites More sharing options...
pixelsearch Posted February 10, 2021 Share Posted February 10, 2021 Very useful, bravo Nine ! May 11, 2020 was a great day Link to comment Share on other sites More sharing options...
Nine Posted February 10, 2021 Share Posted February 10, 2021 (edited) 12 minutes ago, pixelsearch said: May 11, 2020 was a great day What happened that day ? nvm got it tx Edited February 10, 2021 by Nine “They did not know it was impossible, so they did it” ― Mark Twain Spoiler Block all input without UAC Save/Retrieve Images to/from Text Monitor Management (VCP commands) Tool to search in text (au3) files Date Range Picker Virtual Desktop Manager Sudoku Game 2020 Overlapped Named Pipe IPC HotString 2.0 - Hot keys with string x64 Bitwise Operations Multi-keyboards HotKeySet Recursive Array Display Fast and simple WCD IPC Multiple Folders Selector Printer Manager GIF Animation (cached) Screen Scraping Multi-Threading Made Easy Link to comment Share on other sites More sharing options...
Werty Posted February 11, 2021 Share Posted February 11, 2021 (edited) Reading OP's description it sounds like a picture control isnt needed, but just want to show an Image there. If that's the case, then this could do it. #include <GDIPlus.au3> $hGUI = GUICreate("Test") GUISetState() _GDIPlus_Startup() _GDIPlus_GraphicsDrawImageRect(_GDIPlus_GraphicsCreateFromHWND($hGUI),_GDIPlus_BitmapCreateFromMemory(InetRead("https://fleet.siemens-healthineers.com/static/images/02_11060815_NL.jpg", 1)), 10, 10, 100, 80) _GDIPlus_Shutdown() While True Switch GUIGetMsg() Case - 3 ExitLoop EndSwitch WEnd No variables other than HGUI and nothing to dispose. Edited February 11, 2021 by Werty Some guy's script + some other guy's script = my script! Link to comment Share on other sites More sharing options...
Nine Posted February 11, 2021 Share Posted February 11, 2021 (edited) 1 hour ago, Werty said: No variables other than HGUI and nothing to dispose No. You do not get it. It is not just drawing ONE image in a whole GUI. He needs to show hundreds of images on a small portion of a larger GUI. Your example is useless for what he needs to do. Edited February 11, 2021 by Nine “They did not know it was impossible, so they did it” ― Mark Twain Spoiler Block all input without UAC Save/Retrieve Images to/from Text Monitor Management (VCP commands) Tool to search in text (au3) files Date Range Picker Virtual Desktop Manager Sudoku Game 2020 Overlapped Named Pipe IPC HotString 2.0 - Hot keys with string x64 Bitwise Operations Multi-keyboards HotKeySet Recursive Array Display Fast and simple WCD IPC Multiple Folders Selector Printer Manager GIF Animation (cached) Screen Scraping Multi-Threading Made Easy Link to comment Share on other sites More sharing options...
Werty Posted February 11, 2021 Share Posted February 11, 2021 (edited) Please explain 😕 include <GDIPlus.au3> $hGUI = GUICreate("Test") GUISetState() _GDIPlus_Startup() For $loop = 1 To 100; Hundreds! _GDIPlus_GraphicsDrawImageRect(_GDIPlus_GraphicsCreateFromHWND($hGUI),_GDIPlus_BitmapCreateFromMemory(InetRead("https://fleet.siemens-healthineers.com/static/images/02_11060815_NL.jpg", 1)), Random(0, 320), Random(0, 240), 100, 80) Next _GDIPlus_Shutdown() While True Switch GUIGetMsg() Case - 3 ExitLoop EndSwitch WEnd Ofcourse the end result would require a variable, having all the jpg addresses in an array, so it would be something like... _GDIPlus_GraphicsDrawImageRect(_GDIPlus_GraphicsCreateFromHWND($hGUI),_GDIPlus_BitmapCreateFromMemory(InetRead($Address_Of_JPG[$Loop]), 1)), 10, 10, 100, 80) Else i dont see why it wouldnt work. /edit Just tried a 1000 loop and yes, there's memory leak ofcourse since it's "undisposable" Without memory leak, and you get your variables and disposes #include <GDIPlus.au3> $hGUI = GUICreate("Test") GUISetState() _GDIPlus_Startup() For $loop = 1 To 1000; Hundreds! $dImage = InetRead ("https://fleet.siemens-healthineers.com/static/images/02_11060815_NL.jpg", 1) $hImage = _GDIPlus_BitmapCreateFromMemory($dImage) $hGraphics = _GDIPlus_GraphicsCreateFromHWND($hGUI) _GDIPlus_GraphicsDrawImageRect($hGraphics, $hImage, Random(0, 320), Random(0, 240), 100, 80) _GDIPlus_ImageDispose($hImage) _WinAPI_DeleteObject($hGraphics) Next _GDIPlus_Shutdown() While True Switch GUIGetMsg() Case - 3 ExitLoop EndSwitch WEnd Edited February 11, 2021 by Werty Some guy's script + some other guy's script = my script! Link to comment Share on other sites More sharing options...
Sannie72 Posted March 3, 2021 Author Share Posted March 3, 2021 Thanks everybody for the suggestions! It works like a charm! 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